Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 35123 invoked from network); 9 Apr 2009 00:15:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Apr 2009 00:15:13 -0000 Received: (qmail 89980 invoked by uid 500); 9 Apr 2009 00:15:12 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 89929 invoked by uid 500); 9 Apr 2009 00:15:12 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 89919 invoked by uid 99); 9 Apr 2009 00:15:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Apr 2009 00:15:12 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [213.203.219.181] (HELO mail4.conversis.de) (213.203.219.181) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Apr 2009 00:15:03 +0000 Received: from nexus.localdomain (dslb-094-221-132-190.pools.arcor-ip.net [94.221.132.190]) by mail4.conversis.de (Postfix) with ESMTP id E139BC88087 for ; Thu, 9 Apr 2009 02:14:42 +0200 (CEST) Message-ID: <49DD3DF2.5080909@conversis.de> Date: Thu, 09 Apr 2009 02:14:42 +0200 From: "Dennis J." User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b4pre) Gecko/20090324 Shredder/3.0b3pre MIME-Version: 1.0 To: modules-dev@httpd.apache.org Subject: Re: apr_palloc return value? References: <304e074a0904081207x676b3782sa7eaa40fb2bbbd04@mail.gmail.com> <20090408211309.3feb527b@grimnir> In-Reply-To: <20090408211309.3feb527b@grimnir> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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. Why? 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)? Regards, Dennis