-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
[bug] Memory leak with this.$router.apps array and secondary apps on page being destroyed #2639
Closed
tmorehouse opened this issue
Mar 5, 2019
· 1 comment
· Fixed by #2706, mariazevedo88/hash-generator-js#5, tghelere/valorize-vidas#4, tghelere/DeliVuery#18 or tghelere/dailymages#2
Closed
[bug] Memory leak with this.$router.apps array and secondary apps on page being destroyed #2639
tmorehouse opened this issue
Mar 5, 2019
· 1 comment
· Fixed by #2706, mariazevedo88/hash-generator-js#5, tghelere/valorize-vidas#4, tghelere/DeliVuery#18 or tghelere/dailymages#2
Labels
Comments
In this section: Lines 83 to 96 in bd41be0
At line 94 (inside the app.$once('hook:destroyed', () => {
// Clean out destroyed app from this.apps array
const index = this.apps.indexOf(app)
if (index > -1) this.apps.splice(index, 1)
}) Which would remove the app from the |
tmorehouse
added a commit
to tmorehouse/vue-router
that referenced
this issue
Mar 5, 2019
…ixes vuejs#2639) Prevent destroyed apps from causing memory leak in `$router.apps` array. Fixes vuejs#2639
tmorehouse
changed the title
Memory leak with this.$router.apps array and mini apps on page being destroyed
[bug] Memory leak with this.$router.apps array and secondary apps on page being destroyed
Mar 5, 2019
posva
added a commit
that referenced
this issue
Apr 12, 2019
This was referenced Aug 29, 2019
This was referenced Oct 26, 2019
This was referenced Jan 20, 2020
This was referenced Feb 5, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
3.0.2 (and earlier)
Reproduction link
https://bootstrap-vue.js.org/play/
See next steps to easily reproduce the issue.
Steps to reproduce
Just go to https://bootstrap-vue.js.org/play/
And enter the following code in the HTML Template area:
and just enter
{ }
into the JavaScript area (or leave it as is)Hit space / delete the space every second or so in either the HTML entry area, or the javascript entry area (there is a 0.75 second debouncer on the app creation/destroy on keypress).
Each time, the rendered app will be destroyed and recreated.
The app shows a mapped version of
$router.apps
array (in the results section)You will see the array grow and grow and grow, with all these
destroyed
instances sticking around.It looks like vue-router isn't cleaning out
$router.apps
array during the destroy hook of the app. (`hook:destroyed').What is expected?
That the apps that have been
$destroyed
would be removed from the$router.apps
arrayWhat is actually happening?
The destroyed app references remain in the
$router.apps
array, causing memory usage to grow/leak.I've noticed a memory leak with
this.$router.apps
array. It might be related (but not sure) to other memory leaks reported.On a docs site we have, we have a playground that allows you to create and test mini apps in real time.
As the user edits the test app, it destroys (app.$destroy()), and then re compiles and mounts the new version.
Each time the playground app is created, it gets appended to the
this.$router.apps
array, while the destroyed app still remains in the array (albeit it has a destroyed instance, but there is still quite a bit of stuff in the reference).The playground is running under Nuxt.js, and each test in the playground is created as a new app (with a reference to the main $router instance).
We are adding in a temporary fix that will scan the
$router.apps
array, and slice out the destroyed app reference.The text was updated successfully, but these errors were encountered: