Message-Id: <4.2.0.58.19990908175923.00a4e100@hal.nt.tuwien.ac.at> X-Sender: tony AT dictator DOT nt DOT tuwien DOT ac DOT at X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58 Date: Wed, 08 Sep 1999 18:07:02 +0200 To: djgpp AT delorie DOT com From: Anton Helm Subject: Re: flex bison bug? In-Reply-To: References: <7r2hvn$ja5$1 AT news2 DOT kornet DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk At 02:23 PM 9/7/99 +0200, you wrote: > >On Tue, 7 Sep 1999, Jongwhan Lee wrote: > >> Detected memory leaks! >> Dumping objects -> >> {45} normal block at 0x00346E38, 16386 bytes long. >> Data: < rtex { 1 1 2> 00 00 72 74 65 78 20 7B 0A 09 31 20 31 20 20 32 >> {44} normal block at 0x00431F70, 40 bytes long. >> Data: < h% 8n4 8n4 @ > 08 68 25 10 38 6E 34 00 38 6E 34 00 00 40 00 00 >> Object dump complete. >> The thread 0x199 has exited with code 0 (0x0). > >I don't understand these messages. How does VC decide that these are >leaks? A buffer that isn't freed when the program exits isn't >necessarily a leak: it might have been used all the time before exit. These are well known memory leeks in flex generated lexers. One of them is the input buffer (I've forgotten what the other was Altzheimer, you know ...) As far as I understand it you need these buffers for special purposes (e.g. restart the lexer). If you don't use such features you might free these two memory blocks _AFTER_ (!!!) using the lexer. E.g. when you have fclosed() the input file. DON'T FREE THIS MEMORY WITH END-OF-FILE RULES !!! (You will get a crash) Tony