2011-09-26 47 views
0

Im关注Ray Wenderlich tutorial for instruments,但我不知道为什么profiling未显示泄漏的对象?文书xcode4不工作?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

NSString * sushiName = [_sushiTypes objectAtIndex:indexPath.row]; 
NSString * sushiString = [NSString stringWithFormat:@"%d: %@", indexPath.row, sushiName]; 

NSString * message = [NSString stringWithFormat:@"Last sushi: %@. Cur sushi: %@", _lastSushiSelected, sushiString]; 
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sushi Power!" 
                message:message 
                delegate:nil 
              cancelButtonTitle:nil 
              otherButtonTitles:@"OK", nil]; 
[alertView show]; 

//_lastSushiSelected = sushiString; //el que jode, pues lo pone en string deallocada, por strinWithFormat que usa autorelease! 
_lastSushiSelected = [sushiString retain]; 

//[alertView release]; 
} 

进出口使用的代码在本教程中,并且你可以看到alertView漏水!

但我运行它槽仪器泄漏,并没有出现! [也就是非常非常非常缓慢承认停止按钮被按下停止剖析!]

Leaks not detected

所以缺什么?,

非常感谢!

回答

1

坦率地说,我认为这是一个错误。希望它很快就会被修复(我使用的是v4.1),但并没有丢失。在“分配”工具下,您可以过滤显示哪些类型。在这个图像中,我告诉它显示UIAlertView实例。多次点击UITableView后,您可以看到它告诉我存在2个实例,这证实存在泄漏。

enter image description here

+0

我在xcode 4.2中有一些bug。一个我得到很多是程序变得没有反应,并继续运行;我最终使用强制退出。 – geminiCoder

+0

是的,我也在4.1中看到过。 – Martin

+0

和Xcode 3.x ...我已经习惯了创建类静态的习惯来计算totalNumberAllocated和remainingInstances以及一个宏,以便在dealloc方法中记录(或不),作为调试的函数级别我设置为编译开关。跟踪这些速度要快得多。 – YvesLeBorg