Hello all,

I have just started using apr for a client-server project. A lot a functions 
have an apr_pool as parameter, so that all the allocations inside the functions 
are done within the pool (using functions as apr_pcalloc for example). I don't 
want to use pools for my project, but instead I want to use my own memory 
allocation scheme. Is there a way to configure apr so that to use my own memory 
allocator  ?
It appears to me that apr wasn't design flexible enough to allow this.
Why was chosen this method for memory allocations instead providing some 
function pointers in a structure, something like this:

void my_func (my_allocator* allocator)
{
    allocator->alloc(bytes);
    .....
}

where my_allocator is a structure defined something like:

struct my_allocator
{
...
    void * (*alloc)(size_t bytes);
....
}

this way, the user had a chance to substitute his own function to be used for 
allocation purposes, instead of forcing the user to use the existing pool based 
allocation mechanism ...
Pool based allocation is good for some class of applications indeed, but the 
library should be flexible enough to allow the user to specify his own memory 
allocation scheme (or not to use one at all and to directly allocate memory on 
the heap using malloc)

Thanks for your help.
Adrian


       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.

Reply via email to