I'm implementing a sparse matrix with linked lists and it's not fun to manually check for leaks, any thoughts?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
- What is the correct way to declare and use a FILE
The
valgrind
profiler for Unix offers a decent leak detection.However, this is only one part of a successful approach. The other part is to prevent (i.e. minimize) explicit memory handling. Smart pointers and allocators can help a great deal in preventing memory leaks. Also, do use the STL classes: a leak-free linked list implementation is already provided by
std::list
.The original version of Purify on Unix was brilliant. But the Windows version produced after Rational bought it is terrible. Flakey as hell. Avoid at all costs.
On Windows:
Compuware BoundChecker (bit costly but very nice)
Visual LeakDetector (free, google it)
On Linux/Unix:
Purify
You can read good article about memory leaks on Wikipedia: http://en.wikipedia.org/wiki/Memory_leak
This page also has the good links to other articles and even programms that will help you a lot.
If you use Anjuta,you can use valgrind module.