Re: [PHP-XML-DEV] libxml2 memory handling

[email protected] (Shane Caraveo)
Newsgroups php.xml.dev
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.