开发者

NSString memory leak [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago. 开发者_如何学编程
//opening DB
if(sqlite3_step(statement) == SQLITE_ROW)
    result = [NSString stringWithUTF8String:(char*)sqlite3_column_text(statement,0)];  //!
else
    result nil;
return result;
//close DB


This is actually not a memory leak. The NSString will be autoreleased, and the char* returned by sqlite3_column_text will be cleaned up by sqlite during the next step/reset/finalize call.


the string should be autoreleased by stringWithUTF8String, are you testing for memory leaks on the iPhone or on the simulator? Often the simulator code is just a touch buggier - try it on the device itself

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜