3 ms·
> The test infrastructures I build catch memory leaks all of time [...] Could you elaborate on that, please? I'm curious. Thank you in advance!
by dawidw 8y ago
> The test infrastructures I build catch memory leaks all of time [...]
Could you elaborate on that, please? I'm curious. Thank you in advance!
- mikestew 8y agoIt would be very specific to the project. For instance, if it's an iOS/Mac project, Xcode has nice profiling tools to catch memory leaks. And of course clang's static analyzer as well. What I'm working on now is embedded Linux, so valgrind and some test suite to exercise the code. But in general, no matter the project, you need a few key pieces: 1. A test suite that thoroughly exercises the code. You'll need this for... 2. A tool such as valgrind to watch memory as your tests in #1 run. Build time, ad hoc, stick in the pipeline anywhere you like. 3. A static analyzer to take a first pass at the code and say, "hmm, this might leak/crash/kill puppies." So, yeah, the order is off as this should be the first thing you do. It can run on your dev machine or on the build machine. Expect lots of false positives. (optional) 4. A code coverage tool to make sure you're not missing key pieces of code that need exercise.