3 ms·
A great way to write horrible programs. In short: If it works until it crashes, it doesn't work.
by msla 3y ago
A great way to write horrible programs.
In short: If it works until it crashes, it doesn't work.
- enriquto 3y agoTFA is clearly written in jest. The provided code is not supposed to be run in production, just to illustrate how easy is to trick a "leak detector" in your debugger. You just put all your mallocs in a list, and at the end of your program you can free them all. Yet, the idea of not freeing some memory in your program is not entirely stupid. Unless your memory is allocated inside a loop of unpredictable length, it's not really necessary to ever free it. Worse: the call to "free" may even fall after your program has run successfully. Thus, avoiding the useless (but typical) freeing spree at the end of your program may make it more robust!