CGImageRef没有发布

时间:2014-09-02 12:05:50

标签: ios objective-c memory-leaks cgimageref

使用СП

时遇到问题
for (int16_t j = 0; j <= 1/kAlphaStep; j++) {
            UIImage *blendingImage = [UIImage imageByBlendingImage:firstImage andImage:secondImage alpha:kAlphaStep*j];
            buffer = [self pixelBufferFromImage:blendingImage andSize:size];
...}

并且

- (CVPixelBufferRef)pixelBufferFromImage:(UIImage *)img andSize:(CGSize)size {
CGImageRef image = img.CGImage;
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                         [NSNumber numberWithBool:YES], kCVPixelBufferCGImageCompatibilityKey,
                         [NSNumber numberWithBool:YES], kCVPixelBufferCGBitmapContextCompatibilityKey,
                         nil];
CVPixelBufferRef pxbuffer = NULL;

CVReturn status = CVPixelBufferCreate(kCFAllocatorDefault, size.width,
                                      size.height, kCVPixelFormatType_32ARGB, (__bridge CFDictionaryRef) options,
                                      &pxbuffer);
NSParameterAssert(status == kCVReturnSuccess && pxbuffer != NULL);
...
return pxbuffer;

}

当我在循环中时,内存中的所有CGImageRef

如果我使用

if (image) {
    CGImageRelease(image);
}

app崩溃了。 请帮帮我!!

0 个答案:

没有答案