When I run a piece of python code that uses too much RAM, my computer would start to swap so badly that I had to do a hard reboot. To fix this I turned off swap assuming that the OOM killer would step in. However, I still get exactly the same symptoms! That is I can hear the hard drive thrashing once all the RAM is used, the computer freezes and I have to do a hard reboot.
What could be going on and how can I fix it?
My system is running Ubuntu 14.04.2 LTS, 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux with 8GB of RAM.
My /etc/fstab shows
# / was on /dev/sda1 during installation
UUID=80919e96-e83b-4c88-b30e-8673e1faa3b4 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
#UUID=68064725-c1bb-4293-b8d1-45b2a42fb7b4 none swap sw 0 0
Further details
tail -n+1 /proc/sys/vm/overcommit_*
==> /proc/sys/vm/overcommit_memory <==
0
==> /proc/sys/vm/overcommit_ratio <==
50
cat /proc/sys/vm/oom_kill_allocating_task
0
Example code
I am sorry to say I don't know how to make a minimalist python example that shows this problem. However this is non-minimalist code that definitely does http://paste.ubuntu.com/11621823/. Simply change the value of "path" in the code and run it. On my system it uses up all the RAM and then completely freezes the system.