Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

varsis

macrumors regular
Original poster
Nov 30, 2005
209
1
Currently I am making a plugin for rapidweaver but I get this error when adding too many images to the Plugin:

RapidWeaver(19697,0xa000d000) malloc: *** vm_allocate(size=18051072) failed (error code=3)
RapidWeaver(19697,0xa000d000) malloc: *** error: can't allocate region
RapidWeaver(19697,0xa000d000) malloc: *** set a breakpoint in szone_error to debug
Dec 29 02:01:45 tommy-pavliceks-computer /Applications/RapidWeaver.app/Contents/MacOS/RapidWeaver: img_data_lock: Cannot allocate memory
RapidWeaver(19697,0xa000d000) malloc: *** vm_allocate(size=18051072) failed (error code=3)
RapidWeaver(19697,0xa000d000) malloc: *** error: can't allocate region
RapidWeaver(19697,0xa000d000) malloc: *** set a breakpoint in szone_error to debug
RapidWeaver(19697,0xa000d000) malloc: *** vm_allocate(size=18051072) failed (error code=3)
RapidWeaver(19697,0xa000d000) malloc: *** error: can't allocate region
RapidWeaver(19697,0xa000d000) malloc: *** set a breakpoint in szone_error to debug
RapidWeaver(19697,0xa000d000) malloc: *** vm_allocate(size=18051072) failed (error code=3)
RapidWeaver(19697,0xa000d000) malloc: *** error: can't allocate region
RapidWeaver(19697,0xa000d000) malloc: *** set a breakpoint in szone_error to debug
RapidWeaver(19697,0xa000d000) malloc: *** vm_allocate(size=18051072) failed (error code=3)
RapidWeaver(19697,0xa000d000) malloc: *** error: can't allocate region
RapidWeaver(19697,0xa000d000) malloc: *** set a breakpoint in szone_error to debug
RapidWeaver(19697,0xa000d000) malloc: *** vm_allocate(size=18051072) failed (error code=3)
RapidWeaver(19697,0xa000d000) malloc: *** error: can't allocate region
RapidWeaver(19697,0xa000d000) malloc: *** set a breakpoint in szone_error to debug
RapidWeaver(19697,0xa000d000) malloc: *** vm_allocate(size=18051072) failed (error code=3)
RapidWeaver(19697,0xa000d000) malloc: *** error: can't allocate region
RapidWeaver(19697,0xa000d000) malloc: *** set a breakpoint in szone_error to debug
RapidWeaver(19697,0xa000d000) malloc: *** vm_allocate(size=18051072) failed (error code=3)
RapidWeaver(19697,0xa000d000) malloc: *** error: can't allocate region
RapidWeaver(19697,0xa000d000) malloc: *** set a breakpoint in szone_error to debug
RapidWeaver(19697,0xa000d000) malloc: *** vm_allocate(size=18051072) failed (error code=3)
RapidWeaver(19697,0xa000d000) malloc: *** error: can't allocate region
RapidWeaver(19697,0xa000d000) malloc: *** set a breakpoint in szone_error to debug

I am guessing not enough memory is available to preform the task. What I am asking is how can I limit it, to do all the images no matter the size, and also show a loading bar instead of having the spinning curser. I am using a NSImage Lock and Unlock.

Basically is this:
newImage = [[NSImage alloc] initWithSize:targetSize];


[newImage lockFocus];

NSRect thumbnailRect;
thumbnailRect.origin = thumbnailPoint;
thumbnailRect.size.width = scaledWidth;
thumbnailRect.size.height = scaledHeight;

[sourceImage drawInRect: thumbnailRect
fromRect: NSZeroRect
operation: NSCompositeSourceOver
fraction: 1.0];

[newImage unlockFocus];


With a few extra things. Also faster ways? Anything is appreciated.

Chris
 

HiRez

macrumors 603
Jan 6, 2004
6,250
2,576
Western US
First of all, what is it this is supposed to be doing? I see that it's making thumbnails of some sort, bit how are they used? Are they all being composited onto one large contact sheet or something? Run top from Terminal or the System Monitor app from /Applications/Utilities and verify that you actually are running out of RAM.

Are you creating that image many times in a loop? If so, are you sending it a release message when you're done with it before you assign a new image to it? If not you have a big memory leak there. If you alloc-init it, you gotta release it yourself.

As for a loading bar, just make yourself a panel in IB with an NSProgressBar and status message on it, and send updates to them as you process your images. Show the panel and bring it to the front when you start, hide it when done.
 

varsis

macrumors regular
Original poster
Nov 30, 2005
209
1
First of all, what is it this is supposed to be doing? I see that it's making thumbnails of some sort, bit how are they used? Are they all being composited onto one large contact sheet or something? Run top from Terminal or the System Monitor app from /Applications/Utilities and verify that you actually are running out of RAM.

Are you creating that image many times in a loop? If so, are you sending it a release message when you're done with it before you assign a new image to it? If not you have a big memory leak there. If you alloc-init it, you gotta release it yourself.

As for a loading bar, just make yourself a panel in IB with an NSProgressBar and status message on it, and send updates to them as you process your images. Show the panel and bring it to the front when you start, hide it when done.

The app doesn't use all the Ram but Does use 125% cpu near the begging but half way it goes to 50%.

I am using a NSImage 2 of them. One for the large one for the Thumbnail. The NSImageRep I have is to get the size of the image in pixels hight which It does unless I have too many images. Blows up usally on the last 3.

I used 88 6mp files.

Ideas? I am releasing the objects each time.
 

varsis

macrumors regular
Original poster
Nov 30, 2005
209
1
Well I decided to remove a NSImageRep i had in there instead I am using

NSImage Rep, but I don't know how to get the Pixels from this array at Object index 0 does anyone know how I can seperate?

NSBitmapImageRep 0x24fff820 Size={721.92, 480} ColorSpace=NSCalibratedRGBColorSpace BPS=8 BPP=24 Pixels=3008x2000 Alpha=NO Planar=NO Format=0
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.