• 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
NSXMLParser memory consumption
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSXMLParser memory consumption


  • Subject: NSXMLParser memory consumption
  • From: George King <email@hidden>
  • Date: Sat, 4 Apr 2009 09:02:29 -0700

Hi List,

I hit a stumbling block when passing large files (multi-GB) to NSXMLParser. It appears that NSXMLParser's initWithContentsOfURL: method loads the contents of the entire file into memory, which is causing virtual memory thrashing for at file sizes approaching my physical RAM (2 GB in this case, so I start seeing performance issues at around 1.3 GB). After reading the CFXMLParser documentation, I suspect that core foundation does the same thing.

Can somebody suggest an alternative API for parsing xml that does not have memory requirements linear with file size for the initialization? Given the event-driven design I originally imagined that the parser would read through a file incrementally, without loading it all into memory.

Also, would it be appropriate to file a bug / enhancement request for this issue?

Note that once the NSXMLParser delegate starts receiving messages, I am able to keep memory usage under control by giving the delegate its own autorelease pool and draining/replacing it once every x calls to parser:didStartElement....

I started looking into libxml2 but then thought I'd ask here first. Any suggestions would be much appreciated. Thanks!

George
_______________________________________________

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: NSXMLParser memory consumption
      • From: Marcel Weiher <email@hidden>
  • Prev by Date: Re: Error: mutating method sent to immutable object
  • Next by Date: Re: Non-pageable app
  • Previous by thread: How can I get data from a javascript function in a WebView into the enclosing Cocoa App?
  • Next by thread: Re: NSXMLParser memory consumption
  • Index(es):
    • Date
    • Thread