Vue multi-page application. Memory is not freed after page switching.

Project Framework:

vuejs+iview
each page is a library that references vuejs directly, and a new vue instance is new

due to project reasons

cannot use webpack and vue-router to make a single page application . (for the time being) the browser environment is all IE browsers,

problem recurring

I use the memory monitoring tool provided by IE11 (shortcut key ctrl+shift+u) (or task-managed memory monitoring). I can find that
and even after the page is switched to an empty page, memory is not freed after the page is refreshed by switching or.

for example

the original memory is 100MB, which increases to 150MB after page operation, and the page jumps to an empty content page. The memory is still 150MB, or a little lower, but still larger than 100MB
.

want to ask

how to destroy all created vue instances and javascript objects after the page leaves or for refresh.

is there any way!
insufficient level, ask humbly for advice,

Mar.11,2021

< del > browser does not do back function? < / del >
this browser feature makes it almost impossible for the front end to block.
Communication ability is also part of the working ability. I think this is not a technical problem but a communication problem


the location of js memory leak is troublesome, because when it comes to garbage collection, most of the time, the released memory has not been reclaimed, and it will take some time to see the decrease in usage. It is recommended to use chrome's Allocation timeline to monitor more accurately.

clipboard.png

The advantage of

chrome is that suspicious memory can be located to accurate references, but it is generally difficult to find. I usually cycle many times in a row (dozens of times) to determine whether there is a memory leak. If so, I can focus on whether DOM objects and events are handled correctly. General js objects will not have a problem, because garbage is automatically collected, and js variables that are no longer used are usually automatically recycled.

Menu