Denys Vlasenko vda.linux at googlemail.com
Mon Jun 9 14:22:00 UTC 2008

On Monday 09 June 2008 12:55, Bernd Schmidt wrote:
> > Even if libc would be perfect and not crash on OOM, and all
> > libraries and programs would be similarly perfect and not crash
> > on OOM (fat chance), you still CANNOT do anything useful on
> > OOMing machine - yes, programs maybe don't crash, they "only"
> > refuse to do what you ask them to do, they error out:
> > $ ls
> > cannot exec ls: Cannot allocate memory
> > $ cat httpd.log
> > cannot exec cat: Cannot allocate memory
> Which is perfectly good, documented behaviour,

I don't dispute that. I'm saying that it's also useless behavior -
you cannot do anything useful with a machine in this state.

> and infinitely better  
> than crashing in the middle of a program and leaving things in an 
> inconsistent state.  Even when you get OOM, there are different modes of 
> failure,

On the microscopic level, yes, they are different.

In a bigger picture, no. The machine is unusable one way or another.

Imagine that you are running a server - a database or a web server.
If you get OOM, what would you do? Right - discover and fix a buggy
program which leaks memory; or just add more RAM. In other words - you
fix OOM, you do not try to make your machine to work in OOM condition,
that is not what you want (and is generally impossible for any useful
definition of term "work").

After you fixed OOM, you are not going to hit those code paths.

More information about the uClibc mailing list