从非根组件的路由跳转到根组件,有内存泄漏问题,组件已销毁,但DOM Nodes没有减少 #2409
Unanswered
Gcgetget
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Reproduction
从非根组件的路由跳转到根组件,有内存泄漏问题
Steps to reproduce the bug
在首面,通过路由跳转到table box组件,再从table box组件通过路由跳转到首页,手动进行垃圾回收,DOM Nodes并没有减少,说明存在内存泄漏问题。如下图演示:




路由跳转到table box组件:
在table box组件跳转到首页:
手动垃圾回收,DOM Nodes并没有减少
但是,在table box组件,点击首页的路由Go to home,则不会有内存泄漏


跳转后:
路由配置:




App.vue:
RouterNav.vue:
table box组件:
Expected behavior
从首页路由跳转到table box组件,再从table box组件通过路由跳转到首页,table box组件销毁,DOM Nodes应该下降
Actual behavior
从首页路由跳转到table box组件,再从table box组件通过路由跳转到首页,table box组件销毁,DOM Nodes没有下降,说明有内存泄漏风险
Additional information
"vue": "^3.4.29",
"vue-router": "^4.4.5"
Beta Was this translation helpful? Give feedback.
All reactions