<legend id='et5zt'><style id='et5zt'><dir id='et5zt'><q id='et5zt'></q></dir></style></legend>

    <small id='et5zt'></small><noframes id='et5zt'>

    <i id='et5zt'><tr id='et5zt'><dt id='et5zt'><q id='et5zt'><span id='et5zt'><b id='et5zt'><form id='et5zt'><ins id='et5zt'></ins><ul id='et5zt'></ul><sub id='et5zt'></sub></form><legend id='et5zt'></legend><bdo id='et5zt'><pre id='et5zt'><center id='et5zt'></center></pre></bdo></b><th id='et5zt'></th></span></q></dt></tr></i><div id='et5zt'><tfoot id='et5zt'></tfoot><dl id='et5zt'><fieldset id='et5zt'></fieldset></dl></div>

      <bdo id='et5zt'></bdo><ul id='et5zt'></ul>

    <tfoot id='et5zt'></tfoot>

        为什么 ARC 在 popViewController 之后不释放内存

        时间:2023-06-10
        <tfoot id='nCVd2'></tfoot>

        • <legend id='nCVd2'><style id='nCVd2'><dir id='nCVd2'><q id='nCVd2'></q></dir></style></legend>

            • <bdo id='nCVd2'></bdo><ul id='nCVd2'></ul>
                <tbody id='nCVd2'></tbody>

                <small id='nCVd2'></small><noframes id='nCVd2'>

                1. <i id='nCVd2'><tr id='nCVd2'><dt id='nCVd2'><q id='nCVd2'><span id='nCVd2'><b id='nCVd2'><form id='nCVd2'><ins id='nCVd2'></ins><ul id='nCVd2'></ul><sub id='nCVd2'></sub></form><legend id='nCVd2'></legend><bdo id='nCVd2'><pre id='nCVd2'><center id='nCVd2'></center></pre></bdo></b><th id='nCVd2'></th></span></q></dt></tr></i><div id='nCVd2'><tfoot id='nCVd2'></tfoot><dl id='nCVd2'><fieldset id='nCVd2'></fieldset></dl></div>
                  本文介绍了为什么 ARC 在 popViewController 之后不释放内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在 UINavigationController 中推送和弹出 ViewController.

                  我正在跟踪我的应用程序的内存消耗.在推送新的 viewController 时,内存消耗逐渐增加,但是当我使用 [self.navigationController popViewControllerAnimated:NO]; 弹出同一个 ViewController 时,内存消耗并没有减少而是保持不变.p>

                  用户可以多次推送和弹出特定的viewController,这会导致应用程序在RAM中的高内存消耗.

                  我应该如何优化我的内存消耗?

                  解决方案

                  当您关闭视图控制器(或弹出它)时,如果您没有对它进行任何强指针,它将被释放(该控制器由导航控制器或呈现视图控制器,因此您在创建并推送或呈现它时通常不需要指向它的指针).

                  如果没有其他强指针会被释放

                  I'm pushing and popping ViewControllers in UINavigationController.

                  I'm tracking the memory consumption of my app. While pushing the new viewController the memory consumption is increasing gradually, but when I'm popping the same ViewController using [self.navigationController popViewControllerAnimated:NO]; the memory consumption does not decrease but the constant.

                  That particular viewController can be pushed and popped by user many times which can lead the high memory consumption of app in RAM.

                  What should I do to optimise my memory consumption?

                  解决方案

                  When you dismiss a view controller (or pop it), it will be deallocated if you didn't make any strong pointers to it (that controller is retained by the navigation controller, or the presenting view controller, so you usually don't need to have a pointer to it when you create it and push or present it).

                  It will be be released if there are no other strong pointers to it

                  这篇关于为什么 ARC 在 popViewController 之后不释放内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:调用 popViewControllerAnimated 两次 下一篇:我什么时候应该使用导航控制器?

                  相关文章

                2. <i id='FTYep'><tr id='FTYep'><dt id='FTYep'><q id='FTYep'><span id='FTYep'><b id='FTYep'><form id='FTYep'><ins id='FTYep'></ins><ul id='FTYep'></ul><sub id='FTYep'></sub></form><legend id='FTYep'></legend><bdo id='FTYep'><pre id='FTYep'><center id='FTYep'></center></pre></bdo></b><th id='FTYep'></th></span></q></dt></tr></i><div id='FTYep'><tfoot id='FTYep'></tfoot><dl id='FTYep'><fieldset id='FTYep'></fieldset></dl></div>

                    <legend id='FTYep'><style id='FTYep'><dir id='FTYep'><q id='FTYep'></q></dir></style></legend>
                    • <bdo id='FTYep'></bdo><ul id='FTYep'></ul>
                  1. <small id='FTYep'></small><noframes id='FTYep'>

                    <tfoot id='FTYep'></tfoot>