Re: Core Graphics wants 10 petabytes of RAM
On 7 Sep 2010, at 13:10, Guillem Palou wrote: > > On Sep 7, 2010, at 2:07 PM, Thomas Davie wrote: > >> I'm having a problem with CoreGraphics periodically deciding it wants to >> allocate an enormous amount of RAM, the code in question is simply trying to >> create an NSImage from raw data: >> >>CGContextRef context = CGBitmapContextCreate(imgData, >> width, >> height, >> 8, >> 4 * width, >> colourSpace, >> kCGBitmapByteOrderDefault | >> kCGImageAlphaPremultipliedLast); >>CGImageRef cgImage = CGBitmapContextCreateImage(ctx); > > Should be CGImageRef cgImage = CGBitmapContextCreateImage(context); ?? Hah! well spotted. I wonder why this ever worked! Schrodingbug! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Graphics wants 10 petabytes of RAM
On Sep 7, 2010, at 2:07 PM, Thomas Davie wrote: > I'm having a problem with CoreGraphics periodically deciding it wants to > allocate an enormous amount of RAM, the code in question is simply trying to > create an NSImage from raw data: > >CGContextRef context = CGBitmapContextCreate(imgData, > width, > height, > 8, > 4 * width, > colourSpace, > kCGBitmapByteOrderDefault | > kCGImageAlphaPremultipliedLast); >CGImageRef cgImage = CGBitmapContextCreateImage(ctx); Should be CGImageRef cgImage = CGBitmapContextCreateImage(context); ?? >NSImage *i = [[[NSImage alloc] initWithCGImage:cgImage > size:NSMakeSize(width, height)] autorelease]; >CGImageRelease(cgImage); >CGContextRelease(context); >CGColorSpaceRelease(colourSpace); > > Creating the image (the call to CGBitmapContextCreateImage) sometimes > (seemingly at random) produces this error: > : CGDataProviderCreateWithCopyOfData: failed to vm_allocate > 10248191152060862009 bytes: 3. > > And returns a nil image. Applying the debugger finds that width, height and > imgData are all sane values (512, 512, and 512 * 512 * 4 bytes of data). > > Cheers to anyone who knows what's up. > > Bob > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/guillem.palou%40gmail.com > > This email sent to guillem.pa...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Graphics wants 10 petabytes of RAM
I'm having a problem with CoreGraphics periodically deciding it wants to allocate an enormous amount of RAM, the code in question is simply trying to create an NSImage from raw data: CGContextRef context = CGBitmapContextCreate(imgData, width, height, 8, 4 * width, colourSpace, kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedLast); CGImageRef cgImage = CGBitmapContextCreateImage(ctx); NSImage *i = [[[NSImage alloc] initWithCGImage:cgImage size:NSMakeSize(width, height)] autorelease]; CGImageRelease(cgImage); CGContextRelease(context); CGColorSpaceRelease(colourSpace); Creating the image (the call to CGBitmapContextCreateImage) sometimes (seemingly at random) produces this error: : CGDataProviderCreateWithCopyOfData: failed to vm_allocate 10248191152060862009 bytes: 3. And returns a nil image. Applying the debugger finds that width, height and imgData are all sane values (512, 512, and 512 * 512 * 4 bytes of data). Cheers to anyone who knows what's up. Bob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com