Score:0

"Matlab killed" message is showing while running matlab in Ubuntu 20.04.3

cn flag
anu

"Matlab killed" message is showing in the terminal while running matlab in Ubuntu 20.04.3. Please help me regarding this.

us flag
MATLAB is a proprietary software. Contact MATLAB support. In case of emergency, check if [GNU Octave](https://www.gnu.org/) work for you (to install it, enter the command `sudo apt install octave`). It is free and open source, and maintains high compatibility with MATLAB syntax.
us flag
According to https://www.mathworks.com/matlabcentral/answers/523663-matlab-gets-killed-with-out-of-memory-in-ubuntu-20-04-how-to-limit-the-memory-for-the-process, it is because MATLAB is consuming too much memory. Really, switch to Octave if it works for you. Unless you heavily need the toolboxes, Octave works just fine.
Score:1
cn flag

The message comes from the OS, from the dread OOM-killer, the "out of memory killer".

Years ago, operating systems took their memory allocation responsibilities seriously. When an application allocated memory, the OS allocated the memory. If there was not enough memory to satisfy the request, it was denied. Some still work that way, but Linux usually does not.

Linux is usually configured by default to treat memory allocation the way airlines treat reservations. It "honors" more allocations than it can actually supply, on the (correct) theory that not every allocation will actually be used. That works great until it doesn't.

On an airplane, overbooked passengers aren't pushed off the plane in mid-air. On Linux, that's exactly what happens: when memory is actually, really exhausted, the Grim Reaper, the OOM-killer, picks a victim. In your case, the victim is Matlab. Lucky you. Instead of a free ticket, you get a message.

To defeat the OOM-killer, change the overcommit_memory kernel setting to 2.

That solution is unfortunately a rear-guard action. The influence of Linux has led many applications to rely on overcommitted memory, and be profligate in their memory allocations. When it's not available, those applications use a lot of memory. On the other hand, it has the meritorious property of actually running programs that do start, and not killing running processes arbitrarily chosen as OOM targets.

To run Matlab reliably for the problem you have on the machine you have, you might need more RAM. As a stopgap, you could increase swap space, which increases virtual memory, which is what you need.

Brian D avatar
ng flag
see: https://serverfault.com/questions/485798/cent-os-how-do-i-turn-off-or-reduce-memory-overcommitment-and-is-it-safe-to-do for how to change the overcommit_memory setting
anu avatar
cn flag
anu
Thank you so much Sir. Your suggestions were really helped me.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.