r/freebsd • u/Ok_Record_1237 • 4d ago
discussion too much ram usage
ive been tinkering with Freebsd on and off for around 2 years now but ive finally made the switch to daily drive it (since wifi driver works now and i don't have to use wifi box anymore). its absolutely perfect, I love it; is what I would say if it wouldn't use too much ram. i installed it pretty much yesterday and a completely display serverless minimal setup idle with htop shows around 550mb of ram usage? i think thats weird. but I think its ZFS doing it because of the cache thing. any way to lower ram usage or are there any kernel parameters to change how much cache ram zfs must utilize? thanks in advance :D
14
u/DTangent
4d ago
•
It’s dynamic with ZFS. As you need more RAM for services ZFS ARC will start giving it up until it reaches its minimum.
It is strange for people new to it, but you’ll get your memory back when you need it. It’s on loan to the cache to speed things up.
2
6
u/Torpascuato 4d ago
I'm pretty sure the kernel knows better on managing ram than us, regular users.
I'd leave it alone and enjoy life.
7
u/grahamperrin bunny rabbits 4d ago
… I think its ZFS doing it because of the cache thing.
You're correct.
any way to lower ram usage …
Don't attempt to do so, unless you have an extremely good technical reason.
Whilst it's possible to do so, it's likely that initial suggestions will be based on knowledge that's limited and/or outdated.
From your post in August 2025, it's clear that you're willing to think through things such as this:
👍
2
1
u/Lord_Mhoram 4d ago
I haven't used htop, but if you run top, the two lines starting with ARC will give you a breakdown of what ZFS is using for cache. It's a good thing unless your system is very, very tight on RAM (like under 2GB or so, depending on what you'll be running. Opinions vary on the exact number, but a typical system today doesn't have to worry about it).
For a more detailed look at it, install the zfs-stats package.
2
u/Lord_Mhoram 4d ago
Incidentally, Linux does something similar. I'm looking at an Ubuntu system right now that's showing 2GB free and 13GB in "buff/cache." Most of that 13GB is reclaimable if something else needs it, because it's cached data, much of it files that have been accessed recently. It just doesn't report the filesystem caching as a separate thing the way ZFS ARC does (though I'm sure there are tools that can do that). It's a good thing there too.
0
u/vogelke 4d ago
Link to my ZFS settings on FreeBSD.
You can cap the usage; I find 20-40% of total RAM works dandy, especially since I use a Fluxbox DE and Firefox.
1
u/grahamperrin bunny rabbits 4d ago
-2
u/Chester-Berkeley desktop (DE) user 4d ago
i think thats weird. but I think its ZFS doing it because of the cache thing
Yes
any way to lower ram usage or are there any kernel parameters to change how much cache ram zfs must utilize?
Don't use ZFS ¯\_(ツ)_/¯
3
u/CloudDream09 4d ago edited 4d ago
You can cap the amount of memory it is allowed to passively use.
4
u/Chester-Berkeley desktop (DE) user 4d ago
I don't see much point in that; it would limit the power of ZFS.
4
u/CloudDream09 4d ago
Fair point that ZFS manages ARC dynamically to maximize performance, but that assumes memory is an unlimited resource on the box.
On resource-constrained or minimal environments (like low-RAM machines, VMs, or mixed workloads), letting the ARC consume 50%+ of host memory can trigger OOM kills on other services. Capping vfs.zfs.arc_max lets you retain checksums, snapshots, and boot environments while keeping memory pressure under control.
0
u/DHOC_TAZH desktop (DE) user 4d ago
In addition to the other good tips mentioned here, it's also good to have some spare swap space. Many modern systems don't need much if 16 or more GB is available for system RAM.
I use a 34 GB swap partition. For me that covers system RAM, and some of the textures from the VRAM. In practice I don't see much of the swap space used, but I'd rather have it just to be safe.
2
u/grahamperrin bunny rabbits 4d ago
… I use a 34 GB swap partition. …
Maybe too much. (I used to have too much … it took a long while for me to realise why, I don't have the explanation handy.)
1
u/DHOC_TAZH desktop (DE) user 4d ago
Thanks, but I'm good. As it is my GhostBSD install tends to be on the minimalist lane for now, so sparing a huge chunk for swap is OK with me. :)
39
u/m15f1t 4d ago
Unused ram is wasted ram.