Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode 我是否必须手动释放(使用ARC)目标视图控制器?_Xcode_Memory Management_Automatic Ref Counting - Fatal编程技术网

Xcode 我是否必须手动释放(使用ARC)目标视图控制器?

Xcode 我是否必须手动释放(使用ARC)目标视图控制器?,xcode,memory-management,automatic-ref-counting,Xcode,Memory Management,Automatic Ref Counting,在我的程序中,我经常需要手动设置目标视图控制器,以便用数据填充它。这工作得很好,但是当我在源控制器和目标控制器之间来回观看分析器时,我的分配急剧增加。我正在使用ARC。我知道这也可能是我在那个目的地设置东西的方式,但我也在想——当我回到源代码控制器时,我不需要去掉我设置的目的地控制器吗 -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { //Pull which topic the user clic

在我的程序中,我经常需要手动设置目标视图控制器,以便用数据填充它。这工作得很好,但是当我在源控制器和目标控制器之间来回观看分析器时,我的分配急剧增加。我正在使用ARC。我知道这也可能是我在那个目的地设置东西的方式,但我也在想——当我回到源代码控制器时,我不需要去掉我设置的目的地控制器吗

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    //Pull which topic the user clicked on from the table view
    NSIndexPath *myIndexPath = [self.myTableView2
                                indexPathForSelectedRow];
    NSArray * topicArray = [[myTopicLoader arrayOfFinishedCategories] objectAtIndex:myIndexPath.section];

    //Create a temporary NSObject Topic to send to the detail view controller
    //Set it to the Topic in the array based on which row the user clicked on
    //(The tableview was populated with the same array)
    topic *tempTopic = [topicArray objectAtIndex:myIndexPath.row];

    //If they clicked on one that has details to show and is purchased, load the detail view controller
    if ([segue.identifier isEqualToString:@"showTopicDetails"]) {
        //Set up a destination view controller
        topicDetailController *topicDetailController = [segue destinationViewController];

        //Set its topic to the temporary one we set up here
        topicDetailController.currentTopic = tempTopic;
    }else {
           //If they clicked on one that does not have details because it is not yet purchased, load
           //the purchase view controller instead
           purchaseDetailController *purchaseDetailController = [segue destinationViewController];

           //And set its topic to the temporary one we set up here.
           purchaseDetailController.currentTopic = tempTopic;


    }

}
我的大部分超额分配是:

29717 0xaa8a600 uu NSArrayM 00:28.703.069•32 UIKit u uitaprognizerCommoninit

1069 0x15d5e650 Malloc 32字节00:29.254.799•32 libsystem\u sim\u blocks.dylib\u Block\u copy\u internal


我猜这可能来自我正在使用的一些预构建的东西(一个图书控制器和谷歌的XML解析器)。但是我想检查一下,看看是否与目标控制器的不清除有关。

通常情况下,ARC应该处理释放,而您不应该有泄漏。这里需要明确的是,您是否可以提供更多关于您是如何分析的详细信息:您使用的是什么工具,该工具的哪些设置,以及您在该工具中查看的数据列,在您来回查看时,您会看到分配的增加?我使用的是分配工具,以及在按下视图控制器然后将其弹出的迭代之间设置堆快照。它每次增长大约3mb。顺便说一句——分配的很多东西都是UIKit项目,即UITextView。ARC应该摆脱这些吗?Autoreleasepooling也没有改变它。但是您看到哪一列的分配在增长:#生存的,#暂时的,#总体上?我在比较堆的快照以获得分配的新内存,但是当查看列视图时,生存在增长。