[PATCH] Add comments to explain when a stream is freed by, __libc_freeres().
Andreas Schwab
schwab@linux-m68k.org
Tue May 26 12:57:20 GMT 2020
On Mai 26 2020, Florian Weimer wrote:
> * Andreas Schwab:
>
>> On Mai 26 2020, Florian Weimer wrote:
>>
>>> How can it be? It's not an observable effect. No user code runs after
>>> this point, so what difference does it make?
>>
>> I don't understand. You postulate a leak due to "neglected to call
>> fclose", but streams are guaranteed to be closed anyway, thus there is
>> no leak.
>
> All memory is freed on process termination, so not calling free on
> memory allocations does not introduce a leak, either. Yet we expect
> memory debuggers such as valgrind to report them.
But unlike general allocations, open streams are guaranteed to be always
reachable (fflush (0) will find them all).
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
More information about the Libc-alpha
mailing list