Re: [xml] Possible memory leak in extension functions



On Tue, 18 Feb 2003, Daniel Veillard wrote:

  if, on an XPATH_NODESET object you set obj->boolval to 1, then
assuming also that you have groupped the nodes built for that nodeset
back into a container node, then setting obj->user to that tree will
in effect free up the whole tree when the nodeset is deallocated.

Unfortunately I have no idea what you mean when you say "groupped the
nodes ...". Do you have a API I can look at?

Or
if that user field isn't set the xmlXPathFreeValueTree() will do the
deallocation for all objects referenced.

I tried that and it didn't work, maybe because of the below note?

  But ... if the inner XPath computation leads to references to those
nodes then serious troubles may result from this. The key point is that
libxml2 XPath does not control the life of the referenced objects,
only the controlling layer does. And yes extension functions and
Result Value Trees have made my life miserable for a while, due
to those allocation problems.

Even though I didn't fully understand this paragraph, it sounds scary ;-)

-- 
<!-- Matt -->
<:->get a SMart net</:->
Spam trap - do not mail: spam-sig spamtrap messagelabs com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]