• 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: saving big image crashes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: saving big image crashes


  • Subject: Re: saving big image crashes
  • From: "John C. Randolph" <email@hidden>
  • Date: Wed, 24 Nov 2004 04:13:41 -0800

It sounds like you're running into the limitations of NSBitmapImageRep. You should file a bug on this, since we shouldn't crash just because an image is very large.

For an image this big, you'll need to do your own memory management for the image data. What I would do in this situation, is use an NSCustomImageRep, which will ask its delegate to draw portions of the image. Your custom image rep's delegate should handle the mapping of your raw data to its visual representation.

-jcr

On Nov 23, 2004, at 9:30 PM, 김경옥 wrote:


Hi,

I'm implementing a cocoa application in Obj-C for editing images.
Users can resize image in pixels using the application.

When I resize 450 x 300(pixels) image to 9000 x 9000 and save it with new size,
the new image is saved but the application crashes during reopening the resized image with a message as follows:
----------------------------------------------------------
*** malloc:vm_allocate(size=24307324) fail (error code=3)
*** malloc[874]: error:Can't allocate region
Executable "application" has exited due to signal 10 (SIGBUS).
----------------------------------------------------------
The point the application crashes is the line as follows:
aImage = [[NSImage alloc] initWithData:[newImage TIFFRepresentation]];



And when I resize the same image to 10000 x 10000 and save it with new size,
the application crashes during the new image is saved.


The program is abnoramlly exited at the line of code without any error code as follows:
TiffRef = [[NSBitmapImageRep alloc] initWithData:[temp_image TIFFRepresentation]];


the temp_image is resized image.

How can I solve momory problem with big images?
Any help is greatly appreciated.





John C. Randolph <email@hidden> (408) 974-8819 Sr. Cocoa Software Engineer, Apple Worldwide Developer Relations http://developer.apple.com/cocoa/index.html


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >saving big image crashes (From: 김경옥 <email@hidden>)

  • Prev by Date: Re: setNeedsRedrawInRect:
  • Next by Date: Resizing NSimage
  • Previous by thread: Re: saving big image crashes
  • Next by thread: Coding Standards For Objective C
  • Index(es):
    • Date
    • Thread