In this Linux Journal published at ELJonline, Cal Erickson spotlights memory leak detection and discusses three easy-to-use tools that find most application program errors — mtrace, dmalloc, and memwatch. Erickson writes . . .
” . . . One of the problems with developing embedded systems is the detection of memory leaks; I've found three tools that are useful for this. These tools are used to detect application program errors, not kernel memory leaksThese tools work by replacing malloc, free and other memory management calls. Each tool has code that intercepts calls to malloc (and other functions) and sets up tracking information for each memory request. Some tools implement memory protection fences to catch errant memory accesses . . . “
“Some of the leak detection programs are very large and require a virtual memory image of the program being searched. This requirement makes it very difficult to use on embedded systems. However, mtrace, memwatch and dmalloc are simple programs that find most errors . . . “
“All of these tools have been used in several different target architectures. The example code will work whether compiled natively or cross-compiled . . .”
This article was originally published on LinuxDevices and has been donated to the open source community by QuinStreet Inc. Please visit LinuxToday.com for up-to-date news and articles about Linux and open source.