I am using MX linux for a few days and I found a problematic behavior. Suddenly sevaral processes were killed automatically. For this, I had to face many problems. Is there any way to stop it? I don't want kill process automatically. Please help me to solve it.
Is there any way to stop it?
Unfortunately there isn't.
The rationale is as follows: once a system runs completely out of memory, it must freeze, because it cannot even run the simplest command - since that would require allocating memory. The OOM-Killer is designed to prevent the system from becoming completely unusable in this way by killing (based on some heuristics - others may say at random) processes to free memory. That way, an administrator can at least try to get the system back to a usable state, hopefully without having to reboot. Completely disabling this feature is not implemented (see also this answer on StackOverflow).
To alleviate the problem, you can try to
topor any similar system monitor to investigate which program starts eating up memory. If it is one you wrote yourself, you may have created errors in the memory management that you can try to track down using tools such as
valgrind. If it is a third-party program, you can try to limit its resources (see answers to this question, for example) so that it at least doesn't affect your system in general.
- Try to tweak the settings of the OOM killer, e.g. overcommiting, but note that this can have side effects.
- Increase the swap space (see comment by Ipor Sircer), but note that this will make the system very slow.
If your hardware ultimately is not up to the task, you may well have to think about upgrading.