嗨,所有我得到的内存泄漏与以下代码行。如何解决....
const char *value = (const char *)sqlite3_column_text(statement, i);
[result setObject:[NSString stringWithCString:value encoding:NSUTF8StringEncoding] forKey:columnName];
或
const char *value = (const char*)sqlite3_column_text(statement, i);
NSString *str_Value = [[NSString alloc] initWithFormat:@"%@",[NSString stringWithUTF8String:value]] ;
[result setObject:str_Value forKey:columnName];
[str_Value release];
如何消除这种泄漏。请帮忙......
答案 0 :(得分:0)
您需要对其进行无效检查;
if (value != null)
{
NSString *str_Value = [[NSString alloc] initWithFormat:@"%@",[NSString
stringWithUTF8String:value]] ;
[result setObject:str_Value forKey:columnName];
}