|
From: | Hans Aberg |
Subject: | Re: Memory Leaks |
Date: | Mon, 13 Nov 2006 19:53:47 +0100 |
On 13 Nov 2006, at 18:17, Sean Walton wrote:
I've generated a parser with bison and I tried running valgrind on it.If you are using malloc() in your semantic actions, you will witness memory leaks unless you are *very* careful to release them. I was given this warning as I have gone in and started modifying someone else's work.The wierd thing is... there's a huge bunch of memory leaks reported. :-( Is this known? Is this a bison leak or a valgrind bug? Regards,
There is now %destructor to clean up C-code leaks during error recovery; otherwise, do it by hand in the actions. I think the developers have worked hard to plug the Bison generated parsers. I don't use C, but C++, in which case one can use language features to do the cleanup.
Hans Aberg
[Prev in Thread] | Current Thread | [Next in Thread] |