httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Querna <c...@force-elite.com>
Subject Re: Question about memory in httpd
Date Sat, 03 Dec 2005 23:53:09 GMT
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.

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

-Paul

Mime
View raw message