Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valgrind used in C++ development?

I'm quite new to C++ but have some basic C knowledge. In my past C (university) projects, I used Valgrind to check for memleaks.

Now, with C++, is Valgrind a valid tool? Does C++ suffer the same problems concerning memleaks like C? Or are there even better tools to use in conjunction with C++?

like image 268
helpermethod Avatar asked Oct 25 '10 20:10

helpermethod


1 Answers

I never use new and delete (or other forms of manual memory management) and I very rarely even use pointers. And I still have to wrestle with memory leaks invalid memory accesses.1 Valgrind is an indispensable tool for me. Even more important than gdb.


1 As Viktor pointed out in a comment, producing memory leaks without manual memory management would be pretty weird (discounting circular references and other special cases).

like image 131
Konrad Rudolph Avatar answered Sep 28 '22 09:09

Konrad Rudolph