Skip to content

vue2.7 keep-alive removed component no memory free #12827

@mjsong07

Description

@mjsong07

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy