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

Improve memory efficiency by discarding references to objects immediately #14

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

frenzymadness
Copy link
Member

When "killing" or "removing" elements from a tree, it's important not to keep references to them in the lists where they're collected.

For more info see: https://bugs.launchpad.net/lxml/+bug/1889653

tests/utils.py Outdated Show resolved Hide resolved
tests/test_clean.py Outdated Show resolved Hide resolved
@frenzymadness frenzymadness force-pushed the fix_mem_leak branch 2 times, most recently from 0eef5dd to b03160f Compare August 28, 2024 11:36
…tely

When "killing" or "removing" elements from a tree, it's important
not to keep references to them in the lists where they're
collected.

Without this, the memory consumption was quadratic because the
tails in this case were combined into parents'/previous'
elements' tails and the original ones could not be removed as we
kept the references to the elements in the _kill and _remove lists.

For more info see: https://bugs.launchpad.net/lxml/+bug/1889653

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
@frenzymadness frenzymadness merged commit 89b2b3d into main Aug 29, 2024
9 checks passed
@frenzymadness frenzymadness deleted the fix_mem_leak branch August 29, 2024 08:59
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.

3 participants