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?
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?