Subject: Re: memleak in printf?
To: Simon Burge <>
From: Piotr Meyer <>
List: netbsd-users
Date: 04/19/2006 08:49:50
On Wed, Apr 19, 2006 at 11:24:50AM +1000, Simon Burge wrote:
> stdio will allocate a buffer when stdout is first used.  Try adding
> "fclose(stdout);" before your return(EXIT_SUCCESS).  dmalloc showed
> no not-freed pointers after doing that here.

It's working! Thanks!

> > PS. I made test on Linux (Ubuntu 5.10 with kernel 2.6.12) without any
> > warnings/errors.
> Maybe Linux does an implicit fclose() on exit?


Normal termination causes the following actions:
2. All open streams are closed, writing out any buffered output data. 
See Closing Streams. In addition, temporary files opened with the 
tmpfile function are removed; see Temporary Files.

Piotr 'aniou' Meyer