On 2025-08-28 01:08, Collin Funk wrote:
Most (all?) of the programs in Coreutils will not free memory before exit, since it just takes extra time for no benefit.
Not only does it take extra time (and sometimes even space!), it makes the programs slightly less reliable because if there are bugs elsewhere the calls to 'free' can have undefined behavior. And this makes for more maintenance burden, since developers therefore have to verify that these other bugs cannot occur.
The idea that programmers ought to carefully free everything just before exit, merely to pacify a leak sanitizer, is misguided and counterproductive.