On 4 Feb 2009, at 07:40, <harish.chaluv...@wipro.com> <harish.chaluv...@wipro.com > wrote:

           I am new to bison. I got a memory leak. Leak is due to the
strdup in lex file

astr         [-a-zA-Z0-9_\.\/\,\<]*


{astr}   {
               yylval.text = strdup( (char *)yytext );
               return ASTR;
       }

           I have added

%destructor  { free($$); }   ASTR

           but still i am getting memory leaks(valgrind).

can anyone help me how to solve this ???????

%destructor only makes clean-up in the case of errors. So you still need to make normal cleanup in the actions. Or use a language which can do it, like C++ or Java.

  Hans




_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to