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 #2028

Open
ferferga opened this issue Jun 1, 2023 · 3 comments
Open

Memory leak #2028

ferferga opened this issue Jun 1, 2023 · 3 comments
Labels
bug Something isn't working confirmed This bug was reproduced successfully by multiple people help wanted Extra attention is needed

Comments

@ferferga
Copy link
Member

ferferga commented Jun 1, 2023

Description of the bug

There's a memory leak with DOM elements not being detached correctly in master when switching between pages, so long-running sessions of the client might make the browser consume a lot of memory.

I believe this is caused by a combination of Suspense (which is still beta) and Transition, as showcased in https://github.com/antfu/repro-vue-suspense-transition-memleak

I'm still trying to isolate all the dependencies as much as possible to triage where this is coming from exactly, since this might not be a Vue bug.

@ferferga ferferga added bug Something isn't working help wanted Extra attention is needed confirmed This bug was reproduced successfully by multiple people labels Jun 1, 2023
ferferga pushed a commit that referenced this issue Jul 12, 2023
* Fixes console errors outputted when exiting fullscreen
* Vuetify has a memory leak fix, possibly might fix/improve #2028
@ferferga
Copy link
Member Author

ferferga commented Oct 18, 2023

This comes with huge delay, but there have been a lot of advancements in this regard.

Though Vue still has many Suspense issues when combined with transitions, I'm almost sure the exact source of our leak is on Vuetify's side, since the antfu's repo was GC'ed correctly and many other complex demos with Suspense + Transition did too.

While profiling in our client, all the references pointed me to VBtn, which lead me to focus on Vuetify only. I posted this on Vuetify's Discord the 08/06/2023 (DD/MM/YYYY):

For context, I'm using Edge DevTools
  1. Open this: https://play.vuetifyjs.com/#eNqlUL1uwjAQfpWrF1qJxAOdUEB06wN0wwwhuVAX/8k2qSqUd6/tBBTCgsR29919P3fbM/kwJm9PSJak8CiNKD2umQIo2qw0JpWpqbTyJVdoByiBe6+gzXizYsTrw0EgI7CGTxRCQ0HTfLq+qQSvjlcCrODlQl3DV4/dUmN36x6RPlxBR6FD6yrLjQeH/tRn59Jo6+EMFhvooLFawizcO4vDoOo8XIOEldemFA7fonAvFUTInPQqmSxN/uO0Cs86Rz4bBo6RJSQkYkE99ox8e2/cktKqVoFWo+CtzRV6qoykm7BG7Ul5LjGrtdws8kX+Tmvu/BjO0clsb/WvQxtEGJmPbDxv/h6wGjaTw6J3GKBMlHsXLe6kafBr0WYWVY0W7aMXTWjjqyaju8uie8dUF/4tuDq6yasrl968vYR86uQkFpV20bCbk5QzOCcC2f0DuX8JMw==

  2. Open the performance monitor. See the DOM node count and note it.

  3. Toggle the button a few times using the toggle button.

  4. Run GC by going to the memory tab and clicking the trashcan icon.
    Expected: DOM node count matches the amount noted in 2.
    Happens: There are more nodes

  5. In memory profiling you'll find detached elements, when you shouldn't

(You should refresh the tab and run GC again every time you perform a change in the template and want so there are no external "variables" that could affect the results of the test. A tab refresh should always render the same amount of nodes regardless, in my case it's consistently 860)

Repeat this with this raw vue: https://play.vuejs.org/#eNo9jTEOwjAMRa9ishQGiLqiFMHGAZBYskBw24g0jlKnS9W7kxKpm7/03vMsbiGcpoTiLNRoog0MI3IKF+3tECgyzBCxhQXaSANUGa20196QHxmYus4hNCuy55jwoL2SpZMLeTAOwb0Y8wJQ78RMHq7GWfNttNj8Xbm0+HMAjzJXRxapBPoapqNtNzULd3SO4EnRfXZK9nUGldzeiuUHZbxN9A==
DOM nodes will always go down to the original value after GC

You could even reproduce the same behaviour with swiper demos, which all are GCed correctly: https://swiperjs.com/demos

I didn't open an issue in their repo yet since I still didn't have conclusive results.

@ferferga
Copy link
Member Author

#2201 Really improved the situation, since the items store couldn't be garbaged collected properly. However, there are still some leaks in the full music player's swiper and the draggable queue (although they are minor and probably affects less users).

@ferferga ferferga pinned this issue Jan 10, 2024
@ferferga
Copy link
Member Author

For future reference, as of v3.4.11 Vuetify has been fixing memory leak issues since v3.4.6.

v3.4.5:

v3.4.6:

v3.4.8:

v3.4.11:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed This bug was reproduced successfully by multiple people help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant