Skip to content
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

why not cut off the links between components such as $parent in 'destroy' function ? #12959

Open
gangan1996 opened this issue Feb 13, 2023 · 0 comments

Comments

@gangan1996
Copy link

What problem does this feature solve?

I found that vue component memory leaks can cause its parent components to leak. Is this caused by the use of $parent and $children links between parent and child components?

My demo is like this, a child component, a parent component, the child component contains some code that will cause a memory leak, the parent component only contains the child component, I found that the parent component will not be garbage collected.

I looked at the source code and found that when the component is destroyed, only the $children property of the component will be cleared and the $parent will not be cleared. Is it because of this reason that the parent component leaks?

In my scenario, I want to locate which component has a memory leak by finding those components that are destroyed but not garbage collected. However, due to the above problems, a large number of components leak, so it is impossible to accurately locate the generated memory leaking components.

So why not Vue break this link when destroying components to minimize the impact of leaks?

What does the proposed API look like?

setUnlinkComponent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant