Related articles |
---|
Memory leaks upon error recovery in Yacc davidpereira@home.com (David Pereira) (2000-11-18) |
Re: Memory leaks upon error recovery in Yacc timur@lantel.ru (Timur Safin) (2000-12-01) |
Re: Memory leaks upon error recovery in Yacc hannah@mamba.pond.sub.org (2000-12-18) |
Re: Memory leaks upon error recovery in Yacc kapland@starfleet.com (2000-12-18) |
From: | "Timur Safin" <timur@lantel.ru> |
Newsgroups: | comp.compilers |
Date: | 1 Dec 2000 13:36:19 -0500 |
Organization: | Compilers Central |
References: | 00-11-132 |
Keywords: | yacc, storage, comment |
Posted-Date: | 01 Dec 2000 13:36:19 EST |
Hi David,
> This introduces a problem, however, because those semantic values
> popped off the stack, can contain pointers to subtrees... Therefore,
> I have memory leaks and I would like to deallocate those subtrees.
I'd suggest using stack-based memory allocator - alloca(). Once you
leave the current stack level, all the memory would be "deallocated"
automatically.
BTW this mechanism is used for maintaining bison own stack-memory.
Happy coding,
Timur Safin
mailto:timur@lantel.ru http://timur.lanit.ru
mailto:timur@intersystems.ru
[So long as you're willing to stick with C compilers that have alloca(),
it's not a bad solution. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.