You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ben Laurie <be...@algroup.co.uk> on 2004/01/08 14:32:41 UTC
Re: Memory pools -- support for moving a sub-pool from one pool t
o an other
Sander Striker wrote:
>>We actually have two functions in our code:
>>moveTree(srcPool, dstPool) and moveItem(srcItem, dstPool). The moveItem()
>>takes an allocated buffer and binds it as a child of the dstPool. I
>>understand that this may have to be implemented by first allocating a buffer
>>--say dstItem-- of size srcItem in the dstPool and then doing a copy and
>>then freeing the srcItem. Does APR allow me to find out the size of the
>>srcItem if I just have the srcItem pointer.
>
> No. The memory returned by apr_palloc doesn't have any recorded size associated
> with it. The only thing you might be able to deduce is the size of the containing
> block of memory. But that may be a LOT larger than what you are looking for.
> Also, the concept of 'freeing the srcItem' isn't possible. There is no
> apr_pfree function.
Of course, you could replace apr_palloc with a version that did record
the size.
Cheers,
Ben.
--
http://www.apache-ssl.org/ben.html http://www.thebunker.net/
"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff