-1

If you create a very simple script, simply pointing at itself ie:

/home/user/loop.sh

and then executes the script in terminal (as regular user), it starts to consume more and more memory, until the user sessions crashes. All memory used for the session is lost and lightdm is restarted.

Why does ubuntu not protect itself against application that try to take up more memory than the system can offer?

(14.04 64 bit)

2
  • actually when that happens on my system the os just becomes dead slow because all the SWAP is consumed. and then everything freezes because there is no more RAM to offer. Which is like any other system would do...
    – Alvar
    Sep 8, 2014 at 14:57
  • Yes that would be a more logical consequences, any idea why my OS reacts so much more dramatical? Sep 8, 2014 at 15:08

1 Answer 1

0

Because there isn't a good way to do this. Consider:

  • How is Ubuntu supposed to know how much memory something should or shouldn't have?
  • How much should be reserved?
  • What applications do we kill off first?
  • What if terminating your application meant you lost data?

You can set your own limits in various ways but there isn't a good way for Ubuntu to Just Know™ what you think is sensible behaviour here. Given that this could mean you losing data, Ubuntu lets you make these decisions.

And generally speaking, if you write a script that consumes all the RAM, that's your responsibility.

You must log in to answer this question.

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