set finalizer for XMLDocument by default#19
Open
robertfeldt wants to merge 1 commit into
Open
Conversation
Contributor
|
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? |
Contributor
Author
|
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 |
Contributor
|
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. |
This was referenced Mar 13, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.