NSString 的 IOS 内存泄漏
我有下面的代码,泄漏应用程序说 100% 的泄漏来自这行代码。
const unsigned char *value = sqlite3_column_text(statement, number);
if(value)
return [NSString stringWithUTF8String:(char *)value]; //100%
return nil;
有人可以提供一些有关如何解决此问题的见解吗?
I have this code below and the leaks application is saying 100% of the leak is from this line of code.
const unsigned char *value = sqlite3_column_text(statement, number);
if(value)
return [NSString stringWithUTF8String:(char *)value]; //100%
return nil;
Can someone offer some insight on how to fix this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这并不意味着泄漏就在那里,伙计。
It doesn't mean the leak is there mate.
它显示了泄漏块的分配位置,现在您需要找到保留它并且不释放它的位置。例如,如果将其分配给保留属性,则需要添加 [; release] 在包含该属性的类的 dealloc 方法中。
It shows where the leaked block was allocated, now you need to find where you retain it and don't release. For example, if you assign it to a retaining property, you'll need to add [<propertyname> release] in the dealloc method for the class that contains the property.