Re: - [NSBitmapImageRep tiffRepresentation] malloc error
Re: - [NSBitmapImageRep tiffRepresentation] malloc error
- Subject: Re: - [NSBitmapImageRep tiffRepresentation] malloc error
- From: Nick Zitzmann <email@hidden>
- Date: Fri, 12 Dec 2008 15:29:01 -0700
On Dec 12, 2008, at 1:50 PM, Thomas Clement wrote:
The image was 14340 x 14173 (8-bit RGB with no alpha).
Wow, that's pretty big...
Also I got these messages in the console:
kernel[0]: (default pager): [KERNEL]: no space in available paging
segments
malloc: *** mmap(size=1073741824) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Attempt to allocate 1073741824 bytes for NS/CFData failed
This message means that your app tried to allocate a gigabyte of
contiguous memory and failed, because there wasn't that much available
in your app's heap. This shouldn't be too surprising, actually. In
most 32-bit programs, even trying to allocate hundreds of megabytes of
contiguous RAM at once often fails due to memory fragmentation.
What approach should I take to handle large images?
Remember yesterday, when I said that you shouldn't ship a 64-bit-only
application unless you have a really good reason to do so? I think
you've found a really good reason to do so... With a 64-bit app, at
our current level of technology, you'll run out of hard disk space
long before you even come close to hitting the maximum VM size (16 EB
in theory, though probably in the terabytes in practice).
The only other solution is to try and use less RAM, and try to pre-
allocate as much as possible using NSZones to avoid fragmentation, but
that's probably just postponing the inevitable.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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