A memory debugger is a
debugger
A debugger is a computer program used to test and debug other programs (the "target" programs). Common features of debuggers include the ability to run or halt the target program using breakpoints, step through code line by line, and display ...
for finding software memory problems such as
memory leak
In computer science, a memory leak is a type of resource leak that occurs when a computer program incorrectly manages memory allocations in a way that memory which is no longer needed is not released. A memory leak may also happen when an objec ...
s 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
Managed code is computer program code that requires and will execute only under the management of a Common Language Infrastructure (CLI); Virtual Execution System (VES); virtual machine, e.g. .NET, CoreFX, or .NET Framework; Common Language R ...
, 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
An electric fence is a barrier that uses electric shocks to deter humans and other animals from crossing a boundary. Most electric fences are used for agricultural purposes and other non-human animal control. They may also be used to protect hig ...
is such a debugger which debugs memory allocation with
malloc
C dynamic memory allocation refers to performing manual memory management for dynamic memory allocation in the C programming language via a group of functions in the C standard library, namely , , , and .
The C++ programming language includ ...
. 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.
Finding memory issues such as leaks can be extremely time-consuming as they may not manifest themselves except under certain conditions. Using a tool to detect memory misuse makes the process much faster and easier.
As abnormally high memory utilization can be a contributing factor in
software aging
In software engineering, software aging is the tendency for software to Software failure, fail or cause a system failure after running continuously for a certain time, or because of ongoing changes in systems surrounding the software. Software a ...
, 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.
Comparison to static analyzer
Some
static analysis tools can also help find memory errors. Memory debuggers operate as part of an application while its
running
Running is a method of terrestrial locomotion by which humans and other animals move quickly on foot. Running is a gait with an aerial phase in which all feet are above the ground (though there are exceptions). This is in contrast to walkin ...
while
static code analysis
In computer science, static program analysis (also known as static analysis or static simulation) is the analysis of computer programs performed without executing them, in contrast with dynamic program analysis, which is performed on programs duri ...
is performed by analyzing the code without executing it. These different techniques will typically find different instances of problems, and using them both together yields the best result.
List of memory debugging tools
This is a list of
tools
A tool is an object that can extend an individual's ability to modify features of the surrounding environment or help them accomplish a particular task. Although many animals use simple tools, only human beings, whose use of stone tools dates ...
useful for memory debugging. A
profiler can be used in conjunction with a memory debugger.
See also
*
Profiling (computer programming)
In software engineering, profiling (program profiling, software profiling) is a form of dynamic program analysis that measures, for example, the space (memory) or time complexity of a program, the usage of particular instructions, or the freque ...
*
List of performance analysis tools
*
Debugger
A debugger is a computer program used to test and debug other programs (the "target" programs). Common features of debuggers include the ability to run or halt the target program using breakpoints, step through code line by line, and display ...
*
Runtime error detection
*
Software testing
Software testing is the act of checking whether software satisfies expectations.
Software testing can provide objective, independent information about the Quality (business), quality of software and the risk of its failure to a User (computin ...
*
Software engineering
Software engineering is a branch of both computer science and engineering focused on designing, developing, testing, and maintaining Application software, software applications. It involves applying engineering design process, engineering principl ...
*
Computer programming
Computer programming or coding is the composition of sequences of instructions, called computer program, programs, that computers can follow to perform tasks. It involves designing and implementing algorithms, step-by-step specifications of proc ...
*
Core dump
In computing, a core dump, memory dump, crash dump, storage dump, system dump, or ABEND dump consists of the recorded state of the working Computer storage, memory of a computer program at a specific time, generally when the program has crash (com ...
References
*Michael C. Daconta:
C++ Pointers and Dynamic Memory Management, John Wiley & Sons,
*
Andrew Koenig:
C Traps and Pitfalls, Addison-Wesley,
External links
Hunting Memory Bugs by Ivan Skytte Jørgensen
by Jean-Philippe Martin
{{Memory management navbox
Memory management software
Debugging