Vue-meta: Memory leak (fixed in v2.2.2)

Created on 30 Aug 2019  路  11Comments  路  Source: nuxt/vue-meta

Initial state of Route 1:
image
Navigation to route 2 -> back to route 1 -> force garbage collection (with vue-meta):
image
Navigation to route 2 -> back to route 1 -> force garbage collection (without vue-meta):
image

Components are never garbage collected, does vue-meta keep a ref of them somewhere?

bug

All 11 comments

Not that I am aware off. What does your app look like, can you share a small reproduction?

Hmm, actually I notice that indeed the VueComponent count keeps increasing with taking memory dumps of the example with vue-router.

--update--
That was not related, just not clearing an interval for the timer which is used. When I clear that interval the VueComponent count stays the same

vue-meta was mentioned in the Retainers view of a VueComponent, I removed it and then the memory leak disappeared. I can't help further for now because I switched to vue-head. I'll try to reproduce when I'll have more time.

Thanks for the report btw, this might actually be related to an issue in Vue.js. It took a while but I have tracked it down to a possible issue with programmatically adding destroyed hooks, see https://github.com/vuejs/vue/issues/10458

When I add the destroy hooks directly on the mixin then there isnt a memory leak. Unfortunately that means the destroyed hook will run for every component on the page. Might do that as workaround for the time being.

If you do that, then wouldn't that provoke the timer thrash which I saw in the related issue?

On 30 August 2019 16:21:53 BST, Pim notifications@github.com wrote:

Thanks for the report btw, this might actually be related to an issue
in Vue.js. It took a while but I have tracked it down to a possible
issue with programmatically adding destroyed hooks, see
https://github.com/vuejs/vue/issues/10458

When I add the destroy hooks directly on the mixin then there isnt a
memory leak. Unfortunately that means the destroyed hook will run for
every component on the page. Might do that as workaround for the time
being.

--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/nuxt/vue-meta/issues/442#issuecomment-526642431

Nah, would still check if the component has any metaInfo defined before adding those times (you can have a look at the src/shared/plugin.js file of the v1 branch)

I have released v2.2.2 with a workaround for the memory leak. Will keep this issue open until the Vue issue gets resolved

@pimlie the issue is still present even after upgrading to v.2.2.2

@AndrewBogdanovTSS Thanks but again, please provide proof through a reproduction!

Just spent half an hour searching for that needle and I cant reproduce it.

I retested with 2.2.2 and can confirm it's fixed.
@pimlie Feel free to close unless you want to leave it open until you find a better way to handle it

@frlinw Thanks for the confirmation.

Will keep this issue open for visibility, but have locked the conversation.

If someone has a reproduction of another memory leak in vue-meta, please create a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Remcoman picture Remcoman  路  9Comments

hurradieweltgehtunter picture hurradieweltgehtunter  路  4Comments

o-alexandrov picture o-alexandrov  路  5Comments

cr-lgl picture cr-lgl  路  8Comments

wilco-superbalist picture wilco-superbalist  路  4Comments