【发布时间】:2018-11-23 17:55:38
【问题描述】:
复制到这里:https://github.com/NativeScript/NativeScript/issues/6607
堆栈:
tns 5
角度 7
演示库:
https://github.com/reposooo/ns-out-of-memory
基于 ns3 中的类似问题:https://github.com/NativeScript/NativeScript/issues/4490
重现步骤(与 AOT 的结果相同):
tns 运行 ios
- 在 Xcode 中打开内存报告
- 点击示例循环 2-4 次
- 点击循环 10 倍
【问题讨论】:
-
您确认
ngOnInit只被调用过一次吗?在我看来,每次您再次显示该屏幕时都应该调用它,这会创建越来越多的订阅者,每个订阅者都强烈引用this而不是使用WeakRef。 -
它已经在上面的问题中回答了。 - github.com/NativeScript/NativeScript/issues/6607
标签: angular nativescript angular2-nativescript angular7 nativescript-angular