A terminal UI for monitoring memory and zram compression statistics.
Zram creates a compressed block device in RAM. When the kernel swaps pages to zram:
- Pages are compressed (typically 2-4x ratio)
- Compressed data is stored in RAM, not on disk
- Access is ~10x faster than SSD swap
With disk-based swap, low vm.swappiness (10-30) avoids slow I/O. With zram, higher values make sense because swapping to compressed RAM is cheap:
vm.swappiness = 180 # common with zram (Linux 5.8+ allows >100)
This causes more data to end up in zram, which is fine - that's what it's for.
$ free -h
total used free shared buff/cache available
Mem: 31Gi 20Gi 1.2Gi 1.1Gi 9.8Gi 11Gi
Swap: 31Gi 26Gi 4.9Gi
The "Swap used: 26G" is the uncompressed size of data in zram. The actual RAM used by zram to store this is ~8GB (at 3.4x compression). Standard tools don't show the compression ratio or physical RAM used.
This tool shows zram-specific metrics: compression ratio, physical RAM used by zram, and bytes saved.
Memory [████████████████████████████████░░░░░░░░░░░░░░░░ 19.9/30.9G]
Zram [████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 8.0G compressed from 26.0G (3.4x)]
Saved: 18.02G saved by compression
Anon: 9.70G
Cache: 8.79G Buffers: 0.00G
Available: 11.1G
Total [██████████████████████████████████████████████████ 37.9G data, 30.9G RAM]
| Metric | Source | Description |
|---|---|---|
| Memory | MemTotal - MemAvailable |
Physical RAM in use |
| Zram | mm_stat column 3 |
Physical RAM used by zram |
| Compressed from | mm_stat column 1 |
Uncompressed size of data in zram |
| Compression ratio | col1 / col2 | Compression efficiency |
| Saved | col1 - col3 | RAM saved by compression |
| Anon | AnonPages |
Anonymous pages |
| Cache/Buffers | Cached, Buffers |
Page cache and buffer cache |
| Available | MemAvailable |
Memory available for new allocations |
| Total | used + saved | Total data footprint |
cargo install zramtopOr build from source:
git clone https://github.com/volh/zramtop
cd zramtop
cargo build --release
./target/release/zramtop# Interactive TUI
zramtop
# Debug output (non-interactive)
zramtop --debug| Key | Action |
|---|---|
q / Esc |
Quit |
↑ / k |
Scroll up |
↓ / j |
Scroll down |
PgUp / PgDn |
Scroll page |
Home / End |
Jump to top/bottom |
| Script | Purpose |
|---|---|
scripts/zram-status |
Full status output (bash) |
scripts/zram-oneline |
One-line output for status bars |
scripts/zram-json |
JSON output for integrations |
scripts/zram-compare |
Side-by-side with free output |
scripts/zram-oneline # 19.9G/30.9G (3.4x, +18.0G saved)
scripts/zram-oneline short # 19.9/30.9G 3.4x
scripts/zram-oneline percent # 64% (3.4x)/proc/meminfo- System memory statistics/sys/block/zram*/mm_stat- Per-device zram statistics
orig_data_size compr_data_size mem_used_total mem_limit mem_used_max ...
| Column | Field | Description |
|---|---|---|
| 1 | orig_data_size | Uncompressed size of data in zram |
| 2 | compr_data_size | Compressed size |
| 3 | mem_used_total | Physical RAM used (includes allocator overhead) |
See kernel zram documentation for full details.
- Linux with zram configured
- Read access to
/procand/sys - Terminal with Unicode support
MIT
