Message-Id: <3.0.5.32.19980326112608.00a59950@hal.nt.tuwien.ac.at> Date: Thu, 26 Mar 1998 11:26:08 +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 19980326093933 DOT 00a57c10 AT hal DOT nt DOT tuwien DOT ac DOT at> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Precedence: bulk At 13:07 26.03.98 +0300, you wrote: > >On Thu, 26 Mar 1998, Anton Helm wrote: > >> 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. >But your problem was, as I recall it, that Flex was using up 16K >*per buffer*. yy_delete_buffer should be the solution for n-1 buffers >out of n, at the least. Sorry for my beeing inprecise. I mean: I have a program.exe that reads n different files with n different flex/bison parsers(e.g. aalex(), bblex(), cclex(), ...) each of them consuming at least 16k. Any of the n files may contain any number m of (nested) "include" statements. The buffers for these m flex inputs can be freed with yy_delete_buffer. But not the n initial buffers. A typical number from one of our projects is 9 parsers per *.exe which means 144k memory waste. >Surely, any modern machine can afford allocating >16KB, no? Not any bit. I'm not writing Micros*** programs :-) 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 **************************************************************