Return home

CRASH OVERRIDE with ulimit


Sometimes while programming in Linux I like to create infinite loops that consume memory and make my computer unresponsive.

To prevent this you can set a limit on the amount of virtual memory a process can consume as well as a multitude of other limits using “ulimit”.

In your ~/.bashrc:

ulimit -v 614400 # limit to 600mb

Now, if your program starts going into an infinite loop you’ll get a nice “Segmentation fault” on the haywire process and you can regain control and fix things.

comments powered by Disqus