-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix GC problem #2797
base: master
Are you sure you want to change the base?
Fix GC problem #2797
Conversation
during page navigation, for some reason the page and component instance is not released re #2712
}); | ||
this._watcher.cleanupDeps(); | ||
this._watcher.teardown(); | ||
this._watchers.forEach(item => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this._watchers.slice().forEach
,因为 teardown 会从 _watchers 里把自身删掉
let lifecycle = getLifecycycle(WEAPP_COMPONENT_LIFECYCLE, rel, 'component'); | ||
output.detached = function(...args) { | ||
let vm = this.$wepy; | ||
vm.$destroy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个应该在 callUserMethod(vm, vm.$options, 'detached', args); 之后执行吧
this.$children.forEach(child => { | ||
if (!child._detached) { | ||
child.$destroy(); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是不是没必要,组件自己也是会调用 detached 进行析构的
delete this._data.__ob__; | ||
delete this._data; | ||
delete this._watcher; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这几个应该都不用删。测了下,删这几个
delete this.$parent; delete this.$root; delete this.$wx.$wepy;
Checklist
npm run test
passes