Vue: $destroy does remove allocated objects?

Created on 27 Dec 2016  ·  2Comments  ·  Source: vuejs/vue

Hi,
It seems to me that $destroy does not remove allocated objects (please correct me if I'm checking it incorrectly). I'm using Take Heap Snapshot in Google Chrome to take snapshot after the app is initialized (using new Vue) and then destroyed (using app.$destroy()). It seems that all the Vue components are still in the memory (when I compare snapshots Vue instances are not removed).

I know it has been mentioned that destroying objects manually is not the best practice but I'm working on Chrome Extension and I would like to be able to tear down the whole app.

Here is simple JSFiddle I'm using for testing.

Most helpful comment

You should also do app = null after you use $destroy since the global scope is still holding on to a reference to that object.

All 2 comments

You should also do app = null after you use $destroy since the global scope is still holding on to a reference to that object.

^ what @sirlancelot said

Was this page helpful?
0 / 5 - 0 ratings