bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Question / Bison 1.875c]: %destructorS not being called at all?


From: Tim Van Holder
Subject: Re: [Question / Bison 1.875c]: %destructorS not being called at all?
Date: Tue, 02 Mar 2004 08:30:47 +0100
User-agent: Mozilla Thunderbird 0.5 (Windows/20040207)

Jeannot_Langlois wrote:

Shouldn't these "%destructor"s be called automatically? Or am I doing something wrong (or misunderstanding anything)? In either case, has anybody seen this behavior before, and how can I ensure that memory allocated by "malloc" in semantic actions gets properly freed by "%destructor"s ?

As I understand it, the %destructors are only called if the parser needs
to throw away a token.  If your parser didn't have an error condition,
or a parser split in the case of GLR, the parser will probably have
successfully passed the tokens to the actions you defined.  As such, it
didn't throw any tokens away and didn't call %destructor.  The moment
tokens reach action code (even the default action) it becomes your job
to clean them up (typically you will place token values in a parse tree
of some sort, and you don't want bison to deallocate parts of it behind
your back).
Also see the 'Destructor Decl' topic in the bison info file.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]