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

Memory leak, all event listeners not are automatically removed, and the browser leaves in the heap vue listeners #12445

Closed
JhonWeawer opened this issue Jan 26, 2022 · 7 comments

Comments

@JhonWeawer
Copy link

JhonWeawer commented Jan 26, 2022

Version

2.6.14

Browser

Version 97.0.4692.99 (Official Build) (64-bit) (Ubuntu)

Reproduction link

github.com

Steps to reproduce

  1. Call method $destroy for element with id='app'.
  2. Create Heap snapshot in browser .

Screenshot for steps:


1 step11111
2 step22222222

And we see heap not cleared from Vue components.

But if we remove @click="myMetd" from line 5. and uncomment the code on line 30 in which we ourselves add a click event on the button element, and on line 33 we remove this event listening, then we see that the memory in the browser has really cleared :) .

Screenshot with cleaned heap:
33333333

I also checked memory leaks for prod builds:
Screenshot of prod build result with Vue event @click heap size 4.6mb:
Screenshot from 2022-01-26 19-11-17
Screenshot of prod build result without Vue event @click but have addEventListener and removeEventListener heap size 1.8mb :
55555555555

What is expected?

VueComponents not exist in heap after destroy App.vue(this happens after manual removeEventListener)

What is actually happening?

VueComponents exist in heap after destroy App.vue (see memory heap size)


I saw a similar issue #5187 but the browser still doesn't remove the vue handlers.
Also in the documentation for 2.x vue, https://vuejs.org/v2/guide/events.html#Why-Listeners-in-HTML, the third point about the fact that vue does not remove event listeners is still faulty.

@caozhong1996
Copy link

I think it maybe the fix has been merged but it hasn't been released yet.
#10085

@JhonWeawer
Copy link
Author

JhonWeawer commented Feb 15, 2022 via email

@caozhong1996
Copy link

Honestly, I don't know, it depends on @yyx990803

@posva
Copy link
Member

posva commented Feb 15, 2022

Fixed but not released yet.

@posva posva closed this as completed Feb 15, 2022
@JhonWeawer
Copy link
Author

@posva when can we expect the release?

@leealso
Copy link

leealso commented Aug 31, 2022

@posva any ETA for this one?

@shyamzpassion
Copy link

shyamzpassion commented Oct 8, 2023

Can 2.6.15 be published for this issue with the below fix

#10085

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