{"id":19125887,"url":"https://github.com/ryncsn/memstrack","last_synced_at":"2026-03-10T17:08:21.148Z","repository":{"id":47373380,"uuid":"157558519","full_name":"ryncsn/memstrack","owner":"ryncsn","description":"A memory allocation tracer combined with stack trace.","archived":false,"fork":false,"pushed_at":"2023-06-08T02:45:06.000Z","size":383,"stargazers_count":168,"open_issues_count":2,"forks_count":19,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-10-19T08:27:26.048Z","etag":null,"topics":["debug","ftrace","kernel","memory-allocation","perf","stacktrace","tracing"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryncsn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-14T14:11:11.000Z","updated_at":"2025-09-07T18:20:26.000Z","dependencies_parsed_at":"2024-11-09T05:38:12.191Z","dependency_job_id":"ce0d291d-c07a-4cd3-a12c-8d244e2ea311","html_url":"https://github.com/ryncsn/memstrack","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/ryncsn/memstrack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryncsn%2Fmemstrack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryncsn%2Fmemstrack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryncsn%2Fmemstrack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryncsn%2Fmemstrack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryncsn","download_url":"https://codeload.github.com/ryncsn/memstrack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryncsn%2Fmemstrack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30343963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debug","ftrace","kernel","memory-allocation","perf","stacktrace","tracing"],"created_at":"2024-11-09T05:38:04.587Z","updated_at":"2026-03-10T17:08:21.074Z","avatar_url":"https://github.com/ryncsn.png","language":"C","readme":"# Memstrack\n\n[![Build Status](https://travis-ci.org/ryncsn/memstrack.svg?branch=master)](https://travis-ci.org/ryncsn/memstrack) [![codecov](https://codecov.io/gh/ryncsn/memstrack/branch/master/graph/badge.svg)](https://codecov.io/gh/ryncsn/memstrack)\n\nA runtime memory allocation tracer, like a hot spot analyzer for memory allocation, can help analyze overall memory usage, peak memory usage, kernel module memory usage, all combined with stacktrace. Userspace memory trace is planned and not yet implemented.\n\nThis tool works by tracing all page-level memory allocation events in kernel (currently supports using perf or ftrace), and actively integrate the events into a stack trace tree. It can also work with kernel's page owner log file and use as a memory usage viewer.\n\n# Usage\nTo analyze the memory usage of a certain program/module/code, you have to start memstrack before start/load the program, since memstrack can only track the allocation events at runtime.\n\n## TUI\nBy default, memstrack will show a TUI, showing all memory allocation happened since memstrack is started:\n![alt text](https://ryncsn.github.io/latest-memstrack-screenshot.png \"Screenshot of TUI showing tasks\")\n![alt text](https://ryncsn.github.io/latest-memstrack-screenshot-2.png \"Screenshot of TUI showing modules\")\n\n## Usage Report\nmemstrack can generate a report of memory allocation info during a long period.\n\nAn example report, which shows the memory usage summary of a typical kdump run on Fedora 32 in a KVM VM:\n```sh\n# Following report is genereted with\n# `memstrack --report module_summary,module_top --notui --throttle 80`\n# memstrack will generate the report and exit upon SIGTERM/SIGINT\n\n======== Report format module_summary: ========\nModule squashfs using 26.8MB (6868 pages), peak allocation 35.1MB (8976 pages)\nModule virtio_console using 1.5MB (377 pages), peak allocation 1.5MB (377 pages)\nModule overlay using 1.5MB (372 pages), peak allocation 2.2MB (568 pages)\nModule virtio_blk using 0.9MB (241 pages), peak allocation 0.9MB (241 pages)\nModule virtio_net using 0.5MB (129 pages), peak allocation 0.5MB (129 pages)\nModule sunrpc using 0.1MB (15 pages), peak allocation 0.1MB (15 pages)\nModule qemu_fw_cfg using 0.0MB (4 pages), peak allocation 0.0MB (4 pages)\n======== Report format module_summary END ========\n======== Report format module_top: ========\nTop stack usage of module squashfs:\n  (null) Pages: 6868 (peak: 8976)\n    async_page_fault (0xffffffff81c0137e) Pages: 4643 (peak: 6264)\n      do_page_fault (0xffffffff81075861) Pages: 4643 (peak: 6264)\n        do_user_addr_fault (0xffffffff81075109) Pages: 4643 (peak: 6264)\n          handle_mm_fault (0xffffffff81298074) Pages: 4643 (peak: 6264)\n            __handle_mm_fault (0xffffffff81297ac8) Pages: 3770 (peak: 5391)\n              __do_fault (0xffffffff8128f3b6) Pages: 3770 (peak: 5391)\n                filemap_fault (0xffffffff81255dce) Pages: 3674 (peak: 5234)\n                  __do_page_cache_readahead (0xffffffff812611fa) Pages: 3151 (peak: 4522)\n                    read_pages (0xffffffff81260fb2) Pages: 3151 (peak: 4522)\n                      squashfs_readpage squashfs (0xffffffffc0025064) Pages: 2973 (peak: 4342)\n                        squashfs_readpage_block squashfs (0xffffffffc0027289) Pages: 2132 (peak: 3185)\n                          squashfs_copy_cache squashfs (0xffffffffc0024a99) Pages: 2132 (peak: 3185)\n                            pagecache_get_page (0xffffffff81254b33) Pages: 2132 (peak: 3185)\n                              __alloc_pages_nodemask (0xffffffff812b6443) Pages: 2132 (peak: 3185)\n                                __alloc_pages_nodemask (0xffffffff812b6443) Pages: 4264 (peak: 6370)\nTop stack usage of module virtio_console:\n  (null) Pages: 266 (peak: 266)\n    ret_from_fork (0xffffffff81c00215) Pages: 266 (peak: 266)\n      kthread (0xffffffff81106c59) Pages: 266 (peak: 266)\n        worker_thread (0xffffffff811008f0) Pages: 266 (peak: 266)\n          process_one_work (0xffffffff811006f5) Pages: 266 (peak: 266)\n            control_work_handler virtio_console (0xffffffffc0159496) Pages: 265 (peak: 265)\n              add_port virtio_console (0xffffffffc0159198) Pages: 254 (peak: 254)\n                fill_queue virtio_console (0xffffffffc0158faa) Pages: 254 (peak: 254)\n                ... snip ...\n```\n\n# Quick start\n\n## Installation\n\n### Fedora/CentOS\nIn Latest Fedora/CentOS, this package is available by default, install it with dnf.\n```sh\ndnf install memstrack\n```\n\n### Arch Linux\nIn Arch Linux, [memstrack](https://aur.archlinux.org/packages/memstrack/) and [memstrack-git](https://aur.archlinux.org/packages/memstrack-git/) packages are both available in the [AUR](https://aur.archlinux.org/)\n\nTo install, you can either use an [AUR helper](https://wiki.archlinux.org/index.php/AUR_helpers) or follow the manual procedure as follows:\n\nClone the package:\n```\n$ git clone https://aur.archlinux.org/packages/memstrack/\n```\nFinally build and install the application:\n```\n$ cd memstrack\n$ makepkg -si\n```\nDone! (Thanks to barmadrid for packaging on Arch Linux)\n\n### Install from source\nOr, you can also install from source, just clone the repo and build it.\n```sh\n# First Make sure you have gcc git make ncurses-devel installed\n# Then clone it\ngit clone https://github.com/ryncsn/memstrack.git\n\n# Build it\ncd memstrack\nmake\nmake install\n```\n\n## Basic usage:\n```\n# Run it, a TUI will show up:\n./memstrack\n\n# Print help info:\n./memstrack --help\n\n# Another Example, run memtrack without TUI and generate report to file \"report.result\"\n./memstrack --notui --report task_top --output report.result\n```\n\n## Using memstrack with dracut:\nIn latest Dracut, it supports using memstrack to analyze the memory usage in during initramfs stage. This is especially useful for kdump to debug memory usage issue.\nTo enable memstrack integration in dracut, first ensure memstrack is installed. If it's not installed, please install and rebuild the initramfs. Then simply append rd.memdebug=4 or rd.memdebug=5 to the kernel cmdline is enough.\n\nWith rd.memdebug=4, memstrack will generate a memory usage report of all loaded kernel modules, this can help you find out which kernel module used the most memory, and also their peak memory usage.\n\nWith rd.memdebug=5, memstrack will generate a memory usage report of all loaded kernel modules, along with the top stacks that allocated these memories. This can help you find out which kernel module, and exactly which stack used the most memory, and also including the peak memory usage of each stack.\n\n## Use with older version of Dracut\nFor older version of Dracut, memstrack could also be installed as a standalone plugin from source code repository.\n```sh\n# Assume you have cloned the source code and now in the source code top directory\nmake dracut-module-install\n```\n\nTo use it, append \"rd.memstrack=\u003clevel\u003e\" to kernel cmdline. The command line format is a bit different here, to avoid conflict with Dracut's builtin rd.memdebug in older version.\nThe available levels are:\n\nrd.memstrack=1: only simple summary will be printed to console during boot.\nrd.memstrack=2: summary will be printed to console, and also prints the top stacks which consumes most memories.\nrd.memstrack=3: memstrack will print everything, use with caution as this will likely to flood your console.\n\n# Note\nFor for Linux kernel using ORC unwinder and have version below 5.2, there is a bug that tracepoints unable to generate stack trace properly using perf, so you might get empty stack trace data when using perf backend. To avoid such problem, please update your kernel to latest version, or use ftrace backend as a workaround (with heavy performance downgrade).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryncsn%2Fmemstrack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryncsn%2Fmemstrack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryncsn%2Fmemstrack/lists"}