Re: bison and valgrind
- From: Allan Adler <ara@xxxxxxxxxxxxxxxxxxxx>
- Date: 29 Mar 2007 23:24:32 -0500
Allan Adler <ara@xxxxxxxxxxxxxxxxxxxx> writes:
I haven't actually tested the parser with valgrind. I'll do that tomorrow.
I just consider it extremely likely that it will be leaky.
I did it. As I expected the parser is leaky. Let's call the data type a gleep.
When the action says {$$ = cat_gleep($1,$2);}
thereby causing a new gleep to be allocated, I found that bison doesn't
complain if I change it to something like:
{$$ = cat_gleep($1,$2);
free_gleep(&$1);
free_gleep(&$2);
}
That probably means that I do have a little bit of control over leaks.
not.. Assuming I can do that, what I am then worried about is that the place
where I have to modify the parser to plug the leak will be part of the boiler
plate code that bison uses, and therefore is not really accessible as part of
the normal use of bison and flex. In particular, if I modify the .y file, I
will also have to modify by hand the file that bison produces every time I do
so. There are worse fates, but if there is a way to avoid this particular
fate, I'd like to know about it.
When I ran valgrind, I found that there were leaks in the routines
yy_flex_alloc and yy_create_buffer. I'm less certain about how to deal
with these, since it appears that they come from the boiler plate of flex
(I don't really know for sure).
--
Ignorantly,
Allan Adler <ara@xxxxxxxxxxxxxxxxxxxx>
* Disclaimer: I am a guest and *not* a member of the MIT CSAIL. My actions and
* comments do not reflect in any way on MIT. Also, I am nowhere near Boston.
.
- Follow-Ups:
- Re: bison and valgrind
- From: Rob Thorpe
- Re: bison and valgrind
- From: Chris Uppal
- Re: bison and valgrind
- References:
- bison and valgrind
- From: Allan Adler
- bison and valgrind
- Prev by Date: Re: Combination of binary variables
- Next by Date: Re: Combination of binary variables
- Previous by thread: Re: bison and valgrind
- Next by thread: Re: bison and valgrind
- Index(es):
Relevant Pages
|