delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/25/05:03:13

Date: Tue, 24 Mar 1998 21:54:28 -0800 (PST)
Message-Id: <199803250554.VAA20210@adit.ap.net>
Mime-Version: 1.0
To: Olivier Perron <perron AT art DOT alcatel DOT fr>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: flex never frees some buffers !?

At 11:14  3/24/1998 +0100, Olivier Perron wrote:
>Hi,
>
>I've just discovered that flex (flex254b) never frees the 2 following
>buffers:
> - yy_current_buffer->yy_ch_buf (size: approx. 16 kbytes)
> - yy_current_buffer            (size: 40 bytes)
>
>When the program that use flex exits, it leaves ~16 kbytes of allocated
>memory which is never freed.
>On unix it is not a problem because when a process die any unfreed memory
>that was allocated by the process will be freed by the kernel.
>But on DOS machines, this unfreed memory still remain as allocated and is
>definitivly lost until next reboot.

That's not true. On DOS also, memory unfreed at termination does get freed.
What made you think otherwise?

>So if you want to recover those 2 buffer, you have to add a "clean-up"
>procedure on program's exit in order to free them.

If the memory leak worries you, you can; otherwise ignore it.

>Is it a known problem/bug or did I miss something ?

I suspect there is a reason for not freeing these (perhaps flex expects to
have to use them later?? I haven't investigated), but if you think
otherwise, feel free to report it as a bug to GNU.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019