Skip to content

Memory leaks when switching routes #1111

@badpunman

Description

@badpunman

// Edit: Seems like this has something to do with trying to use the .vue files only. Using components defined in js is working fine..
// Yeah, what I wasn't mentioning was, is that I was running this on windows. Project works when building on linux. Either webpack or vuerouter is messing it up on windows. More likely webpack.

Greetings. I have been aching my head with this for a while.

I got a lot of memory leaks in my bigger project, so I tried getting rid of all the extra libraries and come to conclusion that there has to be something wrong with either vue-router, vue itself or webpack. Vue-router seems most likely candidate right now.

I'm running vue-router in vuejs-template's webpack-template, with hot-reload dev-build (Problem also applies to the distrubtion build). I am using .vue standalone files.

I have two separate routes. I have buttons in main vue instance for switching between the routes in addition to the router-view component.

I have some very basic rudimentary elements and components inside these views.

Using chrome's profiler, I use heap snapshots and filter these snapshots for "Vue*" classes.

Every time I switch between routes, new VueComponents and Vue$3 objects get added to the heap. Existing ones don't seem to be removed. These never seem to be garbage collected.

Any idea what's going on here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions