> On Apr 24, 2022, at 8:59 AM, ron minnich <rminnich@gmail.com> wrote:
>
> Thanks.
>
> I did find a newer-ish version and I always get a kick out of stuff like this:
>
> free_dirlist(&ls, ALL_DIRS);
>
> right before the call to exit ... an inappropriate response to an
> inappropriate warning, I suppose
>
> I once had an intern ask me "but if you don't free memory before the
> program exits, then it can never get used again, right?" :-)
>
> (and yes, I know, in the paleo era, that was in fact true)
>
> I'll go try to find that archive ...
>
> ron
>
At $WORK we have a standing rule that all memory must be freed before the program exits.
This is to ensure that the rest of the program doesn’t have any memory leaks. ASAN, UBSAN,
Valgrind and the rest are good and far from perfect for detection of problems.
However making sure to free all memory before exit() does aid them in finding problems early.
Some colleagues took an external sort routine I wrote and tried to turn it into a subroutine in a larger system.
(Why they didn't just pipe input into the sort process I never understood).
I hadn't taken any care to free the memory it used (and it used a LOT of memory),
so after it was invoked a few times, it ran out of space.
I try to be more careful now about keeping track of memory
(but that requires extra memory).