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

Fix the event handler memory leak #3508

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

ealmloff
Copy link
Member

@ealmloff ealmloff commented Jan 7, 2025

The event handler into implementation uses the current owner which defaults to the current scope. That causes a memory leak when repeatedly creating new event handlers on the same scope. This PR fixes the issue by overriding the owner to the closure

Fixes #3421

@ealmloff ealmloff added bug Something isn't working html Related to the html crate labels Jan 7, 2025
@ealmloff ealmloff force-pushed the fix-event-handler-memory-leak branch from 055e2e9 to 2a33ab9 Compare January 7, 2025 16:27
@ealmloff ealmloff marked this pull request as draft January 7, 2025 16:29
@ealmloff ealmloff marked this pull request as ready for review January 7, 2025 16:41
Copy link
Member

@jkelleyrtp jkelleyrtp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be worthwhile to add child components to the memory leak test since we tend to get issues on that boundary. Otherwise looks good - but we should definitely find some time to clean up the owner stuff a bit more for the next breaking release.

@jkelleyrtp jkelleyrtp merged commit 19ca707 into DioxusLabs:main Jan 7, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working html Related to the html crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(Memory Leak): Event handlers are not dropped properly
2 participants