https://github.com/yodaos-project/malldump
Attach to a process and dump statistics of low level malloc(ptmalloc, the glibc implementation) of the process.
https://github.com/yodaos-project/malldump
heapdump malloc mallocdump ptmalloc
Last synced: 8 months ago
JSON representation
Attach to a process and dump statistics of low level malloc(ptmalloc, the glibc implementation) of the process.
- Host: GitHub
- URL: https://github.com/yodaos-project/malldump
- Owner: yodaos-project
- License: apache-2.0
- Created: 2019-04-18T12:35:39.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-13T08:46:42.000Z (almost 7 years ago)
- Last Synced: 2025-04-16T17:02:27.305Z (about 1 year ago)
- Topics: heapdump, malloc, mallocdump, ptmalloc
- Language: C
- Homepage:
- Size: 57.6 KB
- Stars: 29
- Watchers: 8
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Malldump
[](https://travis-ci.com/yodaos-project/malldump)
Attach to a process and dump statistics of low level malloc(ptmalloc, the glibc implementation) of the process.
## Supported malloc implementations
- ptmalloc, also known as ptmalloc2
## Supported platforms
- Linux
## Supported architectures
- x86_64
- aarch64
- arm
## Build
```
mkdir build && cd build
cmake .. && make
```
## Usage
```
usage:
-h print this usage
-D debug mode [defaut: false]
-t type of malloc [default: ptmalloc]
-p pid of the target process
-I offset of mallinfo [default: ...]
-P offset of mp_ [default: ...]
-A offset of narenas [default: ...]
-H display size of memory in human mode [default: false]
```
```
malldump -H -p
```
## Outputs
```
Process cmd: nmap -sP 172.17.0.0/16
Process pid: 49457
Threads: 1
Arenas: 1
Total memory: 10248.0K
Avail memory: 403.1K
Used memory: 9844.9K
Used memory%: 96.07%
Free chunks: 2
Fastbin chunks: 3
Fastbin memory: 0.2K
Mmapped chunks: 1
Mmapped memory: 516.0K
Trim threshold: 128.0K
Mmap threshold: 128.0K
Arena max: 16
```
- Arenas: Number of created arenas.
- Total memory: Total memory that allocated from OS through brk() or mmap().
- Avail memory: Memory that kept by low level malloc but not used by application.
- Used memory: Memory that used by application through malloc().
- Used memory%: used memory / total memory.
- Free chunks: Chunks that linked in the double-linked list of bins except fastbins.
- Fastbin chunks: Chunks that linked in the single-linked list of fastbins.
- Mmapped chunks: Chunks that allocated from OS directly by mmap().
- Mmapped memory: Total memory of mmapped chunks.
- Trim threshold: The maximum amount of unused top-most memory to keep before releasing via malloc_trim in free().
- Mmap_threshold: The request size threshold for using mmap() to service a request. Requests of at least this size that cannot be allocated using already-existing space will be serviced via mmap.
- Arena max: The maximum number of arenas. If not set manually, the default formula is nr_cpu * (sizeof(long) == 4 ? 2 : 8).