【发布时间】:2011-12-16 07:01:14
【问题描述】:
代码:
- (void) foo : (NSString*) ori_string
{
her_string = [ori_string copy];
while ([her_string length]>0)
{
her_string = [her_string substringFromIndex:1];
//do something...
}
[her_string release]; //Here is the problem
}
大家好,
如果我像上面一样发布her_string,分析器会说it's an incorrect decrement of the reference count of an object that is not owned at this point by the caller。
否则我不释放它,它说它是一个潜在的内存泄漏。
我应该在哪里以及如何发布它?谢谢!
【问题讨论】:
标签: objective-c memory-management nsstring release-management