The piece of code I want to discuss is followed: #import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
for(int i=0;i<5000;i++) { NSURL *inAbsoluteURL = [[[NSURL alloc] initFileURLWithPath:@"the path to one xml file"] autorelease]; NSError *error = NULL; NSXMLDocument *xmlDocument = [[NSXMLDocument alloc] initWithContentsOfURL:(NSURL*)inAbsoluteURL options:0 error:&error]; //hande my Xpath, and do check work. will not cosume the memory. [xmlDocument release]; } [pool drain]; return 0; } I used the Instruments to detect the objects created but still live until the application quit, I also use top command to check the memory usage. I found a lot of node, element, and other children object still live after the xmlDocument do release. I found that the memory usage of this application is increasing rapidly. Can any one give me a guilde to force the system to dealloc the memory during the for loop. I need to batch handle a lot of xml files. But after the application runs for a while, the system will crash because of no memory. _______________________________________________ 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