Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Memory leak in vue-i18next #78

Open
callumacrae opened this issue Oct 29, 2019 · 2 comments
Open

Memory leak in vue-i18next #78

callumacrae opened this issue Oct 29, 2019 · 2 comments

Comments

@callumacrae
Copy link

Hey!

Have spent today tracking down a memory leak in our app, and figured out it's somewhere inside vue-i18next.

On projects with a lot of translations, it's a pretty significant leak. It also seems to keep the entire Vue instance alive.

After creating 1000 vue instances and throwing them away, this is what happens:

image

(look for everything with "1000" written in "New")

In theory, they should have been cleaned up by the garbage collector, but something is keeping them alive.

Here's a repository you can replicate the problem in: https://github.com/callumacrae/vue-i18next-leak

It's definitely vue-i18next, not i18next.

@callumacrae
Copy link
Author

Oh, and to explain why this is an issue: on a standard project, this isn't an issue, but on projects with server-side rendering this causes the memory usage on the server to increase every time a request is made until the server crashes.

@callumacrae
Copy link
Author

Alright, I've found the leak:

https://github.com/panter/vue-i18next/blob/master/src/i18n.js#L18-L23

Passing undefined to bindI18n and bindStore on the server seems to work around the issue.

Would be nice if there were a better way, though!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant