High memory usage


I have raspberry PI 4B 4GB RAM with openwrt 22.03.2 firmware. I have intermittently lost of wan problem. I suspect the problem is from abnormal high memory usage. The memory usage is 144MiB/3.71GiB 4% after rebooting, and then it climbs up and eats all memory, see snapshot below:

I have same setup on Raspberry Pi 2 1GB RAM with 22.03.2 firmware, the memory usage is steady at around 140MiB/927MiB. See below:

I think there is memory leak on PI4, but I could find the cause. May some help me to find the problem?

144 MB RAM usage would be a bit higher than expected, but not necessarily a problem - the continuously rising RAM usage however certainly is.

Given that there is quite a big potential of 'misconfiguration' (rogue logging, server processes filling up /tmp/ or similar issues), I would start debugging by having a look at the file sizes under /tmp/ and RAM usage of the process via (e.g.) htop, if you don't find a likely culprit rather quickly, starting over with a fresh configuration/ fresh flash and a minimal setup (just WAN/ LAN and the necessary VLAN setups, if applicable) and have a look what happens there for ~a week, before slowly enabling additional features one-by-one.

While the RPi ecosystem might not be the most pleasant one for developers, it has a strong following by OpenWrt users, so I'd be surprised if this was a generic issue for these devices.

Install htop and now I am confused with the memory usage result.
htop shows 53.4MB/3.71GB when openwrt is showing 320MiB/3.71GiB in the luci overview page(I rebooted the router an hour ago so the memory usage is 320M at this moment).
The two values don't match each other.

1 Like

Now I found what is causing the high used memory. I have USB harddrive attached to Pi and shared by samba. I stored a VHD in the USB drive. Everytime I start this VM(the VM uses VHD in shared USB drive) from my laptop, the memory usage increases to the almost the maximum. However, the memory usage stays even after I shut down the vm.
I tried to restart Samba service, it won't reduce the memory usage. How to release the used memory after VM is shut down? or enabling swap space will help?

i had same question, and i have also x86 router with 4gb ram, it look like some caching, don't worry it is not an issue for linux based system

Too much memory cached - Installing and Using OpenWrt - OpenWrt Forum

1 Like

I have to worry because the wan connection becomes unstable under this condition

this is the same issue with my CPE220. i will be force to roll back in version 22.02.2.

is it issue? does your connection become unstable? my router memory is always full and it is not means issues, at least in my case

1 Like

Yes, because my clients are complaining about random disconnection in my dumb AP.

22.03.3 released, you can try new version, new version contain almost 4 pages of fixes and updates since 22.03.2 version

1 Like

There is always an excitement and enthusiasm as new stable releases start showing up on the downloads page -- and that is great!

1 Like