Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 3898 invoked from network); 18 May 2010 23:12:44 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 May 2010 23:12:44 -0000 Received: (qmail 91120 invoked by uid 500); 18 May 2010 23:12:44 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 91059 invoked by uid 500); 18 May 2010 23:12:44 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 91044 invoked by uid 99); 18 May 2010 23:12:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 May 2010 23:12:44 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [198.117.0.123] (HELO ndmsnpf03.ndc.nasa.gov) (198.117.0.123) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 May 2010 23:12:34 +0000 Received: from ndjsppt04.ndc.nasa.gov (ndjsppt04.ndc.nasa.gov [198.117.1.103]) by ndmsnpf03.ndc.nasa.gov (Postfix) with ESMTP id A229F2D80B0; Tue, 18 May 2010 18:12:12 -0500 (CDT) Received: from ndjshub02.ndc.nasa.gov (ndjshub02-pub.ndc.nasa.gov [198.117.1.161]) by ndjsppt04.ndc.nasa.gov (8.14.3/8.14.3) with ESMTP id o4INCCxK006852; Tue, 18 May 2010 18:12:12 -0500 Received: from wdyn-n229-242-130.arc.nasa.gov (128.102.242.130) by smtp01.ndc.nasa.gov (198.117.1.161) with Microsoft SMTP Server (TLS) id 8.1.393.1; Tue, 18 May 2010 18:12:11 -0500 Subject: Re: allocator and using malloc alternatives MIME-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset="us-ascii" From: Chris Knight In-Reply-To: Date: Tue, 18 May 2010 16:12:10 -0700 CC: APR Developer List Content-Transfer-Encoding: quoted-printable Message-ID: <0A76B1E1-0443-46ED-B614-8ED133D7D615@nasa.gov> References: <82967C72-7A0E-44C1-AAF7-AA866D99F87E@apache.org> To: Nick Kew X-Mailer: Apple Mail (2.1078) X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.8161:2.4.5,1.2.40,4.0.166 definitions=2010-05-18_04:2010-02-06,2010-05-18,2010-05-18 signatures=0 X-Virus-Checked: Checked by ClamAV on apache.org Thanks, I mostly didn't want it to be part of apr_pool_create because = then you'd have to change every instance of calling apr_pool_create; = plus most users will not need this capability so rather not have 99% of = apr_pool_create calls with 3 NULL's at the end. Also the semantics get a = little confusing in doing this at apr_pool_create; is the apr_pool_t * = allocated from the allocator_alloc_fn or via malloc()? On May 18, 2010, at 3:58 PM, Nick Kew wrote: > Aaargh, just accidentally sent this to Chris instead of list. > /me grumbles about missing Reply-To headers. >=20 >> On 18 May 2010, at 23:14, Chris Knight wrote: >>=20 >>> +/** >>> + * Redefines the function used by this apr_allocator to allocate a = block of memory. >>> + * @param allocator The allocator to set the memory allocation = functions on >>> + * @param alloc_fn The function for me to call when = apr_allocator_alloc is called >>> + * @param free_fn The function for me to call when = apr_allocator_free is called >>> + * @param opaque The opaque information to pass to these back-end = functions >>> + */ >>> +typedef apr_memnode_t *(apr_allocator_alloc_fn_t)(apr_size_t size, = void *opaque); >>> +typedef void(apr_allocator_free_fn_t)(apr_memnode_t *memnode, void = *opaque); >>> +APR_DECLARE(apr_status_t) apr_allocator_set_fns(apr_allocator_t = *allocator, apr_allocator_alloc_fn_t *alloc_fn, apr_allocator_free_fn_t = *free_fn, void *opaque); >>=20 >> Nice little generalisation! >>=20 >> At what point do you call apr_allocator_set_fns? I'd guess just = after the pool >> has been created, right? Any reason not to integrate it into pool = creation >> by passing it optional allocator fns? >>=20 >> --=20 >> Nick Kew >=20