tips
12 tips Memory
One command, setting or habit at a time about Memory: what it does, the line to copy and a caveat or two.
Kernel and system 5
-
List the programs that are actually sitting in swap, biggest first.
for f in /proc/[0-9]*/status; do -
Get per process and per user memory numbers that add up sensibly.
sudo apt install smem -
See whether a big process is heap, libraries or mapped files.
sudo pmap -x 1234 -
Slow a greedy service down and reclaim its memory at a soft limit.
sudo systemctl edit indexer.service -
List the biggest kernel slab caches once, sorted by size, when memory goes missing.
sudo slabtop -o -s c
Mac terminal 5
-
Test your own command line program for leaked allocations.
leaks -atExit -- ./myprogram --some-option -
Breaks down the memory footprint of a process into categories, with optional sampling.
footprint Safari -
Applies real or simulated low-memory states to a Mac, for a set number of seconds.
memory_pressure -S -l warn -s 20 -
Shows the processes with the biggest memory footprint first, in a fixed-size list.
top -o mem -n 10 -
Prints macOS memory statistics in pages, with the page size in the header.
vm_stat
Identify and inspect 1
-
Prints the online and offline memory the kernel manages and the size of one memory block.
lsmem --summary
System 1
-
The Unraid setting that caps how much memory ZFS keeps as cache.
awk '/^size|^c_max/ {printf "%s %.1f GiB\n", $1, $3/1073741824}' /proc/spl/kstat/zfs/arcstats
Nothing in this filter yet.