You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Paul Querna <pa...@querna.org> on 2009/03/25 15:23:33 UTC

[PATCH] pools always use malloc

There have been various discussions on list in the past about the
problems with pools, and that newer malloc implementations really are
better at it han we can ever be. (jemalloc for example
<http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf>).

Patch:
<http://people.apache.org/~pquerna/marvelous-malloc.patch>

- palloc now used malloc underneath.
- we keep a list of malloc'ed adrresses, in a new list object, and
free them on clear/destroy
- unmanaged/core pool APIs removed.

I'd like to just put this into APR-2 trunk asap, and then figure out
how to unify the pool debug code with these changes.

Thoughts?

Thanks,
Paul

Re: [PATCH] pools always use malloc

Posted by Branko Čibej <br...@xbc.nu>.
Paul Querna wrote:
> On Wed, Mar 25, 2009 at 3:39 PM, Mladen Turk <mt...@apache.org> wrote:
>   
>> Paul Querna wrote:
>>     
>>> There have been various discussions on list in the past about the
>>> problems with pools, and that newer malloc implementations really are
>>> better at it han we can ever be. (jemalloc for example
>>> <http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf>).
>>>
>>> Patch:
>>> <http://people.apache.org/~pquerna/marvelous-malloc.patch>
>>>
>>> - palloc now used malloc underneath.
>>> - we keep a list of malloc'ed adrresses, in a new list object, and
>>> free them on clear/destroy
>>> - unmanaged/core pool APIs removed.
>>>
>>> I'd like to just put this into APR-2 trunk asap, and then figure out
>>> how to unify the pool debug code with these changes.
>>>
>>> Thoughts?
>>>
>>>       
>> Why did you remove the unmanaged pool?
>>     
>
> because when we are using malloc/free, they shouldn't be needed?
>   

Yes they certainly would be if you still want to control cleanup and such.


Re: [PATCH] pools always use malloc

Posted by Wes Garland <we...@page.ca>.
You know what I'd like to see?

An easy way to drop in a new malloc/realloc/free for APR at runtime.

In some environments, I'm already running with a highly-modified jemalloc
(the one for mozilla), and it would be nice to be able to use it for APR
stuff.  Especially in my case where that would significantly improve my
locality of reference!  I use NULL-parent-pools for storing private data for
javascript objects, and clean the pools up when the objects are collected.

So, any pool with parent == NULL will be unmanaged?
> Finally!!!
>

You mean they aren't?  Uh-oh!

Wes

-- 
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102

Re: [PATCH] pools always use malloc

Posted by Mladen Turk <mt...@apache.org>.
Paul Querna wrote:
>>>>>
>>>>> I'd like to just put this into APR-2 trunk asap, and then figure out
>>>>> how to unify the pool debug code with these changes.
>>>>>
>>>>> Thoughts?
>>>>>
>>>> Why did you remove the unmanaged pool?
>>> because when we are using malloc/free, they shouldn't be needed?
>>>
>> That's not its purpose.
>> It's purpose is to detach from global pool.
> 
> Yes, but the next step is to remove the global pool :)
> 

So, any pool with parent == NULL will be unmanaged?
Finally!!!


Cheers
-- 
^(TM)

Re: [PATCH] pools always use malloc

Posted by Paul Querna <pa...@querna.org>.
On Wed, Mar 25, 2009 at 3:44 PM, Mladen Turk <mt...@apache.org> wrote:
> Paul Querna wrote:
>>
>> On Wed, Mar 25, 2009 at 3:39 PM, Mladen Turk <mt...@apache.org> wrote:
>>>
>>> Paul Querna wrote:
>>>>
>>>> There have been various discussions on list in the past about the
>>>> problems with pools, and that newer malloc implementations really are
>>>> better at it han we can ever be. (jemalloc for example
>>>> <http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf>).
>>>>
>>>> Patch:
>>>> <http://people.apache.org/~pquerna/marvelous-malloc.patch>
>>>>
>>>> - palloc now used malloc underneath.
>>>> - we keep a list of malloc'ed adrresses, in a new list object, and
>>>> free them on clear/destroy
>>>> - unmanaged/core pool APIs removed.
>>>>
>>>> I'd like to just put this into APR-2 trunk asap, and then figure out
>>>> how to unify the pool debug code with these changes.
>>>>
>>>> Thoughts?
>>>>
>>> Why did you remove the unmanaged pool?
>>
>> because when we are using malloc/free, they shouldn't be needed?
>>
>
> That's not its purpose.
> It's purpose is to detach from global pool.

Yes, but the next step is to remove the global pool :)

Re: [PATCH] pools always use malloc

Posted by Mladen Turk <mt...@apache.org>.
Paul Querna wrote:
> On Wed, Mar 25, 2009 at 3:39 PM, Mladen Turk <mt...@apache.org> wrote:
>> Paul Querna wrote:
>>> There have been various discussions on list in the past about the
>>> problems with pools, and that newer malloc implementations really are
>>> better at it han we can ever be. (jemalloc for example
>>> <http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf>).
>>>
>>> Patch:
>>> <http://people.apache.org/~pquerna/marvelous-malloc.patch>
>>>
>>> - palloc now used malloc underneath.
>>> - we keep a list of malloc'ed adrresses, in a new list object, and
>>> free them on clear/destroy
>>> - unmanaged/core pool APIs removed.
>>>
>>> I'd like to just put this into APR-2 trunk asap, and then figure out
>>> how to unify the pool debug code with these changes.
>>>
>>> Thoughts?
>>>
>> Why did you remove the unmanaged pool?
> 
> because when we are using malloc/free, they shouldn't be needed?
> 

That's not its purpose.
It's purpose is to detach from global pool.

Regards
-- 
^(TM)

Re: [PATCH] pools always use malloc

Posted by Paul Querna <pa...@querna.org>.
On Wed, Mar 25, 2009 at 3:39 PM, Mladen Turk <mt...@apache.org> wrote:
> Paul Querna wrote:
>>
>> There have been various discussions on list in the past about the
>> problems with pools, and that newer malloc implementations really are
>> better at it han we can ever be. (jemalloc for example
>> <http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf>).
>>
>> Patch:
>> <http://people.apache.org/~pquerna/marvelous-malloc.patch>
>>
>> - palloc now used malloc underneath.
>> - we keep a list of malloc'ed adrresses, in a new list object, and
>> free them on clear/destroy
>> - unmanaged/core pool APIs removed.
>>
>> I'd like to just put this into APR-2 trunk asap, and then figure out
>> how to unify the pool debug code with these changes.
>>
>> Thoughts?
>>
>
> Why did you remove the unmanaged pool?

because when we are using malloc/free, they shouldn't be needed?

Re: [PATCH] pools always use malloc

Posted by Mladen Turk <mt...@apache.org>.
Paul Querna wrote:
> There have been various discussions on list in the past about the
> problems with pools, and that newer malloc implementations really are
> better at it han we can ever be. (jemalloc for example
> <http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf>).
> 
> Patch:
> <http://people.apache.org/~pquerna/marvelous-malloc.patch>
> 
> - palloc now used malloc underneath.
> - we keep a list of malloc'ed adrresses, in a new list object, and
> free them on clear/destroy
> - unmanaged/core pool APIs removed.
> 
> I'd like to just put this into APR-2 trunk asap, and then figure out
> how to unify the pool debug code with these changes.
> 
> Thoughts?
> 

Why did you remove the unmanaged pool?


Regards
-- 
^(TM)