4 ms·
Isn't the point that it's not a leak if the program exits quickly?
by tree_of_item 12y ago
Isn't the point that it's not a leak if the program exits quickly?
- jacquesm 12y agoIf you can't be trusted to get the bookkeeping right what makes you think the rest of the program is solid? Being able to manage your allocation is a pretty good sign that a C programmer knows what he's doing. Relying on 'exit' to free your memory is backporting the web mentality to unix land, it just simply doesn't work that way. There is no different attitude when you write a long running daemon versus a utility program because for all you know your utility program code will be re-purposed to become part of a longer running daemon. So you write your code in as clean a manner as possible and balance your allocs/frees and make sure that you don't have any latent buffer overflows which you may not care about today because of the context your code executes in today because tomorrow that context of execution might change and then we're looking at yet another exploit.
- digi_owl 12y ago> Relying on 'exit' to free your memory is backporting the web mentality to unix land A very fitting description of systemd as a whole.
- DougBTX 12y agoCleaning up by exiting can be much faster too, eg, https://lists.gnu.org/archive/html/coreutils/2014-08/msg00012.html https://lists.gnu.org/archive/html/coreutils/2014-08/msg0001...