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 on route navigation #15239
Comments
@danielroe Just to make sure, this seem like its not limited to the docs (since you added the docs label) and common behaviour |
@warflash Can you identify any commonalities between your site and the docs? (Are you using Nuxt content, for example?) Are you able to provide a minimal reproduction? |
Hey @danielroe we are using content indeed, so I tried removing it and the issue persisted. |
Oh and same issue on nuxt hackernews, which again, not the most minimal but just goes to show it seems like a really common issue. Swap between https://hn.nuxt.space/news/1 and https://hn.nuxt.space/newest/1 and slowly see the memory rise and keep allocated after GC's. Also verified same nuxt HN behaviour on firefox |
Would you try adding the following to your export default defineNuxtConfig({
app: {
pageTransition: false,
layoutTransition: false,
},
}) |
Unfortunately that doesnt seem to help, also tried with a local clone of nuxt movies and didn't reduce the issue there either |
@warflash Are you sure? I've been trying with Nuxt Movies locally and it greatly reduces the issue. (Note that you'll almost certainly need to build + run it in production mode to confirm.) |
Oh ok, I just tested in dev mode as the behaviour there was the same as in prod. Will recheck with a built project |
I often regret interim updates, but - 🤷 - my current hypothesis is that this is an issue with Having entirely disabled <template>
<div>
<RouterView v-slot="{ Component }">
<template v-if="Component">
<Transition mode="out-in">
<Suspense>
<component :is="Component" />
</Suspense>
</Transition>
</template>
</RouterView>
</div>
</template> https://vuejs.org/guide/built-ins/suspense.html#combining-with-other-components Removing The next step is likely to attempt to reproduce using Vue without Nuxt to confirm my hypothesis. Possible causes I've ruled out:
|
Baby's up from his nap, so I'll have to come back to this later. If you get a chance, would you try to replicate with https://github.com/nuxt-contrib/vue3-ssr-starter? It'll be tricky as it's so much smaller a project, but 🤷♂️ |
Gotcha, got a pretty tight schedule today unfortunately but should I get to it I'll post it here. Enjoy family time and the rest of your sunday! |
I believe I have a similar memory leak I have created this reproduction with nuxt 3.7.4
Screenshot after navigating to/from page, after GCTested for production build in Chrome without vue devtools plugin Memory inspector in Chrome points to context in function xu(e, t) {
// context t is pointing around here
const n = (r) => {
if (!r._vts) r._vts = Date.now();
else if (r._vts <= n.attached) return;
Me(Pu(r, n.value), t, 5, [r]);
};
return (n.value = e), (n.attached = Tu()), n;
} It seems to be retaining something in createInvoker() The issue is probably somewhere in vue, and probably due to using Also, sometimes after leaving a tab a few minutes running, some of the ram allocated for |
We are also struggling with terrible memory leaks. Discord Thread: |
Environment
Linux
v16.14.2
3.0.0-rc.12
0.6.0
npm@7.17.0
vite
-
-
-
Reproduction
https://v3.nuxtjs.org/getting-started/introduction
Describe the bug
repeatedly switch tabs from e.g.
get started
toguide
and watch the memory increase.Fresh load
After 30 swaps
Additional context
For bigger pages this results in 100s of leaked MBs within only a handful of route changes which in turn makes switching routes take seconds and is really bad user experience.
Logs
No response
The text was updated successfully, but these errors were encountered: