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: potential memory leak #3614

Merged
merged 1 commit into from
Mar 30, 2024

Conversation

wfk007
Copy link
Contributor

@wfk007 wfk007 commented Mar 29, 2024

Short description

After wavesurfer destroyed, the ready event will still emit, which will cause a memory leak in some cases such as invoking wavesurfer apis in setInterval callback.

Implementation details

Add abortController and signal, when wavesurfer destroyed, cancel the blob Fetcher and stop ready event emit.

How to test it

  1. git clone https://github.com/wfk007/test-wavesurfer
  2. pnpm install
  3. pnpm run dev
  4. toggle between Home and Docs and observe the performance in Chrome devtools
  5. a memory leak occurred

Screenshots

image 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.

Great catch! 🙏

@katspaugh katspaugh merged commit ffee323 into katspaugh:main Mar 30, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants