Joachim Zobel wrote: > Am Montag, den 05.03.2007, 17:23 +0000 schrieb Nick Kew: >> On Mon, 05 Mar 2007 07:55:06 +0100 >> Joachim Zobel <[EMAIL PROTECTED]> wrote: >> >>> I can however provide my own memmory allocation functions to libxml2, >>> so if I can identify apache memory, I can work around this. >> Have you looked at wrapping apr_palloc and [do nothing] as malloc >> and free respectively? >> >> I have some recollection of contemplating that with libxml2, >> but I haven't pursued it. > > Yes, that is possible, see > http://xmlsoft.org/html/libxml-xmlmemory.html#xmlMemSetup. The problem > is that I don' want to wrap [do nothing] as free, because malloc and > free are global functions and because I am inside a filter. So I am > looking for a way to do > > if (!allocated_by_apache(ptr) { > free(ptr); > }
Just register one of two free functions as cleanups of the pool, based on the origin of the data.