Memory limiting solutions for greedy applications that can crash OS?
Posted
by
Hooked
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Hooked
Published on 2012-04-10T16:11:54Z
Indexed on
2012/04/10
17:46 UTC
Read the original article
Hit count: 272
I use my computer for scientific programming. It has a healthy 8GB
of RAM and 12GB
of swap space. Often, as my problems have gotten larger, I exceed all of the available RAM. Rather than crashing (which would be preferred), it seems Ubuntu starts loading everything into swap, including Unity and any open terminals. If I don't catch a run-away program in time, there is nothing I can do but wait - it takes 4-5 minutes to switch to a command prompt eg. Ctrl-Alt-F2
where I can kill the offending process.
Since my own stupidity is out of scope of this forum, how can I prevent Ubuntu from crashing via thrashing when I use up all of the available memory from a single offending program?
At-home experiment*!
Open a terminal, launch python
and if you have numpy
installed try this:
>>> import numpy
>>> [numpy.zeros((10**4, 10**4)) for _ in xrange(50)]
* Warning: may have adverse effects, monitor the process via iotop
or top
to kill it in time. If not, I'll see you after your reboot.
© Ask Ubuntu or respective owner