碰到个内存泄露的问题,代码位置定位到下面这块儿。
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:frame->data
pixelsWide:frame->width
pixelsHigh:frame->height
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace
bitmapFormat:NSAlphaFirstBitmapFormat
bytesPerRow:frame->width * 4
bitsPerPixel:32];
无内存泄露:
NSData* data = [imageRep TIFFRepresentation];
下面的是有内存泄露的:
NSData* data = [imageRep representationUsingType: NSPNGFileType properties:nil}];
环境:OS X 10.10.2
IDE: XCode 6.1.1
原因暂时没有时间深究。