httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dennis J." <>
Subject Re: apr_palloc return value?
Date Thu, 09 Apr 2009 00:14:42 GMT
On 04/08/2009 10:13 PM, Nick Kew wrote:
> On Wed, 8 Apr 2009 22:07:55 +0300
> Juha Korhonen<>  wrote:
>> Hi, when I use apr_palloc function to allocate memory, should I check
>> the return value to make sure that I really got some memory?
> Yes.
> Sort-of.
> That is to say, yes you should, but it's common practice to omit
> the test, on the dubious grounds that if pool allocation fails,
> then your error handling is pretty-much going to fail for the
> same reason so it's pointless.


If I try to allocate 1GB of memory and that fails why is "error handling 
pretty-much going to fail" after that? There still could be 500MB of ram 
free which would probably be more than enough to handle such an error or is 
there anything fundamentally different compared to to a malloc all (other 
than that it uses a pool)?


View raw message