Memory usage

Hi, I want to see if I can solve memory usage on my system:

I come from Linux, which works very differently, I understand that more memory blocks are cached for later. This is fine.

However, I found out, there is always a percentage of memory which is just lost: Let's say: My computer has 16GB of RAM. I start the computer, and 3% is used. I open Firefox, and after some usage and tabs open, it goes to 75% usage. I close all, and used memory goes to about 30%, not close to the 3% before.

I could concede it is because some of the memory is cached, but the thing is that every time I open a RAM intensive app, I am using more RAM. After a few hours of usage (usually about a day of use), I am using SWAP space, and I need to reboot to preserve my SSD and recover performance.

Is there any way of forcing flushing cached memory, or freeing non available memory before launching a RAM intensive application?

Thanks.
 
If you use ZFS on Root, this would consume some ram because ZFS has Arc Cache, you can limit it but can't get rid of it iirc.

To free up swap, you can use command swapoff/swapon on the swap partition.

I think that memory would get released if some app needs it, that's a bit tricky imo.
 
I never tough of the swapon/swapoff trick, so thanks!

I am using UFS instead of ZFS, as my system has limited resources, so that's not it. The issue seems to be that some garbage is not cleaned up on memory.

I might have randomly found a fix: As I am taking care of some friends cats and need to move homes, I hibernated my laptop as I commuted, and when I arrived back homeand woke up the computer, memory seemed flushed.

I want to repeat the experiment a couple of times before saying this is a solved issue tho.
 
I never tough of the swapon/swapoff trick, so thanks!

I am using UFS instead of ZFS, as my system has limited resources, so that's not it. The issue seems to be that some garbage is not cleaned up on memory.

I might have randomly found a fix: As I am taking care of some friends cats and need to move homes, I hibernated my laptop as I commuted, and when I arrived back homeand woke up the computer, memory seemed flushed.

I want to repeat the experiment a couple of times before saying this is a solved issue tho.
Hmm. I do have 16 gigs of RAM too and made a 32 GB of swap space as I don't use binary packages but build them myself.

I am not the one who found out that trick, I've read somewhere but thanks to the one. You are welcome.
 
Hey, I know enough of coding and system admin as to land a job, and trust me: I discovered nothing from my own but relied on more knowledgeable people to learn, not to count all I have to find out, so no sweat!

My "mistake" was to not follow the traditional rule you followed of SWAP == 2xRAM, but I also have limited Disk space (I got this second hand computer very cheap). This FreeBSD installation is maybe going to be nuked, as I plan on getting a new drive eventually, and reinstall it with what I learn.

Using ports is interesting, and It is my fav approach, my Linux machine has Gentoo. However, I found out that disk space is then a concern: Compiling something like the cursed Webkit-GTK can take up to 14GB of disk space and many hours of compiling. Hopefully I managed to avoid anything that uses Chrome and maybe I can consider it on the future...
 
Hey, I know enough of coding and system admin as to land a job, and trust me: I discovered nothing from my own but relied on more knowledgeable people to learn, not to count all I have to find out, so no sweat!

My "mistake" was to not follow the traditional rule you followed of SWAP == 2xRAM, but I also have limited Disk space (I got this second hand computer very cheap). This FreeBSD installation is maybe going to be nuked, as I plan on getting a new drive eventually, and reinstall it with what I learn.

Using ports is interesting, and It is my fav approach, my Linux machine has Gentoo. However, I found out that disk space is then a concern: Compiling something like the cursed Webkit-GTK can take up to 14GB of disk space and many hours of compiling. Hopefully I managed to avoid anything that uses Chrome and maybe I can consider it on the future...
Thanks.

I've actually tried 16 gigs of swap space too but when building editors/vscode, my machine got ran out of memory and swap got fulfilled so I've had to do it 32 gigs back. I think it's the best rule, swap == 2xRAM. I do have a 256 GB m.2 nvme ssd but it's more than enough for me, i do have some hard drives that i've made a mirror of three, i use it for my zroot backups, photos etc.

Yeah, some ports really big and consume so much disk space, i specifically blacklisted some big ports to not use my memory for their work directory but a place on my ssd so i won't ran out of memory and it works fine since. I also don't like using big ports to i try to avoid them too like finding lightweight alternatives etc. I don't just use ports directly, I use ports-mgmt/poudriere which is a very great ports building system, iirc FreeBSD is using it to build binary packages too.

It was a good talk, thanks for that I appreciate. I think that we should leave it here because people needs to focus on your main problem and our maybe a-bit-of-out-of-topic talks would make it hard for people.
 
I am using SWAP space
And? Swap usage in and of itself isn't a problem. The system will always try to push something to swap if it's not useful to keep in memory, so even on systems with enormous amounts of RAM you'll see some swap being used. It's excessively moving data in and out of swap that's problematic, not swap usage on its own.

Code:
CPU:  0.1% user,  0.0% nice,  7.1% system,  0.0% interrupt, 92.8% idle
Mem: 10G Active, 34G Inact, 4641M Laundry, 38G Wired, 6609M Free
ARC: 28G Total, 6091M MFU, 20G MRU, 6312K Anon, 1350M Header, 498M Other
     25G Compressed, 36G Uncompressed, 1.44:1 Ratio
Swap: 16G Total, 1223M Used, 15G Free, 7% Inuse
That 7% swap being used just sits there, doing nothing (machine has 96GB of memory). It is not an issue, it just keeps that data out of memory so there's more immidiately available for the applications that are running on this machine (about 15 VMs are currently running on it).

My "mistake" was to not follow the traditional rule you followed of SWAP == 2xRAM
Very old rule of thumb, back when systems had megabytes of memory, not several gigabytes.
 
Back
Top