LightXML.jl
LightXML.jl copied to clipboard
set finalizer for XMLDocument by default
I propose most new users would rather prefer the finalizer is set by default. This does not solve the issue if people create their own XMLElement's but if they have a top-level XMLDocument the memory of it and all its sub-children will be gc'd once we no longer use the document.
Do we end up needing to keep a reference count for all the child elements? What happens if you have child elements still around but the top-level document goes out of scope?
Not sure, sorry. Sounds like it would wreak havoc... ;) Maybe keep it as a manual option then and people have to set the finalizer themselves.
Should README.md
be edited to say we don't need to free xdoc
explicitly anymore? Are the examples in there canonical?
Unless there's a way to tell Julia's gc that child nodes are referring to the document and it should be kept alive until all of its children are also out of scope, I don't think setting a finalizer on xdoc is actually safe. Though we need to so some more experiments to be sure.