Skip to content

Memory leak while simply changing routes #10002

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

Closed
ricardo-lobo opened this issue May 9, 2019 · 1 comment
Closed

Memory leak while simply changing routes #10002

ricardo-lobo opened this issue May 9, 2019 · 1 comment

Comments

@ricardo-lobo
Copy link

Version

2.6.10

Reproduction link

https://codesandbox.io/s/o5znmm1lnq

Steps to reproduce

  • Start a new vuejs project with vue-cli
  • Add vue-router
  • Add an input with v-model
  • Type something in the input
  • Change route

Chrome dev tools snapshots screens follows:

Base line snapshot
Image of 1

Snapshot while just switching routes
Image of 2

Snapshot after typing in the input
Image of 3

Another snapshot after typing in the input
Image of 4

Another snapshot after typing in the input
Image of 5

We can find all the old "about" components in the memory with the respective data along with it
Image of 6
Image of 7
Image of 8

The memory increase is noticeable when the component is "big"

What is expected?

Its expected to have the vue components correctly garbage collected.

What is actually happening?

Everytime we switch routes after typing something in the input, the vue components count increases by 2 (in the linked example) with the older components remaining in memory with the state attached.

Although this doesn't seem to have a big impact, with complex applications, this can blow up rapidly while increasing memory until the browser tab crashes.


In our internal app, every time we switch routes, the memory increase is about 20 megabytes. The components left in memory have big data attached.

@posva
Copy link
Member

posva commented May 9, 2019

Closing in favour of #10004 with no router and an html repro

@posva posva closed this as completed May 9, 2019
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

2 participants