Analyzer mmap-leaks
Name
mmap-leaks - Mmap Leak Backtrace Sampling Tools for Leak Flame Graphs
This analyzer detects and profiles memory leaks related to mmap allocations by sampling backtrace information. It monitors mmap and munmap system calls, tracking allocations that are not properly released. The analyzer generates flame graphs visualizing the call stacks responsible for leaked memory regions, making it easy to identify the source of memory leaks. This is particularly effective for diagnosing memory leaks in applications that heavily use mmap for large memory allocations or memory-mapped files.
Resource Category
Memory.
Application Type & Technical Stack
- All
Command Line Syntax
The analyzer can be invoked directly on the command-line via the orxray
utility from the openresty-xray-cli software package.
Alternatively, the analyzer can also be invoked manually or automatically on the web console UI of OpenResty XRay (like on the Advanced web page).
# PID is the target process PID.
orxray analyzer run mmap-leaks -p PID
# trace a shell command directly
orxray analyzer run mmap-leaks -c SHELL_CMD
# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run mmap-leaks -p -PGID
# trace any processes started from the specified executable path.
orxray analyzer run mmap-leaks --exe /path/to/exe/file
Tracing Multiple Processes
Supported.
Output Formats
- Flame Graphs
Output Example
[
{
"data": [
[ "Entry", "Size" ],
[ "The total amount of memory allocated by means other than mmap.<br>This figure includes both in-use blocks and blocks on the free list.", "43945984" ],
[ "The number of ordinary (i.e., non-fastbin) free blocks.", "2092" ],
[ "The number of fastbin free blocks.", "0" ],
[ "The number of blocks currently allocated using mmap.", "10" ],
[ "The number of bytes in blocks currently allocated using mmap.", "45428736" ],
[ "The \"highwater mark9\" for allocated space that is the maximum amount of space that was ever allocated. <br> This field is maintained only in nonthreading environments.", "0" ],
[ "The total number of bytes in fastbin free blocks.", "0" ],
[ "The total number of bytes used by in-use allocations.", "28013744" ],
[ "The total number of bytes in free blocks.", "15932240" ],
[ "The total amount of releasable free space at the top of the heap.<br>This is the maximum number of bytes that could ideally be released by malloc_trim.", "5627328" ]
],
"title": "mallinfo for pid 197576, use 'man mallinfo' for more details",
"type": "table",
"ver": 1
}
]
Author
The OpenResty Inc. Team.
Copyright
Copyright (C) by OpenResty Inc. All rights reserved.