• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
xml object memory issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

xml object memory issue


  • Subject: xml object memory issue
  • From: XiaoGang Li <email@hidden>
  • Date: Fri, 30 Oct 2009 15:25:08 +0800

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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: xml object memory issue
      • From: Roland King <email@hidden>
  • Prev by Date: Re: Scripting Bridge running method passing an array
  • Next by Date: Re: xml object memory issue
  • Previous by thread: Re: Scripting Bridge running method passing an array
  • Next by thread: Re: xml object memory issue
  • Index(es):
    • Date
    • Thread