vue2.7 keep-alive removed component no memory free

This issue has been created since 2022-10-14.

Version

2.7.12

Reproduction link

github.com

Steps to reproduce

  1. npm install
  2. npm run serve
  3. Open the browser and input the http://localhost:8080/
  4. Click the add button to create a1-component.
  5. Click the add button to create a2-component.
  6. Click the add button to create a3-component.
  7. Click the add button to create a4-component .
  8. Click the a4-component delete button to remove a4-component

What is expected?

click the a4-component delete button ,I expected the usedJSHeapSize total is 250mb,but it didn't happen.

What is actually happening?

the usedJSHeapSize total still is about 330mb.


When you click the add button ,the usedJSHeapSize will increase about 80mb.
click four times ,the usedJSHeapSize total is about 330mb.
next click the a4-component delete button ,the usedJSHeapSize Should be reduce 80mb,expected is about 250mb.
but usedJSHeapSize total still is about 330mb.
you can view operating_steps.gif Steps to reproduce and view memory_analysis.gif to find the memory leak reason.
use the chrome memory tool and analysis report ,We can find The bug because
the a3-component.componentInstance.$vnode.parent.componentOptions.children[0] is a4-component.so the a4-component can not be Memory free.
If you can read chinese ,Open the link for https://juejin.cn/post/7153186266300252168

mjsong07 wrote this answer on 2022-10-15

Steps to reproduce
operating_steps

We can find The bug because
the a3-component.componentInstance.$vnode.parent.componentOptions.children[0] is a4-component.so the a4-component can not be Memory free.
memory_analysis

xztl wrote this answer on 2022-11-03

问题遇到+1

mjsong07 wrote this answer on 2022-11-23

问题遇到+1

看来遇到的人不多,只能换方案去解决了 keepalive的问题 >_<

xztl wrote this answer on 2022-11-23
vela666 wrote this answer on 2022-11-24

惊现 面试官

ning0825 wrote this answer on 2022-12-07

你好,问题解决了么~

More Details About Repo
Owner Name vuejs
Repo Name vue
Full Name vuejs/vue
Language TypeScript
Created Date 2013-07-29
Updated Date 2022-12-10
Star Count 201155
Watcher Count 6070
Fork Count 33134
Issue Count 595

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
"Dataset 'cloth_train' is not registered 3 2022-07-01 2022-11-03
Adicionar tributario 0 2021-03-20 2022-10-29
Add brasil.elpais.com 1 2021-04-12 2022-09-22
Bug: word is not only valid for variable chars 0 2020-12-26 2022-11-27
How to pass user defined metadata through the pipeline? 3 2022-09-27 2022-12-02
Systen.IO.IOException - The process cannot access the file 5 2021-03-01 2022-10-10
[PORTER] gcr.io/k8s-staging-gateway-api/admission-server:v0.5.1 2 2022-10-30 2022-11-09
[PORTER]gcr.io/ml-pipeline/frontend:2.0.0-alpha.3 2 2022-10-31 2022-11-09
[PORTER]gcr.io/ml-pipeline/visualization-server:2.0.0-alpha.3 2 2022-10-31 2022-11-09
Ultest not passing anything as parameters for rust 16 2022-02-07 2022-11-19
[Suggestion] Auto Drop Select Enchantents 0 2022-07-25 2022-09-22
[Request] Migrate to Issue forms 3 2022-03-14 2022-09-28
Atom/Variant which is just underscore is a Syntax Error 2 2021-04-18 2022-10-24
Proposal: exclude node_modules when generating tags 6 2018-12-10 2022-11-11
Unit for "Amount of times" 16 2020-10-14 2022-10-11
Adding Creators/Updaters to GoAlert objects(Service,EP,Schedule, Rotations) 1 2022-09-15 2022-11-19
[readcomiconline] (Feature Request) Quality options for extractor/configuration file 1 2022-04-03 2022-11-09
Tracker not caught 1 2021-03-23 2022-01-14
DispVM functionality is broken 15 2021-06-08 2022-11-12
AE2 seems to break in 0.14.6 1 2022-05-20 2022-11-22
Question: could this library support asymmetric encryption? 2 2021-02-15 2021-12-28
GUI for this wonder script. 1 2020-11-13 2022-12-08
User consent Override for Meshcentral Assistant (Always Connected) 3 2021-11-09 2022-10-06
numpy.select won't compile if the `choicelist` contains non-vector numbers 5 2021-10-07 2022-11-14
Error in `gradient` of custom `AbstractMatrix` subtypes 21 2022-01-10 2022-11-09
HDF5Plugins.jl: lz4, zstd, and bzip2 filter support 3 2021-10-31 2022-12-07
[prometheus-redis-exporter] support multiple targets 0 2022-06-28 2022-10-20
Wrassler Ability icons overlay ontop of other ability icons 2 2022-04-19 2022-09-25
Integrity constraint violation 1 2021-02-22 2022-12-02
Lost effects in subtitles after translation 5 2022-05-11 2022-11-03
Explorer Path Issue 1 2021-09-09 2022-01-08
Wrong keys for validator messages in multiple languages 2 2019-12-31 2022-11-12
Feature request: push insight events for quiet down mode, number of agents connected 3 2020-03-23 2022-11-20
Panels not showing up when scrolling fast on mobile device 2 2021-11-12 2022-12-05
mach: allow choosing Wayland/X11 at runtime via env var 4 2022-06-28 2022-10-26
Asciidoc Footnotes Fail When Using Preview 1 2020-04-10 2022-11-12
Why did my code show blank entries on Opensea? 0 2021-09-13 2022-10-08
"form" attribute in Select doesn't work with FormData 2 2022-05-24 2022-11-22
menuPlacement not working when changing menu style 1 2022-05-23 2022-11-22
An error message "Invalid path mode '\' in: No newline at end of file" pops up when for formatting document. 9 2021-10-12 2022-12-09
support mssql-jdbc 10.2 encrypt option for url 0 2022-04-19 2022-11-28
Minutes symbol should be `min` 2 2021-08-21 2022-11-30
[Question]: 在情感分析任务中,使用predict_sentence.py进行预测时,如何获取模型输出的每个类别的置信度 1 2022-11-09 2022-11-25
Files only generated in cache(?), not in source tree 4 2021-11-24 2022-12-02
`--prerelease-prefix` doesn't seem to do anything? 0 2021-07-12 2022-12-02
Create a separate RPM repository for CentOS 7 9 2021-12-16 2022-12-05
Is it possible to make the `type` field dynamic? 6 2021-10-13 2022-10-10
Cannot override `jwtTokenEnhancer` bean. 1 2020-03-28 2022-11-04
LibreOffice Impress (and Writer) crashing when inserting video file 0 2022-03-18 2022-12-04
Plugin crash bug report 1 2022-01-28 2022-10-28