Just noticed that using the CGDataProviderRef with callback for data release 
yields a memory leak:

    CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, buffer, 
len, imageDataRelease);
    CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
    cgImageRef = CGImageCreate(width,                          // width
                               height,                     // height
                               8,                          // bitsPerComponent
                               32,                         // bitsPerPixel
                               width*4,                    // bytesPerRow
                               space,                      // colorspace
                               kCGBitmapByteOrderDefault,  // bitmapInfo
                               provider,                   // CGDataProvider
                               NULL,                       // decode array
                               NO,                         // shouldInterpolate
                               kCGRenderingIntentDefault); // intent
    CGDataProviderRelease(provider);
    CGColorSpaceRelease(space);

The imageDataRelease method is called after the image is released, with the 
expected length of 240K (I expect this is called when the provider is freed).

However, Instruments shows a leaked Malloc of 236K with as responsible Caller 
CGDataProviderCopyData, which makes no sense to me.
Any clues about what is copied here?

---
Grinnikend door het leven...

_______________________________________________

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

Reply via email to