-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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 happening while using registerModule/unregisterModule. #1507
Comments
Closure function at https://github.com/vuejs/vuex/blob/dev/src/store.js#L259 is retaining environment which contains oldVm reference. |
Possibly related. We are seeing a memory leak in a mutation:
This seems to help the leak.
Still working on a succinct reproducible case. |
@tehnorm can you share sample state declaration and sample measurement object? |
@ktsn what about the last one comment? |
finally resolved by #1546 |
Version
3.1.0
Reproduction link
https://jsfiddle.net/mrj8spu0/
Steps to reproduce
What is expected?
Heap memory generated on step 3 & 5 must be cleared after step 6. (Final stage)
What is actually happening?
Heap memory of the browser is not getting cleared.
We are observing memory leak of Store._vm while using registerModule/unregisterModule extensively.
On heap profiling we found that the oldVm instance is not getting garbage collected.
Probable Solution:
De-reference the oldVm instance on the same function scope where its getting instantiated (i.e. resetStoreVM() )
The above can be achieved by adding following code inside resetStoreVM function.
oldVm.$destroy();
oldVm = null; // This is the missing code
Attached google chrome (V 72.0.3626.96) heap snapshot and file.
Heap-20190213T220212.heaptimeline.zip
The text was updated successfully, but these errors were encountered: