desktop entry proposal: TerminateSafe=true key

Lennart Poettering mzkqt at 0pointer.de
Fri May 7 11:01:09 PDT 2010


On Fri, 07.05.10 17:36, Patryk Zawadzki (patrys at pld-linux.org) wrote:

> You know you're low on memory when your malloc fails. Failing a malloc
> of 500M is not the same as failing a malloc of 4K.

That is not how memory management works on Linux. malloc() will almost
always succeed, as overcommiting is allowed. Only when you actually
access the memory you malloc'ed() it will become backed by real RAM.

Or in other words: OOM is not detected at malloc() time, OOM is detected
at access time. malloc() returning NULL will usually happen when you run
out of address space, not when you run out of RAM.

That's why there is the OOM killer after all: at the time where the RAM
is completely used up you are almost certainly not in a malloc() where
you could just return NULL, but in a normal memory access, and most
likely in one done by a process that is not at fault. The only way out
then is to kill somebody, and choose somebody who is suitable.

http://0pointer.de/blog/projects/on-oom.html
http://article.gmane.org/gmane.comp.audio.jackit/19998

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4


More information about the xdg mailing list