I have a method that analyzes pixel data inside an NSBitmapImageRep that is built from a CGImageRef. Here is the relevant code:
CGImageRef ref;
// omitted code for initializing ref
NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:ref];
uint32* bitmapPixels = (uint32*) [bitmapRep bitmapData];
// do stuff with bitmapPixels
[bitmapRep release];
CGImageRelease(ref);
I know I'm properly releasing the CGImageRef and NSBitmapImageRep, but the call to -bitmapData leaks about 2 MB each time it's called, and I don't know how to properly release it. Any ideas?
Update: I forgot to add one important point: memory is only leaked when there is a full screen application running. For regular usage, the memory is released just fine.