A Hacker News user investigated why memory usage reported by fastfetch, btop, and htop differed on a FreeBSD system after migrating from an Ubuntu server.
A Hacker News user investigated why memory usage reported by fastfetch, btop, and htop differed on a FreeBSD system after migrating from an Ubuntu server.
FreeBSD uses a virtual memory system that divides physical memory into 4 KiB pages and organizes them into several queues, such as active, inactive, laundry, wired, and free.
Monitoring tools compute used memory with different heuristics; fastfetch adds inactive and cache to free memory, while btop adds active and wired memory.
In btop, the used‑memory calculation relies on a 32‑bit unsigned integer for page counts; values above 4 GiB wrap, causing an underestimate of used memory.
The cache count (v_cache_count) reported by FreeBSD is a dummy variable that always returns zero, so tools that depend on it show an empty cache.
To correct the issue, the author modified btop to use 64‑bit variables, subtracted the ZFS ARC size from wired memory, and added the ARC amount to the cache category, and submitted a pull request that has been merged.
A similar fix was applied to fastfetch, which now detects ARC cache on FreeBSD and other ZFS‑supporting systems.
The author tested the changes in virtual machines and reported that the revised memory figures more accurately reflect system state.
The investigation deepened the author’s understanding of FreeBSD internals and resulted in patches to multiple open‑source projects.
The author plans to continue researching memory management in DragonFly BSD.
- Publisher
- Hacker News
- Reliability
- high
- Published
- 7/4/2026, 10:00:21 AM
- Retrieved
- 7/4/2026, 10:00:21 AM
- Relevance
- 80%
- Confidence
- 85%

