I am running Ubuntu Desktop 15.10 on my machine with 4 GB of RAM and 4GB of swap. My understanding of Linux was, when it starts to run out of RAM, it will start killing processes to get some RAM back, and supported by this other question.
What I am observing is, when the system runs out of RAM, it just freezes. Mouse and keyboard inputs stop working. For experiment to figure out will Kernel try to recover from such state, I left system in such a state overnight, but it didn't recovered.
Is in the desktops the behavior is altered? Why the system not killing applications to free up space. Is there some setting which needs to be enabled/disabled.
The applications running are very standard, browser, mail client, terminal and music player etc.
UPDATE: free -m output when system is running fine is:
total used free shared buffers cached Mem: 3271 3145 126 432 32 694 -/+ buffers/cache: 2418 853 Swap: 7503 1424 6079
I have increased swap (7+ GB now), to prevent frequent freezing of the system.