Skip to content

A debugging tool to analysis Python process memory ✨

License

Notifications You must be signed in to change notification settings

Hanaasagi/pymem

Repository files navigation

pymem

python Travis-CI Status Coverage Status black License

pymem is a tool to analysis your Python process.

Install

$ pip install git+https://github.com/Hanaasagi/pymem.git

Usage

You may need to run it with sudo.

$ sudo pymem --help
Usage: pymem [OPTIONS] PID

Options:
  -d, --debugger [gdb|lldb]
  -v, --verbose
  --help                     Show this message and exit.

$ sudo pymem [pid]
{
    "objects": [
        {
            "type": "<class 'list'>",
            "count": 5797,
            "total_size": "6.24 MiB"
        },
        {
            "type": "<class 'str'>",
            "count": 26988,
            "total_size": "3.21 MiB"
        }
    ],
    "garbages": {
        "count": 0,
        "objects": []
    },
    "malloc_stats": {
        "arenas_allocated_total": 1725,
        "arenas_reclaimed": 1661,
        "arenas_highwater_mark": 73,
        "arenas_allocated_current": 64,
        "bytes_in_allocated_blocks": 15942032,
        "bytes_in_available_blocks": 127776,
        "bytes_lost_to_pool_headers": 192528,
        "bytes_lost_to_quantization": 166720,
        "bytes_lost_to_arena_alignment": 0
    },
    "summary": {
        "private": "39.28 MiB",
        "shared": "41.82 MiB",
        "total": "81.10 MiB",
        "swap": "0.00 MiB"
    }
}

It will show

  • Top 15 objects(order by size)
  • GC garbage info
  • Process memory summay

About

A debugging tool to analysis Python process memory ✨

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages