Valgrind pros:
- Catches common memory bugs (UB) on dynamically allocated memory regions
- Using uninitialized variables
- Out-of-bounds memory accesses (read/write underflow/overflow bugs)
- Use-after-free / use-after-return (out-of-scope) bugs
- Double free
- Leakage
- No modification to source code required
- No recompile required
- No special compiler flags required
Valgrind cons:
- Performance: target software may run up to 10 to 30 times slower when run under Valgrind.
- Memory footprint: each allocation within the target program requires Valgrind to make a memory allocation as well (making running Valgrind on highly-resource-constrained embedded Linux systems difficult).
- Cannot catch bugs on statically (compile-time) ...