[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Memory (de)allocation ...
From: |
Ricardo Rafael |
Subject: |
Memory (de)allocation ... |
Date: |
Mon, 05 May 2003 17:01:21 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312 |
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.
Any previous experience ... anyone?!
Sincerely,
RR.
- Memory (de)allocation ...,
Ricardo Rafael <=