Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free after unlink #24

Closed
wants to merge 1 commit into from
Closed

Free after unlink #24

wants to merge 1 commit into from

Conversation

triptec
Copy link
Collaborator

@triptec triptec commented Nov 27, 2017

@dginev
Copy link
Member

dginev commented Nov 27, 2017

Hm, I think this may be a little trickier. If I remember correctly, unlinking detaches a node from its parent fragment, but keeps it in memory, as you may want to reattach it to a different fragment.

I have been fighting the global memory management in the past, and my memory is that the safest way to do things is to free the memory when the last Node pointing to a given pointer is Drop-ed in Rust. But unlinking shouldn't be an immediate free by default.

@dginev
Copy link
Member

dginev commented Nov 27, 2017

I think the cause of the failing Travis test is precisely that tricky bit.

@triptec
Copy link
Collaborator Author

triptec commented Nov 27, 2017

Hmm, seems you are right, add a delete() or something? I do need to unlink and free =/

@dginev
Copy link
Member

dginev commented Nov 27, 2017

You should make sure the Node drops correctly. The moment Rust has it out of scope the drop method should run and free the underlying libxml structure.

@dginev
Copy link
Member

dginev commented Nov 27, 2017

I'll close the PR for now if you don't mind, just to avoid merging it broken by mistake. Feel free to reopen / make a new one.

@dginev dginev closed this Nov 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants