Dear all, I got another memory management problem. When an XML is received, it must be parsed using the below method. When a large number of XML is received, the receiver's memory is increased slowly. I tried to figure out where the memory leaks. I guess the method might cause this problem.
The NSArray, nodes, is created by xmlDoc. Since the method is not the owner, nodes should be released here. One value of the array must be returned. Does the value leak? The method below is correct? Thanks so much for your help! Best regards, Bing + (NSString *)read:(NSString *)xml Path:(NSString *)xPath { NSXMLDocument *xmlDoc = [[NSXMLDocument alloc] initWithXMLString:xml options:NSXMLDocumentTidyXML error:NULL]; NSArray *nodes = [xmlDoc nodesForXPath:xPath error:NULL]; [xmlDoc release]; if ([nodes count] > 0) { return [[nodes objectAtIndex:0] stringValue]; } else { return Constants.WWW.EMPTY_STRING; } } _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com