Adding a node that is not part of a document as a child of a node that
is part of a document leaks a copy of the node.

The problem is ruby_xml_node_child_set() will copy the node being added
as a child into the document of it's new parent, and then changes its
second argument to refer to that copy, but it makes no attempt to update
the reference count of (and free if necessary) the original node.

In a test program that generates 1000 documents each with 1000 nodes
in my process grows to 750Mb in size - after removing this leak it runs
in a stable 10Mb footprint.

The problem with the fix is that it brings the attribute problems that
Jon Burgess recently posted about to the fore as it now becomes much
more likely that the node has been freed and we then die referencing
uninitialised memory trying to free the attribute that was freed along
with the node.

Tom

-- 
Tom Hughes ([EMAIL PROTECTED])
http://www.compton.nu/
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to