[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: memory lost
From: |
Hans Aberg |
Subject: |
Re: memory lost |
Date: |
Tue, 1 May 2001 11:58:09 +0200 |
At 23:30 +0200 2001/04/30, alexandre.gouraud wrote:
>I have a problem with my parser. I am loosing 80 bytes of
>memory, and I can't manage to find out where.
...
> I don't think the memory lost is due to flex,
>because the amount of free memory doesn't change before and
>after each call to yylex.
...
>****************** FLEX file *******************************
...
>"sanjay" {lvalp->charPtr=yytext;return SANJAY_TOKEN;}
Note that you do not copy yytext. It means that in
>********************** BISON file ************************
...
>hostname_group : hostname
> | hostname hostname_group
...
>hostname :SANJAY_TOKEN
when you come to hostname_group, yytext is no longer what you have
expected. (yytext is just a pointer into a buffer, not a copy of something.)
Check if that may have something to do with your problem.
Also, it is better to write
hostname_group:
hostname
| hostname_group hostname
because the parsing then can take place using bounded stack space (see 3.4
in the Bison manual).
Hans Aberg
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: memory lost,
Hans Aberg <=