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

Why isn't Nodes and Listener removed when switching route? #5839

Closed
RyotaTanaka opened this issue Jun 7, 2017 · 9 comments
Closed

Why isn't Nodes and Listener removed when switching route? #5839

RyotaTanaka opened this issue Jun 7, 2017 · 9 comments

Comments

@RyotaTanaka
Copy link

Version

2.3.3

Reproduction link

https://forum.vuejs.org/t/why-isnt-nodes-and-listener-removed-when-switching-route/11637

Steps to reproduce

Destroy Vue components or Dom by a method as using vue-router or simple v-if.

What is expected?

JS Heap memories don't increase by destroying Vue components.

What is actually happening?

JS Heap memories increase when creating new Vue components.


I contributed same topic to vue's official forum but I couldn't obtain a valid answer.
So please let me question again.

VNodes and Listeners remain when Dom destroyed and JS Heap memories increase.

For more information. Please access link I posted.

Sorry for double contribution.
Please reply if you know anything.

@Simonalia
Copy link

Simonalia commented Jun 7, 2017

I think I have the similar problem as you.
There are two pages A and B, and both listen a event through event BUS. When I switch A to B by vue-router and trigger the event, page A also response the event. As if component has been destroyed after switching router, but the listener is still there.

@LinusBorg
Copy link
Member

LinusBorg commented Jun 7, 2017

@Simonalia That's probably unrelated to OP's problem. You likely forgot to use $off() to unregister your Event Bus listener in the component's beforeDestroy() hook. Vue doesn'T do that for you when you use an event bus.

If you have further questions, please ask them on forum.vuejs.org. This issue here should focus on OP's problem.

@Simonalia
Copy link

Yeah, I got it. Thank you. @LinusBorg

@yyx990803
Copy link
Member

Thanks, looks like there's indeed some memory leak going on, I've identified the source and working on a fix.

@RyotaTanaka
Copy link
Author

@yyx990803 Thank you very much for your help!

@yyx990803
Copy link
Member

This is out in 2.3.4

@kosmos
Copy link

kosmos commented May 17, 2018

I have same issue with 2.5.16 version.

Here example: https://jsfiddle.net/vjkosmos/hbbb28ky/

If you will fast clicking on button you can see in chrome de tools Performance monitor are not Nodes and Listener removed.

@LinusBorg
Copy link
Member

Commenting on a -year old, closed issue will hardly be noticed. Please file a real bug report.

@kosmos
Copy link

kosmos commented May 17, 2018

Already did it.
#8195

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

No branches or pull requests

5 participants