English 中文(简体)
位于SiOS的视力控制器导航记忆
原标题:Memoryleak on navigation of viewcontroller in iOS5

我已经向另一个观察者导航,但当我多次进行导航时,我会发现记忆泄露,而我是在发现乌克兰SZombie时应用的,这表明“对_特权(LeakAgent)来说,任务不够”。 它是ARC(xcode 4.2,OS5)提供的。 请帮助......

我的法典在这里是:

self.locationMapDetail = [[LocationMapDetail alloc] init];  //14.3% Leak
self.locationMapDetail.objItem = [self.parsedItems objectAtIndex:selectedIndex]; //5.7% Leak       
[self.navigationController pushViewController:locationMapDetail animated:YES]; //80.3% Leak
self.locationMapDetail = nil;
self.locationMapDetail.objItem = nil;
最佳回答

你必须释放这些物体,然后才能使其失效。 类似于

[self.locationMapDetail release];
self.locationMapDetail = nil;

如果你不使用阿农研中心,你就应该为你分配的所有目标做事。

如果是强点人,即使你释放了物体,你可能无法有效地释放物体,或者只有在释放了强点人的所有参考资料时才能释放。 之所以发生这种情况,是因为有时目标可能更有力地提到已宣布的变量。

又 请提到你为创造你们的变量而正在采用的方法。 最好是根据DidLoad来制定。

问题回答

I have also faced the same issue, It took me almost 2 days to resolve the issue. Finally got the solution. Make sure that your profile scheme is in DEBUG mode instead of RELEASE. This will solve the issue.





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签