3 ms·
Do people use Valgrind much in C++? I've never had to. I feel like the only time I'd need it is if I'm writing "C++" code that is really just glorified C.
by mehrdadn 7y ago
Do people use Valgrind much in C++? I've never had to. I feel like the only time I'd need it is if I'm writing "C++" code that is really just glorified C.
- mempko 7y agoUse it to profile my code, especially if you want to count cache misses, etc.
- tomnj 7y agoDue to the memory unsafety of C++, memory debuggers are absolutely used, including valgrind's memcheck and the Google sanitizers. Memory leaks and double frees are easier to avoid in C++ than C even without tooling, but use-after-free (for example) is absolutely a problem. And "modern" C++ won't necessarily help you here: even heard of string_view, span, or ranges? Memory debuggers are also often used in conjunction with fuzzing to track down bugs that the compiler may not tell you about.
- pjmlp 7y agoCan you say the same about the third party libraries or other in-house modules?
- de_watcher 7y agoStandard containers/algorithms/iterators have some caveats like messing up the erase-remove idiom by forgetting to pass the end iterator.