Vue-i18n: Possible memory leak

Created on 17 Jul 2018  路  9Comments  路  Source: kazupon/vue-i18n

vue & vue-i18n version

vue 2.5.16
vue-i18n 8.0.0

Reproduction Link


With vue-i18n https://codepen.io/anon/pen/ajZwZg
Without vue-i18n https://codepen.io/anon/pen/gjMgzG

Steps to reproduce

  • Open the codepen https://codepen.io/anon/pen/gjMgzG
  • Click a couple of times to list 0 item, then 1000
  • See the memory increasing
  • Try force GC (trash icon) before measure it
  • Take heap snapshots in Chrome "Memory" tab
  • Watch the memory usage in the Chome task manager (shift esc)
  • Watch the memory usage in OS task manager

What is Expected?

Same memory usage after garbage collector

What is actually happening?

Despite the "Performance" tab displays the same memory usage, the "Memory" heap snapshot displays a memory increase.
Also, the both Chrome and OS task managers show the memory only increasing.


It get worse when:

  • Using Vuei18n (even without translating)
  • Having big children components

Tested on:

  • Windows 7 64 Bits
  • Chrome 67.0.3396.99 64 bits

Please, consider that:

  • I may be doing something wrong
  • It can be a Chrome issue
  • It can be an OS issue

I also create an issue in https://github.com/vuejs/vue/issues/8507

Most helpful comment

I don't know if its related to this issue but I think I fixed one memory leak by refactoring the internal remove function since its only looking for the first element occuring in the array instead of looking for all elements. It happend quite often that my Components were registered multiple times.
Check it out here https://github.com/Tob0t/vue-i18n/commit/d538fd820b791c6797630a01d891197bede60ad2

Let me know if you need a pull request for that.

All 9 comments

Thank you for your reporting!
I'll try to check this issue now.
please wait.

Thank you a lot @kazupon .
It is hard to me to separate it from vue-i18n and vue, because I don't know much about the both core.

Please make sure you read my updated comment at https://github.com/vuejs/vue/issues/8507#issuecomment-405717057 .
And let me know if you need more information.

I can confirm the memory leak of Vue-i18n 7.4.2 (using Vue 2.5.3). I inspect this with Chrome inspect function on Node.js. I included Vue-i18n in my project without doing anything but got the memory increase everytime I ran the same set of requests. When I remove it from the project, things go on well.

Any update on this?

I don't know if its related to this issue but I think I fixed one memory leak by refactoring the internal remove function since its only looking for the first element occuring in the array instead of looking for all elements. It happend quite often that my Components were registered multiple times.
Check it out here https://github.com/Tob0t/vue-i18n/commit/d538fd820b791c6797630a01d891197bede60ad2

Let me know if you need a pull request for that.

I have the same problem: when using vue-i18n 8.7.0 and vue 2.5.21.
I can't find any quick fix to avoid this problem.

Sadly, I will have to remove vue-i18n of my project if this issue is not resolved ? (it's a commercial project with deadlines) Any news on this ?

For your information, it is vuejs mixin bug and it has been fixed in dev branch.
https://github.com/vuejs/vue-class-component/issues/291

I can confirm that my real case has been fixed after update all packages I was using. But I didn't test it to find out which package fixed it. I'll close the issue for now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SebastianS90 picture SebastianS90  路  15Comments

pzuopin picture pzuopin  路  31Comments

tvld picture tvld  路  19Comments

kazupon picture kazupon  路  19Comments

qiaochangwei picture qiaochangwei  路  16Comments