[Top][All Lists]

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

Re: Bison bugs (memory leaks) found by valgrind in GLR-related tests

From: Joel E. Denny
Subject: Re: Bison bugs (memory leaks) found by valgrind in GLR-related tests
Date: Sat, 10 Dec 2005 11:28:50 -0500 (EST)

On Thu, 8 Dec 2005, Paul Eggert wrote:

> "Joel E. Denny" <address@hidden> writes:
> > Unfortunately, I don't have a linux box set up, and I'm pretty sure
> > valgrind requires the kernel.  I've been meaning to set one up
> > specifically for valgrind, but it won't be any time soon.
> OK.  Perhaps you don't need valgrind, since I can tell you its results.
> valgrind reports that contains test cases that leak memory,
> and if you look at the test cases it's pretty obvious that they do.
> Unfortunately when I tried to close the leaks (see below) I ended up
> freeing storage more than once, and I suspect it's due to a GLR bug
> (one that perhaps you're already fixing).

It's a bug in the test case.  Some token semantic values are shared 
between the merged parse trees.  Each such value is freed by semantic 
actions for both trees.

I suspect the original memory leak was intentional because this isn't 
quick to resolve.  Normally I use GLR to construct packed shared parse 
forests, and I maintain a reference count for shared nodes.  Thus, all 
semantic values are freed at the end rather than at each reduction.

But that's a bit much for this test case.  Perhaps a comment stating the 
memory leak is intentional would be fine.

> By the way, should the action for "error ';'" free ($1)?

Hmm....  Is it actually possible to assign a semantic value to an error 


reply via email to

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