Message-Id: <3.0.5.32.19980326093933.00a57c10@hal.nt.tuwien.ac.at> Date: Thu, 26 Mar 1998 09:39:33 +0100 To: Eli Zaretskii From: Anton Helm Subject: Re: flex never frees some buffers !? Cc: djgpp AT delorie DOT com In-Reply-To: References: <3 DOT 0 DOT 5 DOT 32 DOT 19980325165901 DOT 00a30100 AT dictator DOT nt DOT tuwien DOT ac DOT at> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Precedence: bulk At 10:50 26.03.98 +0300, you wrote: > >On Wed, 25 Mar 1998, Anton Helm wrote: > >> Anyone out there who knows why this memory is kept until program terminates ? >> and how to get rid of the allocated memory during runtime ? > >I looked in the Flex manual, and there's a chapter there called >"Multiple Buffers". It documents a function `yy_delete_buffer' which >is said to ``reclaim the storage associated with a buffer''. Doesn't >this do what you need? > The yy_delete_buffer works fine for additionally aquired buffers (e.g. if you parse included files, like *.h in C) but NOT for the initial buffer because you are still inside flex when you detect an EOF and obviously must leave yylex() before freeing memory. What I don't understand is, why doesn't flex itself free the memory ? Tony ************************************************************** Dipl.-Ing. Anton HELM *T* mailto:tony AT nt DOT tuwien DOT ac DOT at Institut fuer *U* http://www.nt.tuwien.ac.at/~tony/ Nachrichtentechnik und *W* http://www.nt.tuwien.ac.at/ Hochfrequenztechnik *I* talkto:tony AT eagle DOT nt DOT tuwien DOT ac DOT at Guszhausstr. 25/389 *E* phoneto:+43-1-58801-3520 A-1040 Wien, AUSTRIA *N* faxto:+43-1-5870583 **************************************************************