开发者

Iphone Leaks NSString

I have leaks in the following code :

NSString * string;
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)str{
   string = [NSString stringWithFormat:@"%@", str];
}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
  namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {

   NSString * value = [string开发者_高级运维 stringByReplacingOccurrencesOfString:@"\n" withString:@""];

}

But I don't understand what's the prob. Can you help me please? :s


Is the variable "string" always allocated from the autorelease pool? If not, then the first function could be suspect as "string", if it is already initialized with another string, is not released prior to the assignment. That would leak.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜