Re: libxml2 memory handling

From: Date: Sun, 20 Apr 2003 16:53:52 +0000
Subject: Re: libxml2 memory handling
References: 1 2  Groups: php.xml.dev 
Request: Send a blank email to php-xml-dev+get-84@lists.php.net to get a copy of this message
Rob Richards wrote:
(DOM-)unlink is not the same as (PHP-)unset and we should be carefull, what happens if we unset a node without too much WTF factorness for the endusers ;)
For an unset I have it freeing the libxml2 structures, just wasnt sure about children nodes (which you answered at my last question). Test code had the children just being unlinked if they were referenced as I wasnt too sure here.
Mmmh, "having a doc" is not the same as "being in the tree". Therefore I think, we still could use the "doc" property to know to which document the object belongs. But I see the problem with freeing the document and not freeing nodes, which do not belong to the tree.. How does libxml2 handle that?
libxml2 leaves all of this up to the developer to handle. I have been going through the tree.c file and when freeing a doc, it traverses the tree and frees the strcutures within (no regard to nodes not within the tree but belonging to the document).
One thing that should be kept in mind when doing this is being able to move nodes between documents. Shane

« previous php.xml.dev (#84) next »