destroy() 方法是否释放页面内存?

Does destroy() method deallocate the memory of page?

我正在使用 destroy() 方法如下:

onPopTransitionEnded: {
       page.destroy();
   }

我的问题是这个 destroy() 方法是否释放页面及其子页面占用的所有内存?

Page{
content:
Container{
ImageView{
//properties
}
}
}

destroy() 方法会破坏页面 content 属性 中的所有内容吗?

问这个问题的原因是,当我使用 QNX 内存分析器观察内存时。我看不到内存使用量的减少。我还在设备监视器中观察了应用程序的内存使用情况,当我导航到下一页时,它显示内存使用量增加但是当页面被销毁时 onPopTransitionEnded 内存使用量没有下降。

请告诉我是否有任何工具可以帮助我观察内存使用情况。或任何可能对我有帮助的文档。:Helpsmilie:

首先 - 是的,"detroy()" 也会销毁页面的所有隐式和显式子项,但不会 instantly:

Note that it is safe to call destroy() on an object within that object. Objects are not destroyed the instant destroy() is called, but are cleaned up sometime between the end of that script block and the next frame (unless you specified a non-zero delay).

您可以使用 Component.onDestroyed() 附加信号来确保对象已被删除。

似乎可以稍后在达到内存阈值时释放内存。您可以尝试通过创建和删除大量对象并观察内存使用情况来对其进行测试。