0

I have installed Matlab 2020a in Ubuntu 20.04. When trying to run a code the Matlab program is getting killed, but it runs in another system perfectly fine. Checking resources while running shows that 8gb RAM and 10gb Swap are getting exhausted before getting killed.

Tried changing Java heap memory to around 1.5GB, as well as unchecking the maximum array limit option from workspace settings in Matlab preferences.

dmseg output has these lines

oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/[email protected],task=MATLAB,pid=14659,uid=1000
[ 2166.872604] Out of memory: Killed process 14659 (MATLAB) total-vm:24372208kB, anon-rss:7121400kB, file-rss:0kB, shmem-rss:4kB, UID:1000 pgtables:35440kB oom_score_adj:0

syslog has these lines

kernel: [16207.494793] Out of memory: Killed process 50687 (MATLAB) total-vm:22123872kB, anon-rss:6511936kB, file-rss:0kB, shmem-rss:92kB, UID:1000 pgtables:31144kB oom_score_adj:0
/usr/lib/gdm3/gdm-x-session[1638]: (EE) client bug: timer event9 tap: scheduled expiry is in the past (-998ms), your system is too slow
kernel: [16208.142159] oom_reaper: reaped process 50687 (MATLAB), now anon-rss:0kB, file-rss:0kB, shmem-rss:108kB

Is there a way I can limit the memory and swap used by matlab? Have tried ulimit with -m and -v flags, but then matlab won't open at all.

This issue is not there in windows in the same machine, so the issue seems only for MATLAB in Ubuntu. Is there a way to make it work in ubuntu?

5
  • What process gets killed? If Java heap is limited to 1.5 GB it shouldn't use too much more than that. Take a look at topor htop to see who is eating up memory. Also look at log files, JAVAs and ubuntus in /var/log ... especially syslog and dmesg.
    – Soren A
    May 7, 2020 at 8:25
  • matlab gets killed, and dmesg notifies of the out of memory issue for matlab.
    – Praveen
    May 7, 2020 at 8:27
  • used htop and it shows matlab eating up memory while running the code.
    – Praveen
    May 7, 2020 at 8:28
  • Try asking in a MathLab forum .. they might know how to limit memory usage. It sound much like a MathLab configuration issue.
    – Soren A
    May 7, 2020 at 8:32
  • The MATLAB forum doesn't seem to be active with my question.
    – Praveen
    May 7, 2020 at 9:39

1 Answer 1

0

ulimit is your friend. Check out the -m flag. I think you set this before you launch your process and it applies from then on (in the current shell).

FROM POST Memory limiting solutions for greedy applications that can crash OS?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .