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: makeDraggable memory leak #3624

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

wfk007
Copy link
Contributor

@wfk007 wfk007 commented Apr 3, 2024

Short description

makeDraggable has memory leak in renderer and plugins(envelope and regions)

Implementation details

Using subscriptions to collect the return function of makeDraggable and unsubscribe it when destroyed or moved.

How to test it

  1. git clone https://github.com/wfk007/test-wavesurfer
  2. pnpm install
  3. pnpm run dev
  4. visit http://localhost:8000/docs
  5. open performance in devtools
  6. GC manually and start a new record
  7. toggle between Docs and test dragToSeek option many times
  8. stopped at Docs page, GC manually and stop the record

Screenshots

before
image

after
image

Checklist

  • This PR is covered by e2e tests
  • It introduces no breaking API changes
Copy link
Owner

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

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

Oh, thank you, good catch!
It's a very recent regression introduced in #3616 where makeDraggable started subscribing to document events, before it was done inside a pointerdown event on the draggable element itself.

@katspaugh katspaugh merged commit f023a72 into katspaugh:main Apr 3, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants