On 4 Aug 2010, at 14:17, Sasan Forghani wrote:
I apologize for my lack of understanding. You said the next step is
to clean it up in the actions... please clarify?
When you allocate stuff using malloc, strdup, etc. when pointer is not
used anymore, to avoid memory leak, one must apply free(). For
example, an action might look like
$$ = malloc(...) // pr something
// copy over some stuff from the $k values.
Now the, $k values are not used anymore - only $$, so they must be
cleaned up using free().
This works if you do not want to do error recovery. For that there is
a special function (see the Bison manual).
I do not program in C, but C++, where the language is taking care of
this. So perhaps some else might give better examples.
_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison