Skip to content

fix: resolve memory leaks by detached elements and event listeners #1099

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

Merged
merged 1 commit into from
Mar 16, 2025

Conversation

sahilrajthapa
Copy link
Contributor

Describe your changes

Resolve memory leaks by removing event listeners on component unmount

  • Remove touch and wheel event listeners in DpCalendar component
  • Remove mousedown and pointerdown event listeners in DatepickerMenu component

Comparision of heap snapshots with this fix (left) and without this fix (right)

With passing :transitions="false"

Screenshot 2025-03-16 at 12 54 32 This fix reduces retained size to 0%.

Without passing :transitions="false"

Screenshot 2025-03-16 at 13 12 13 Even with the fix, there is still increase in retained size (as some elements are retained by transition). However, it still has less memory consumption compared to the situation without the fix.

Comparision of detached elements profile with this fix (left) and without this fix (right)

Screenshot 2025-03-16 at 13 14 33

Issue ticket number and link

Fixes #1083

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have ensured that unit tests pass without errors
  • If it is a new feature, I have added a new unit test

@Jasenkoo Jasenkoo merged commit a16c9ac into Vuepic:main Mar 16, 2025
2 checks passed
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.

Severe Memory Leak
2 participants