仪器告诉我此代码中存在内存泄漏,但我似乎找不到it....any帮助?抱歉,或者是新手的问题。
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    int altoBufferCelda = 26;
    Mensaje *msg = (Mensaje *)[model.mensajes objectAtIndex:indexPath.row];
    CGSize txtSize = [msg.texto sizeWithFont:[UIFont systemFontOfSize:17.0f] constrainedToSize:CGSizeMake(222, 222)  lineBreakMode:UILineBreakModeTailTruncation];
    [alturasDinamicas setObject:[NSNumber numberWithFloat:(txtSize.height + altoBufferCelda)] forKey:[NSNumber numberWithInt:indexPath.row]];
    return txtSize.height + altoBufferCelda;     
}发布于 2009-11-07 23:29:38
我在你的代码中看不到任何内存泄漏。正如toast指出的那样,Instruments并不总是准确的。这主要是因为即使是来自Apple框架的代码也包含内存泄漏,Instruments也报告了这一点。
如果您使用的是XCode 3.2,您可以从Build菜单中选择Build and Analyze,这将扫描您的代码以查找编译器通常无法检测到的错误。这将向您显示由于忘记释放对象而导致的许多可能的内存泄漏。
https://stackoverflow.com/questions/1081026
复制相似问题