Reputation: 51
Parrot os becomes fully unresponsive(but I can move mouse cursor but click won't count to action) whenever I try to debug the flutter app and search query on brave at the same time. Memory uses get increased to straight 100% and have to force restart. I am using Lenovo laptop with Nvidia GeForce mx110 with SSD and 8GB ram
Upvotes: 2
Views: 6715
Reputation: 41
To fix this problem I have found that you need to set the following setting to something around 5%-6% of your total physical RAM, divided by the number of cores in the computer:
sysctl -w vm.min_free_kbytes=65536
Keep in mind that this is a per-core setting, so if I have 2GB RAM and two Cores, then I calculated 6% of only 1 GB and added a little extra just to be safe.
This forces the computer to try to keep this amount of RAM free, and in doing so limits the ability to cache disk files. Of course it still tries to cache them and immediately swap them out, so you should probably limit your swapping as well:
sysctl -w vm.swappiness=5 (100 = swap as often as possible, 0= swap only on total necessity)
The result is that linux no longer randomly decides to load a whole movie file of approx 1GB in ram while watching it, and killing the machine in doing so.
Now there is enough reserved space to avoid memory starvation, which aparrently was the problem (seeing as there are no more freezes like before).
After testing for a day - lockups are gone, sometimes there are minor slowdowns, because stuff gets cached more often, but I can live with that if I dont have to restart computer every few hours.
The lesson here is - default memory management is just one of use cases and is not allways the best, even though some people try to suggest otherwise - home entertainment ubuntu should be configured differently than server.
You probably want to make these settings permanent by adding them to your /etc/sysctl.conf like this: vm.swappiness=5
vm.min_free_kbytes=65536
Upvotes: 2