vuejs / vuex

🗃️ Centralized State Management for Vue.js.
https://vuex.vuejs.org
MIT License
28.4k stars 9.57k forks source link

Memory increase: Update from 4.0.2 to 4.1.0 #2236

Open fallemand opened 1 year ago

fallemand commented 1 year ago

Version

4.1.0

Describe the bug

After upgrading from Vuex 4.0.2 to 4.1.0, our apps started skyrocketing in memory consumption until running out of memory.

image

The apps recovered just after the rollback was deployed, and we tried two times to be sure.

Reproduction

Expected behavior

Memory levels should remain the same.

Additional context

No response

Validations

zcrumbo commented 9 months ago

For what it's worth, I've also seen a memory leak for an SSR'd Vue app after moving from 4.0.2 to 4.1. Reverting solved the issue. The heap dump indicated the store was getting persisted in memory for every page render, leading to a very fast OOM crash on the deployed container.

zcrumbo commented 9 months ago

It seems like this change is what is responsible - the closure seems to be retained on the SSR process https://github.com/vuejs/vuex/blob/d56222431b91e1927459f7f463e74bb43158ef2b/src/store-util.js#L40-L58