Memory issues when loading a document
Memory issues when loading a document
- Subject: Memory issues when loading a document
- From: Ulf Dunkel <email@hidden>
- Date: Tue, 23 Oct 2012 12:21:30 +0200
- Organization: invers Software & DSD.net
I wonder if this issue is created by our app or if it is inherent in Mac
OS X:
Our app creates documents which can contain various content per document
page, e.g. PDF files. Assume you have created a document with 64 pages,
each of them contains a full-page PDF content. The document file's
"weight" is about 1 GB when it is saved.
When users try to reload the document on a Mac with 4 GB RAM, it cannot
be opened, because of a lack of memory. Tracking the allocations with
Instruments, I can see strange things happen:
- The app itself consumes about 300 MB RAM.
- The document is loaded in several steps, where the first step
allocates the document size with -[NSData(NSData) initWithContentsOfFile:].
- Then the RAM for page content files (the PDFs) is allocated and the
relevant PDF is being loaded - but:
- The first PDF load process allocates additional RAM for the first PDF.
- The 2nd PDF allocates additional RAM for the 1st and 2nd PDF.
- The 3rd PDF allocates additional RAM for the 1.-3. PDF.
- Etc.
So this procedure sums up to about 3.5 GB RAM which of course is
followed by an exception.
On bigger machines, the additional RAM for the PDFs is deallocated after
the document has been loaded successfully.
Is this a wanted behavior of Mac OS X, or are we able to control how
much RAM is being allocated in the document load process?
---Ulf Dunkel
_______________________________________________
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