Dr. Memory Documentation
repository·master·Indexed 25 days ago
https://github.com/dynamorio/drmemoryA high-performance memory monitoring and debugging tool built on the DynamoRIO dynamic instrumentation platform. It detects memory errors such as leaks, uninitialized memory access, buffer overflows, and double frees across Windows, Linux, Mac, and Android. The project also includes specialized Windows tools like drstrace for system call tracing and drltrace for library call tracing.
What's inside Dr. Memory
- drltrace is a standalone tool for Windows built on the Dr. Memory framework. It functions as a system call tracer that records calls to shared libraries. Specifically, it reports all invocations of exported functions across all shared libraries loaded into a target process.
Overview of Dr. Memory capabilities
masterDr. Memory is a memory monitoring tool used to identify various memory-related programming errors in unmodified application binaries. It supports Windows, Linux, Mac, and Android on IA-32, AMD64, and ARM hardware.
Key errors detected include:
- Accesses of uninitialized memory
- Accesses to unaddressable memory (including heap underflow/overflow and accesses outside allocated heap units)
- Accesses to freed memory
- Double frees
- Memory leaks
- Windows specific: Handle leaks, GDI API usage errors, and accesses to un-reserved thread local storage slots.
Download Dr. Memory binary packages
masterDr. Memory is released under an LGPL license. You can download the binary packages from the official download page.
https://drmemory.org/page_download.htmlOverview of Dr. Memory
masterDr. Memory is a memory monitoring tool used to identify memory-related programming errors. It is built on the DynamoRIO binary translation engine and supports Windows (XP and higher) and Linux. Beta support is available for Mac OSX, Linux/ARM, and Android/ARM (32-bit only).
Key error detection capabilities include:
- Accesses to uninitialized memory
- Accesses to unaddressable memory (including heap underflow, overflow, and accesses outside allocated heap units)
- Accesses to freed memory
- Double frees
- Memory leaks
- Windows-specific: handle leaks, GDI API usage errors, and accesses to un-reserved thread local storage slots.
Dr. Memory also includes a system call tracing tool for Windows and a symbol query utility.
Quick start for Linux
masterTo use Dr. Memory on Linux, first build your application with debug information using specific flags to ensure accurate error reporting, then run it through the
bin/drmemoryexecutable.Recommended build flags:
-g: Include debug information.-fno-inline: Disable inlining.-fno-omit-frame-pointer: Preserve frame pointers for better stack traces.-m32: (Optional) Target 32-bit if using the 32-bit beta version.
Quick start for Windows
masterTo use Dr. Memory on Windows, build your application with debug information and run it using the
drmemorycommand. If you used the installer,drmemoryshould be available in your PATH.Recommended build flags for
cl:/Zi: Generate complete debugging information./MT: Use the multithreaded static runtime./EHsc: Enable standard C++ exception handling./Oy-: Disable frame pointer omission./Ob0: Disable all optimizations (inlining).
Quick start for Mac
masterTo use Dr. Memory on Mac (Beta), build your application with debug information and run it through the
bin/drmemoryexecutable. Note that Mac support is currently in Beta and limited to 32-bit.Recommended build flags:
-g: Include debug information.-fno-inline: Disable inlining.-fno-omit-frame-pointer: Preserve frame pointers.-m32: Required for current Mac Beta support.
Use drstrace for system call tracing on Windows
masterThe Dr. Memory package includesdrstrace, a tool designed to act as an "strace for Windows" to trace system calls.Identify Dr. Memory Windows binary types and descriptions
masterThe Dr. Memory project includes several Windows binaries (executables and DLLs). When inspecting these files, you can identify their purpose via their
FileDescriptionandInternalNamemetadata. Key components include:- Front end:
drmemory.exe - Main library: A client DLL (name depends on
CLIENT_LIBNAME) - System call tracer:
drstrace.exe(executable) ordrstracelib.dll(library) - Library call tracing tool:
drltrace.exe(executable) ordrltracelib.dll(library) - Symbol utilities:
symquery.exe(query),winsyms.exe(translation), andverinfo.exe(version query) - Specialized tools:
drheapstat(heap statistics),drsyscall.dll(system call monitor),drfuzz.dll(fuzz testing), andumbra.dll(shadow memory translator).
- Front end: