apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <...@apache.org>
Subject Fwd: allocator and using malloc alternatives
Date Tue, 18 May 2010 22:58:16 GMT
Aaargh, just accidentally sent this to Chris instead of list.
/me grumbles about missing Reply-To headers.

> On 18 May 2010, at 23:14, Chris Knight wrote:
> 
>> +/**
>> + * 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);
> 
> Nice little generalisation!
> 
> 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?
> 
> -- 
> Nick Kew


Mime
View raw message