Pi 4 & Virtual Memory maxed out

HI, I have a Raspberry Pi4 with the most current DietPi installed. For the last year I’ve had the issue of the Virtual Memory sitting at 100% full after about an hour of reboot and it just stays at 100%. Is there any way to increase the VM size?

Real memory: 1.87 GiB total / 344.95 MiB free / 157.42 MiB cached Swap space: 58.99 MiB total / 328 KiB free

The system is used to host a single website using Apache web server and MariaDB Database Server. All system files are updated weekly.

I have dropped the amount of apache hosts that open by 50%, but this just means the VM takes longer before it fills up.

Any assistance would be greatly appreciated.



did you tried to increase SWAP file?

/boot/dietpi/func/dietpi-set_swapfile 2048

That fixed the issue. Thank you! Previously when I first installed the Pi4 tis was not a functioning option. Glad to see it was resolved!

you should keep an eye on SWAP usage. It could slow down your system if it is used on a higher level for a longer period of time. Just use free -m to check memory usage.

do cat /proc/swaps

Do you have zram compressed RAM?
it might help

I do not have Zram but I do have a page caching system for Wordpress which places most page in active RAM. Speeds up the loading by 100%

I do notice that now that I’ve upped the swap to 2048, the swap has enough breathing room to swap instead of getting clogged up and not releasing files fast enough.

Give it a try. this is the site, hosted at my house… http://ei.house/

if your system require that much memory, you might think of a Rpi with 4 or 8GB phys memory

Yeah…having a large physical swap file can wear out a SD card rather quickly…especially if it reads/writes alot

Zram will help with that immensely (if you have latest release it should be there I believe)
If not you can install it with zram-config (since it’s Debian based)

Biggest thing with the RPi is it’s limited RAM…the latest models have alot more than the older versions

However your website is pretty sweet…a wee bit sluggish but that is to be expected!
Also a really neat project!

thank you! will definitely look to get the 8gb version in here ASAP and hopefully remove the need for any swap access at all.

yep that would be best solution :slight_smile:
Usully you should be able to simply move SD Card from one device to another without issues.