[gdome]Detached subtree memory problem



 Hi,
   to complete the new memory management system on gdome2 we have to solve
some memory leak problems related to subtree detached from the main tree
structure holded by the Document Node.

   Those problems are due to the libxml2 xmlFreeDoc behaviour that can't
free nodes detached from the main tree.

   We can have detached subtree calling Node.removeChildNode,
Node.cloneNode or functions like Document.createElement,
Document.createDocumentFragment and so on.

   To solve those problems we can use the reference counting system
implemented in gdome2, the fact that root nodes of detached subtree
have no parentNode and the libxml2 xmlFreeNode API that free a detached
node and its subtree.

   The idea is to call xmlFreeNode when, on unref, the
Gdome_xml_Node.refcnt reach 0 and the Gdome_xml_Node->n->parent is NULL.

   Now, we have another problem: if we have references to nodes in the
freed subtree, calling gdome APIs on them result in a seg fault. So the
idea to solve also this problem is to use the INVALID_STATE_ERR Exception.


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