[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Memory (de)allocation ...
From: |
Akim Demaille |
Subject: |
Re: Memory (de)allocation ... |
Date: |
Tue, 06 May 2003 09:53:22 +0200 |
User-agent: |
Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3 (gnu/linux) |
| Hi,
| I am developing a script language compiler using Flex (C++
| classes generated) and Bison (%pure-parser directive used), that will
| be running as a multi-threaded server process (in Win32). What should
| I do in order to avoid memory leakage?
|
| a) Manually write all deallocation code in every single action;
|
| b) Use the following Bison syntax:
| %destructor { delete $$; } program
| %destructor { if ( $$.mem ) delete $$.mem; } items rule2
| %destructor { complexCode( $1 ); delete $$; } xpto_rule
| ...
|
| Option b) should be the correct one, right!? In case of a syntax
| error, the right destructors are always called. Am I correct?! Or am I
| missing something.
You are correct, this is the intention. But IIRC there is still one
case where we leak. I can't remember the case though :(