CFData memory playback using Core Image filters

I have a problem with allocated memory too large. My alloc mem application reaches up to 100 MB! And yes ... I use ARC . most of the allocated memory is CFData (since I understand that these are CoreImage filters). After applying the filter to the image, the allocated CFData memory increases by ~ 1.3 MB and does not free:

Instruments showing the memory usage

The code is as follows:

 +(UIImage*)BWFilter:(UIImage *)imgFX { CIImage *sourceImage = [[CIImage alloc] initWithImage:imgFX]; CIImage *blackAndWhite = [CIFilter filterWithName:@"CIColorControls" keysAndValues:kCIInputImageKey, sourceImage, @"inputBrightness", [NSNumber numberWithFloat:0.0], @"inputContrast", [NSNumber numberWithFloat:1.1], @"inputSaturation", [NSNumber numberWithFloat:0.0], nil].outputImage; CIImage *output = [CIFilter filterWithName:@"CIExposureAdjust" keysAndValues:kCIInputImageKey, blackAndWhite, @"inputEV", [NSNumber numberWithFloat:0.7], nil].outputImage; CIContext *context = [CIContext contextWithOptions:nil]; CGImageRef cgiimage = [context createCGImage:output fromRect:output.extent]; imgFX = [UIImage imageWithCGImage:cgiimage]; if (cgiimage) { CGImageRelease(cgiimage); } return imgFX; } 

Memory usage does not disappear after a memory warning, so it should not be a cache problem.

+4
source share
1 answer

I ran your code on a project example (with ARC) and it does not give any leaks or additional distributions. CFData is essentially not associated with subclasses of CIFilter , but with CIImage . The problem is elsewhere.

0
source

All Articles