Subject: Re: memleak in printf?
To: None <netbsd-users@netbsd.org>
From: Zbigniew Baniewski <zb@ispid.com.pl>
List: netbsd-users
Date: 04/19/2006 13:17:23
On Wed, Apr 19, 2006 at 11:24:50AM +1000, Simon Burge wrote:
> > int main(void) {
> > int result = 10;
> >
> > printf("%i\n", result);
> > return(EXIT_SUCCESS);
> > }
> 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.
Although it was the cure: is it logical to close(stdout) - when there wasn't
any open(stdout) done?
> Maybe Linux does an implicit fclose() on exit?
And isn't it more logical? No "formal" opening - so, no "formal" closing...
--
pozdrawiam / regards
Zbigniew Baniewski