On Sat, 3 Dec 2005, Paul Querna wrote:
Christophe Jaillet wrote:
When going thrue the code, looking at apr_palloc and friends, one can see
that :
* in some places (few of them) , the returned pointer is checked against
NULL
* in other places (most of them), it is not.
I've always been told that checking return value is a good idea, (especially
with memory allocation in order to avoid disasters) so should all the
apr_palloc (and friends) calls be checked or are they special reasons in
httpd not to care about short in memory situation ?
Actually, on most operating systems, including Linux and FreeBSD, you
will NEVER get returned NULL.
Actully, Linux and FreeBSD will return NULL and set errno to ENOMEM,
if you try to allocate in sum more than RLIMIT_DATA limit.
Instead when your operating system is truly out of memory, it will kill
your process, and you won't have any chance of handling it.
Read a whole blog post about it:
http://baus.net/memory-management
Igor Sysoev
http://sysoev.ru/en/