• 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
Re: - [NSBitmapImageRep tiffRepresentation] malloc error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: - [NSBitmapImageRep tiffRepresentation] malloc error


  • Subject: Re: - [NSBitmapImageRep tiffRepresentation] malloc error
  • From: Thomas Clement <email@hidden>
  • Date: Fri, 12 Dec 2008 21:50:55 +0100

On Dec 12, 2008, at 9:29 PM, David Duncan wrote:

On Dec 12, 2008, at 3:51 AM, Thomas Clement wrote:

I'm using NSBitmapImageRep to build a new image by doing some pixel processing (which unfortunately I can't do using Core Image).
Everything works great but with bigger sizes I'm getting a malloc error when calling - [NSBitmapImageRep tiffRepresentation] (error 12: Can't allocate memory). I'm using this method at the end of my processing to write the data to disk.


I guess I'm running out of memory and the allocation fails which is rather surprising since I have plenty of disk space for virtual memory.
How should I work around this problem?


How big are your images? You still only have 4GB of virtual address space (and less actual and contiguous space) so if your using a significant portion of it, then malloc()s for large chunks of memory (like a method such as -TIFFRepresentation might require) are likely to fail.

The image was 14340 x 14173 (8-bit RGB with no alpha).

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


What approach should I take to handle large images?


Thanks! Thomas

_______________________________________________

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: - [NSBitmapImageRep tiffRepresentation] malloc error
      • From: Nick Zitzmann <email@hidden>
    • Re: - [NSBitmapImageRep tiffRepresentation] malloc error
      • From: David Duncan <email@hidden>
References: 
 >- [NSBitmapImageRep tiffRepresentation] malloc error (From: Thomas Clement <email@hidden>)
 >Re: - [NSBitmapImageRep tiffRepresentation] malloc error (From: David Duncan <email@hidden>)

  • Prev by Date: NSBitmapImageRep orientation?
  • Next by Date: Re: NSBitmapImageRep orientation?
  • Previous by thread: Re: - [NSBitmapImageRep tiffRepresentation] malloc error
  • Next by thread: Re: - [NSBitmapImageRep tiffRepresentation] malloc error
  • Index(es):
    • Date
    • Thread