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

Fix GC problem #2797

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix GC problem #2797

wants to merge 2 commits into from

Conversation

Gcaufy
Copy link
Collaborator

@Gcaufy Gcaufy commented May 7, 2022

Checklist
  • npm run test passes
  • tests and/or benchmarks are included
  • cases or donate is changed or added
  • documentation is changed or added

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 => {
Copy link
Collaborator

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();
Copy link
Collaborator

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); 之后执行吧

Comment on lines +65 to +69
this.$children.forEach(child => {
if (!child._detached) {
child.$destroy();
}
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是不是没必要,组件自己也是会调用 detached 进行析构的

Comment on lines +79 to +81
delete this._data.__ob__;
delete this._data;
delete this._watcher;
Copy link
Collaborator

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;

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

Successfully merging this pull request may close these issues.

None yet

2 participants