apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: Memory pools -- support for moving a sub-pool from one pool t o an other
Date Thu, 08 Jan 2004 13:32:41 GMT
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.



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

View raw message