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

WebUI: Fix memory leak in context menus #22234

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

skomerko
Copy link
Contributor

@skomerko skomerko commented Feb 4, 2025

This PR fixes a memory leak in context menus. Previously, for some reason, each menu retained references to its target elements without utilizing them further. Since the targets property was accessible/reachable from the root (window object), these references persisted even after the elements were removed from the DOM, preventing them from being garbage collected.

It's easily reproducible - just add a decent amount of torrents, switch between categories multiple times, then capture heap/detached elements snapshot in the Memory tab (Chrome dev tools). The number of detached elements will continue to increase after each category switch and they won't be cleaned up.

more context

@xavier2k6 xavier2k6 added the WebUI WebUI-related issues/changes label Feb 5, 2025
@Pentaphon
Copy link

Going to 5.0.4?

@glassez glassez requested review from a team February 5, 2025 13:49
@Chocobo1 Chocobo1 added this to the 5.1 milestone Feb 7, 2025
@Chocobo1
Copy link
Member

Chocobo1 commented Feb 7, 2025

Going to 5.0.4?

Looks like this PR cannot be git cherry-pick to 5.0.x easily.

@skomerko
If you you want it in 5.0.x branch, you'll have to submit another PR and target v5_0_x branch. Or you could submit a commit to the backport PR: #22207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebUI WebUI-related issues/changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants