I have created blur image as below:
//Blur the UIImage
CIImage *imageToBlur = [CIImage imageWithCGImage:viewImage.CGImage];
CIFilter *gaussianBlurFilter = [CIFilter filterWithName: @"CIGaussianBlur"];
[gaussianBlurFilter setValue:imageToBlur forKey: @"inputImage"];
[gaussianBlurFilter setValue:[NSNumber numberWithFloat: 2] forKey: @"inputRadius"];
CIImage *resultImage = [gaussianBlurFilter valueForKey: @"outputImage"];
CIImage *finalImage = [resultImage imageByCroppingToRect:CGRectMake(0, 10, self.view.bounds.size.width, self.view.bounds.size.height)];
//create UIImage from filtered image
UIImage *blurrredImage = [[UIImage alloc] initWithCIImage:finalImage];
CIFilter *colorMatrixFilter = [CIFilter filterWithName:@"CIColorMatrix"];
[colorMatrixFilter setDefaults];
[colorMatrixFilter setValue:finalImage forKey:kCIInputImageKey];
[colorMatrixFilter setValue:[CIVector vectorWithX:0.25 Y:0 Z:0 W:0] forKey:@"inputRVector"];
[colorMatrixFilter setValue:[CIVector vectorWithX:0 Y:0.35 Z:0 W:0] forKey:@"inputGVector"];
[colorMatrixFilter setValue:[CIVector vectorWithX:0 Y:0 Z:0.4 W:0] forKey:@"inputBVector"];
[colorMatrixFilter setValue:[CIVector vectorWithX:0 Y:0 Z:0 W:1] forKey:@"inputAVector"];
// Get the output image recipe
CIImage *outputImage = [colorMatrixFilter outputImage];
// Create the context and instruct CoreImage to draw the output image recipe into a CGImage
CIContext *context = [CIContext contextWithOptions:nil];
CGImageRef cgimg = [context createCGImage:outputImage fromRect:[outputImage extent]];
blurrredImage = [UIImage imageWithCGImage:cgimg];
CGImageRelease(cgimg);
//Place the UIImage in a UIImageView
UIImageView *newView = [[UIImageView alloc] initWithFrame:self.view.bounds];
newView.image = blurrredImage;
//insert blur UIImageView below transparent view inside the blur image container
[blurContainerView insertSubview:newView belowSubview:transparentView];
I have released the CGImageRef, but still getting the memory leak at
CGImageRef cgimg = [context createCGImage:outputImage fromRect:[outputImage extent]];
I am also referred all other related questions and and implement the provided answers still getting memory leak
Used @autoreleasepool { } and try to set object to nil
context = nil;
outputImage = nil;
gaussianBlurFilter = nil;
viewImage = nil;
before
CGImageRelease(cgimg);
Still it shows the memory leak and description is as below. ARC is on and ios version is 6.1 and 7
Responsible Library is : CoreImage Responsible Caller is : CI::GLESContext::program_for_name(__CFString const*)
Can anybody please suggest me how can i resolved this memory leak?
Thanks for the help in advance.