Repository navigation
Clear event listeners and timers before component unmounts - #3991
Conversation
✅ Deploy Preview for buefy-org ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
@Arooba-git thanks for identifying this problem and fixing it. @kikuomax and I will review these changes as soon as possible. Thanks again! |
| }, | ||
| beforeDestroy() { | ||
| this.pauseTimer() | ||
| clearInterval(this.timer) |
There was a problem hiding this comment.
@Arooba-git This is unnecessary, because pauseTimer clears this.timer. Please see
buefy/src/components/carousel/Carousel.vue
Lines 261 to 267 in 4db8e0f
@kikuomax Good that you pointed that out. Yes, actually we use Memlab to gauge heap size and memory leaks in applications. Memlab requires us to write a scenario file as mentioned in their documentation. I created a scenario file for this project as well. Sadly currently memlab has a limitation of a protocolTimeout error for some cases, this one falls into that. I have reported the issue, they are working to fix within this week. After that I will attach the memory footprint results before and after the leak fixes in this project. |
|
@Arooba-git What kind of scenario are you running? 1.4GB of heap usage by Buefy does not make sense to me. If just browsing Buefy docs used 1.4GB of heap, we should have gotten a lot of serious problem reports. |
|
@Arooba-git By the way, could you update your PR if my comments make sense to you? |
TBH It's a pretty normal scenario file that follows puppeteer syntax, similar to what I have been using for multiple other projects 🤔 . I have attached it here for reference: |
Sure, totally makes sense. I'll update it by today 👍 |
@Arooba-git Does the script suppose the Buefy docs app running at |
Yes, we need to first run the app and pass the URL to Memlab's script accordingly. In my case (when I created this script), the app was running on the said address. |
b488b55 to
36725d0
Compare
Updated 👍 |
|
@Arooba-git @wesdevpro I am going to merge this PR and close the conversation. Please update us in the new issue #3992. |
fix(lib): potential leak and call after unmount - `NumberInput` clears the timeout on unmount to make sure it is not called after unmount - `Sidebar` clears the timeout on unmount to make sure it is not called after unmount - `SliderThumb` removes listeners in case they might be left in overlooked edge cases fix(docs): dangling listeners - `TheNabver` and `Documentation` removes listeners on unmount
…y#3991) fix(lib): potential leak and call after unmount - `NumberInput` clears the timeout on unmount to make sure it is not called after unmount - `Sidebar` clears the timeout on unmount to make sure it is not called after unmount - `SliderThumb` removes listeners in case they might be left in overlooked edge cases fix(docs): dangling listeners - `TheNabver` and `Documentation` removes listeners on unmount chore: migrate to Vue 3 - Replaces `beforeDestroy` with `beforeUnmount`
…y#3991) fix(lib): potential leak and call after unmount - `NumberInput` clears the timeout on unmount to make sure it is not called after unmount - `Sidebar` clears the timeout on unmount to make sure it is not called after unmount - `SliderThumb` removes listeners in case they might be left in overlooked edge cases fix(docs): dangling listeners - `TheNabver` and `Documentation` removes listeners on unmount chore: migrate to Vue 3 - Replaces `beforeDestroy` with `beforeUnmount`

Hi 👋 , thank you for this library!
We found that some components used event listeners and timing events, but did not remove them before unmounting. This means an accumulation of listeners and timers each time a component is mounted, on top of the previous ones, leading to a memory leak. This PR fixes this issue :)