PEAK-MEM(1)
π peak-mem β the manual, but make it make sense π
okay so bestie, this is peak-mem(1), a User Commands girly. She watches your processes eat memory and tells you the biggest bite they ever took. no cap, she's iconic. π«Ά
β¨ NAME β¨
peak-mem β monitor peak memory usage of processes π
πΈ SYNOPSIS πΈ
peak-mem [OPTIONS] -- COMMAND [ARGS...]
like literally that's it. dash dash, then your command, then whatever args. periodt.
π¦ DESCRIPTION π¦
peak-mem is a lightweight memory usage monitor that tracks and reports the peak memory usage of a process and its children while they're running. she gives you both real-time monitoring and post-execution reporting, and she does it with minimal overhead. lowkey a queen. π
The tool monitors both RSS (Resident Set Size) and VSZ (Virtual Size) memory metrics, tracking the maximum values reached during the lifetime of the monitored process.
so basically: she watches, she remembers the worst moment, she tells you. β¨
π OPTIONS π
π Output Format Options π
-j,--jsonβ output the results in JSON format. perfect if you wanna feed it to other tools, iykyk.-c,--csvβ output the results in CSV format. the output includes headers and is suitable for importing into spreadsheets or data analysis tools. spreadsheet girlies rise π-q,--quietβ quiet mode. only outputs the peak RSS value in bytes, with no formatting. useful for scripting. no frills, no commentary, just the number. π§-v,--verboseβ show a detailed breakdown including the process tree. displays memory usage for each process in the hierarchy. it's giving main character energy for your whole process family tree π
π Monitoring Options π
-w,--watchβ display real-time memory usage during execution. the display updates continuously as the process runs. live footage, bestie πΊ-t,--threshold SIZEβ set a memory threshold alert. accepts values like512M,1G,2GiB. the program will indicate if the threshold is exceeded. check MEMORY UNITS for how unit suffixes are interpreted.--no-childrenβ don't track child processes. by default,peak-memmonitors the entire process tree. this one is for when you only care about the parent. π€--timeline FILEβ record a detailed memory timeline to the specified file. the timeline includes timestamps and memory values for later analysis. receipts, but for memory π--interval MSβ set the sampling interval in milliseconds (default:100). lower values provide more accurate peak detection but increase overhead. so likeβ¦ more accurate = more work. choose your fighter π--units UNITβ force specific memory units in human-readable output instead of automatic sizing. supported units:B(bytes),KB(kilobytes),MB(megabytes),GB(gigabytes),KiB(kibibytes),MiB(mebibytes),GiB(gibibytes). this option affects all human-readable output including verbose mode and baseline comparisons. see MEMORY UNITS for how unit suffixes are interpreted.
π Baseline Management Options π
--save-baseline NAMEβ save the current run's memory usage as a baseline with the given name. baselines are stored for future comparison to detect memory regressions. β¨ snapshot the vibe β¨--compare-baseline NAMEβ compare the current run against a previously saved baseline. reports memory usage changes and indicates if a regression is detected. glow-up or glow-down, she'll tell you π¦--regression-threshold PERCENTβ set the percentage increase in RSS that constitutes a regression (default:10.0). only used with--compare-baseline. pick your tolerance, bestie.--baseline-dir DIRβ directory to store baseline files (default:~/.cache/peak-mem/baselines).--list-baselinesβ list all saved baselines and exit. show me the archive π--delete-baseline NAMEβ delete a saved baseline and exit. it's not you, it's the memory footprint π₯
π Standard Options π
-h,--helpβ display help message and exit.-V,--versionβ display version information and exit.
β EXAMPLES β
πΈ Basic Usage πΈ
monitor memory usage of a cargo build:
peak-mem -- cargo build
πΈ JSON Output πΈ
get machine-readable output:
peak-mem --json -- ./myapp
πΈ Memory Threshold πΈ
alert if memory usage exceeds 1GB:
peak-mem --threshold 1G -- ./memory-intensive-app
πΈ Real-time Monitoring πΈ
watch memory usage as it happens:
peak-mem --watch -- ./long-running-process
πΈ Timeline Recording πΈ
record a detailed timeline for analysis:
peak-mem --timeline memory.json -- ./app
πΈ Process-only Monitoring πΈ
monitor only the main process, ignoring children:
peak-mem --no-children -- ./parent-process
πΈ Fixed Memory Units πΈ
display memory usage in megabytes:
peak-mem --units MB -- ./myapp
πΈ Combined Options πΈ
verbose output with threshold and timeline:
peak-mem -v --threshold 2G --timeline mem.json -- make -j8
πΈ Memory Regression Detection πΈ
save a baseline for your application:
peak-mem --save-baseline v1.0 -- ./myapp
compare against the baseline after changes:
peak-mem --compare-baseline v1.0 -- ./myapp
use a stricter regression threshold (5%):
peak-mem --compare-baseline v1.0 --regression-threshold 5 -- ./myapp
list and manage baselines:
peak-mem --list-baselines
peak-mem --delete-baseline v1.0
π OUTPUT FORMATS π
π©· Human-readable (default) π©·
shows peak RSS and VSZ in human-readable units (KiB, MiB, GiB) along with the monitored command and exit status. cute, cozy, readable πΌ
π©· JSON Format (-j) π©·
outputs a JSON object containing:
command: the executed command with argumentspeak_rss_bytes: peak RSS in bytespeak_vsz_bytes: peak VSZ in bytesduration_ms: execution time in millisecondsexit_code: process exit codethreshold_exceeded: boolean (if threshold was set)tracked_children: boolean indicating if children were tracked
π©· CSV Format (-c) π©·
outputs CSV with headers:
command,peak_rss_bytes,peak_vsz_bytes,duration_ms,exit_code
π©· Quiet Format (-q) π©·
outputs only the peak RSS value in bytes as a plain number.
π©· Verbose Format (-v) π©·
shows a detailed process tree with individual memory usage for each process, including PIDs and process names. the whole fam, accounted for π³
π«Ά MEMORY UNITS π«Ά
okay this part is important so pay attention bestie!! unit suffixes without an "i" are decimal (SI, powers of 1000); suffixes with an "i" are binary (IEC, powers of 1024). this convention applies consistently to both input (--threshold) and output (--units and automatic sizing, which uses binary units). π₯
- no suffix,
B: bytes K,KB: kilobytes (1000 bytes);M,MB: megabytes (1000Β² bytes);G,GB: gigabytes (1000Β³ bytes);T,TB: terabytes (1000 bytes)KiB: kibibytes (1024 bytes);MiB: mebibytes (1024Β² bytes);GiB: gibibytes (1024Β³ bytes);TiB: tebibytes (1024 bytes)
π EXIT STATUS π
peak-mem normally exits with the same status code as the monitored command. if the monitored command is terminated by a signal, peak-mem exits with status 128 + signal number. she's just the messenger, fr fr.
special exit codes:
1β memory threshold exceeded (when using--threshold)1β memory regression detected (when using--compare-baseline)
yes bestie, they're both 1. read the context. π
π PLATFORM SUPPORT π
- Linux β full support via
/procfilesystem π§ - macOS β full support via
proc_pidinfoπ - FreeBSD β full support via
sysinfoπ - Windows β not supported π
π LIMITATIONS π
- memory sampling occurs at intervals (default
100ms), so very brief spikes might be missed. decrease the interval for more accurate peak detection. - on some systems, tracking child processes requires appropriate permissions.
- timeline files can grow large for long-running processes with small intervals.
π¦ ENVIRONMENT π¦
peak-mem forwards all environment variables to the monitored process without modification. she does not touch your stuff. respectful. π
πΈ SIGNALS πΈ
peak-mem forwards most signals to the monitored process, allowing for proper cleanup and termination handling. so your process still gets its goodbye moment. π₯Ή
π FILES π
/proc/[pid]/statusβ on Linux, used to read memory information./proc/[pid]/task/β on Linux, used to track all threads of a process.
β SEE ALSO β
time(1), ps(1), top(1), htop(1), pmap(1)
π BUGS π
report bugs at: ~charmitro/peak-mem-devel@lists.sr.ht
(not me writing bugsβ¦ couldn't be meβ¦ but if it is, tell them π)
π AUTHOR π
written by Charalampos Mitrodimas and Panagiotis Foliadis. kings. π
π COPYRIGHT π
copyright Β© 2025 peak-mem contributors. license: MIT.
and that's the whole thing, bestie!! β¨π this was peak-mem version 0.1.4, dated July 2026, from section 1 of the manual. go monitor something and slay responsibly. ππ¦π
π¦ where this page comes from
- ubuntu stonking: peak-mem 0.1.4-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms