The physical memory we have in our system is limited. And, when we open too many applications that consume higher resources our system is bound to lag in such cases. When physical memory can no longer handle the requests then all the inactive pages in our physical memory are moved to Swap.
And, when even Swap space is full this would almost make our system unusable.
Since the issue occurs due to limited system resources so this can happen irrespective of the operating system we are using.
[Fixed] Low RAM, Linux freeze
So, act the moment you realize that there is something wrong with the system. Applications begin to freeze, mouse and keyboard don’t respond fast. That is when we should close applications that are least important to us.
What it does is, it frees up the memory almost instantly. And, helps our system get back to normal.
But, at times, it is not possible to respond that fast. Our system begins to crash the moment we launch an application. When that happens, open a terminal through the key shortcut:
Ctrl + Alt + F1 we can use keys F1 to F6 here.
Enter your login credentials here. And, use htop to check if it’s a RAM issue or not. If it is then close the application that we find is causing the issue.
Press key F3 to search for the application. When the application you wish to close gets highlighted, press F9 and Enter to close it. Analyze the parameters within the htop application itself. If you find that the memory usage has come down by closing the applications and system is back to normal. Then, close htop by pressing the F10 key. And, switch back to the GUI mode through the key shortcut:
Ctrl + Alt + F7
If you don’t have htop installed in your Linux distribution, then we have it already covered for AlmaLinux: Install htop in AlmaLinux 9.
Those who are using Ubuntu/Debian can install htop through the following command:
sudo apt update sudo apt install htop
In conclusion, though it may take some time to bring the system back to normal through the steps we have mentioned above. But, it is important to note here that we won’t be able to recover lost data in case we close the application abruptly through the steps we just mentioned. If it is due to higher CPU usage then we can Limit the CPU usage of Process in Ubuntu.