4 ms·
Since this seems to be some sort of joke i'm going to provide a "real" answer: write modular software where you can verify that each module is leak proof + use
by x86x87 3y ago
Since this seems to be some sort of joke i'm going to provide a "real" answer: write modular software where you can verify that each module is leak proof + use valgrind to actually track and verify you don't have links.
I have written medium to large projects using this approach and a leak-free program is not outside the realm of possible
- diziet_sma 3y agoThis does help, but the hard part of memory leaks is leaks across module/api boundaries. You can write a memory safe module, I can write a memory safe program, but when my program starts calling your program there's nothing validating I'm maintaining the invariants required to avoid memory leaks. Hopefully the invariants are documented, but relying on documentation to help programmers avoid memory leaks is far from foolproof.