Memory debugger
This article needs additional citations for verification. (December 2011) |
A memory debugger is a programming tool for finding memory leaks and buffer overflows. These are due to bugs related to the allocation and deallocation of dynamic memory. Programs written in languages that have garbage collection, such as managed code, might also need memory debuggers, e.g. for memory leaks due to "living" references in collections.
Overview
Memory debuggers work by monitoring memory access, allocations, and deallocation of memory. Many memory debuggers require applications to be recompiled with special dynamic memory allocation libraries, whose APIs are mostly compatible with conventional dynamic memory allocation libraries, or else use dynamic linking. Electric Fence is such a debugger which debugs memory allocation with malloc. Some memory debuggers (e.g. Valgrind) work by running the executable in a virtual machine-like environment, monitoring memory access, allocation and deallocation so that no recompilation with special memory allocation libraries is required.
As abnormally high memory utilization can be a contributing factor in software aging, memory debuggers can help programmers to avoid software anomalies that would exhaust the computer system memory, thus ensuring high reliability of the software even for long runtimes.
List of memory debugging tools
This is a list of tools useful for memory debugging. A profiler can be used in conjunction with a memory debugger.
Name | OS | License | Languages | Technique |
---|---|---|---|---|
AddressSanitizer | Linux, Mac OS | Free/open source (LLVM) | C, C++. | Compile-time instrumentation (available in Clang and GCC) and specialized library |
Allinea DDT | Linux, Blue Gene | Proprietary commercial | C, C++ and F90. Also for parallel programs on supercomputers | Runtime - through dynamic linking |
Alloclave | Windows | Proprietary commercial | C++ | Compile-time |
AQtime | Windows (Visual Studio, Embarcadero IDEs) | Proprietary commercial | .NET, C++, Java, Silverlight, JScript, VBScript[1] | Runtime |
Bcheck | Solaris | |||
BoundsChecker | Windows (Visual Studio) | Proprietary commercial | C++ | Runtime intercepts or compile-time |
checker (deprecated in favor of valgrind) | Linux, Solaris | Free/open source (GPL) | C | Compile-time override |
Daikon | Unix, Windows, Mac OS X[2] | Free/open source[3] | Java, C/C++, Perl, and Eiffel[2] | Runtime dynamic invariant detection |
Debug_new | (general technique) | (general technique) | C++ | Compile-time override |
Deleaker | Windows (Visual Studio) | Proprietary commercial | C / C++ | Runtime intercepts |
dmalloc | Any | Free/open source | C | Compile-time override |
dlmalloc[4] | Any | Free/open source (public domain) | C | Compile-time override |
Dr Memory | Windows, Linux | Free/open source (LGPL) | C, C++ | Runtime |
Duma (fork of Electric Fence) | Unix, Windows | Free/open source (GPL) | C, C++ | Compile-time override |
Electric Fence | Unix | Free/open source (GPL) | C, C++ | Compile-time override |
graprof | GNU/Linux | Free/open source (GPL) | C, (C++) | Link-time override |
HP Wildebeest (WDB)[5] | Based on gdb | |||
IBM OLIVER (CICS interactive test/debug) | IBM System/360/370/390 | Proprietary commercial | Assembly, COBOL, PL/I | |
IBM Rational Purify | Unix, Windows | Proprietary commercial | C++, Java, .NET | Runtime |
Insure++ | Windows (Visual Studio plugin), Unix | Proprietary commercial | C, C++ | |
Intel Parallel Inspector | Windows (Visual Studio) | Proprietary commercial | C, C++ | |
libcwd | Linux (gcc) | Free/open source | C, C++ | Compile-time override |
libumem | Solaris | Bundled with Solaris | Link-time override | |
MemCheck (Hal Duston)[6] | Unix, Mac OS X | Free/open source (GPL) | C, C++ | Compile-time override |
Memcheck (Société Générale)[7][8] | Windows (Borland Delphi) | Free/open source | C, C++ | Compile-time override |
DDDebug[9] | Windows (Borland Delphi) | Commercial | Delphi (5 to XE7) | Runtime |
MemPro[10] | Windows (Visual Studio) | Free beta | C++ | Compile-time override, uses TCP connection to track memory events |
Memwatch | Any (programming library) | Free/open source | C | Compile-time override |
mpatrol[11] | Unix, Windows | Free/open source (LGPL) | C, C++ | |
mtrace | Various | Free/open source (LGPL) | GNU C library | Built-in, outputs accesses |
MTuner | Various | Proprietary commercial | C, C++ | Runtime intercepts, Link-time override (MSVC, Clang and GCC), Leak detection |
ocp-memprof[12] | Linux 64 | Proprietary/open-source | OCaml | Compile-time |
Oracle Solaris Studio (formerly Sun Studio Runtime Checking) | Linux, Solaris | Proprietary freeware | C, C++, Fortran | |
OpenPAT[13][14] | Any | Free (requires registration) | Any compilable language including C, C++, Java and Fortran | Compile-time instrumentation, runtime intercepts |
softwareverify[15] | Windows | Proprietary commercial | .NET, C, C++, Java, JavaScript, Lua, Python, Ruby, VMs | Runtime |
Splint | Any | Free/open source (GPL) | C | Static program analysis |
TotalView | Unix, Mac OS X | Proprietary commercial | C, C++, Fortran | Runtime |
Valgrind | Linux, Mac OS, Android | Free/open source (GPL) | Any | Runtime intercepts |
Visual Leak Detector[16] | Windows (Visual Studio) | Free/open source (LGPL) | C, C++ | Compile-time overrides, leak detection |
WinDbg | Windows | Proprietary freeware | C, C++, .NET, Python | Runtime |
D Profiler[17] | Windows | Free/open source | C, C++ | Runtime. Support allocation profiling, leak detection. Also support CPU, I/O and lock profiling. |
See also
- Profiling (computer programming)
- List of performance analysis tools
- Debugger
- Software testing
- Software engineering
- Computer programming
- Core dump
References
- Michael C. Daconta: C++ Pointers and Dynamic Memory Management, John Wiley & Sons, ISBN 0-471-04998-0
- Andrew Koenig: C Traps and Pitfalls, Addison-Wesley, ISBN 0-201-17928-8
- ^ http://smartbear.com/products/qa-tools/application-performance-profiling/profiling-managed-code
- ^ a b http://groups.csail.mit.edu/pag/daikon/download/doc/daikon.html
- ^ http://groups.csail.mit.edu/pag/daikon/download/doc/daikon.html#License
- ^ ftp://g.oswego.edu/pub/misc/malloc.c
- ^ http://h71028.www7.hp.com/enterprise/w1/en/os/hpux11i-developers-ecosystem.html
- ^ http://hald.dnsalias.net/projects/memcheck/
- ^ http://v.mahon.free.fr/pro/freeware/memcheck/
- ^ Denis Golovan Fork: https://code.launchpad.net/~denisgolovan/memcheck/main
- ^ http://ddobjects.de/
- ^ http://www.puredevsoftware.com/MemPro.htm
- ^ http://mpatrol.sourceforge.net/
- ^ http://memprof.typerex.org/
- ^ "OpenPAT: The Open Performance Analysis Toolkit"
- ^ "OpenPAT: Analysing Programs the Easy Way" by Dr Simon Spacey
- ^ http://www.softwareverify.com/memory-leak-detection.php
- ^ http://vld.codeplex.com/
- ^ https://github.com/xwlan/dprofiler
External links
- "Hunting Memory Bugs" by Ivan Skytte Jørgensen
- "Comparison of Free Memory Checkers" by Jean-Philippe Martin [full citation needed]