Filter effects show some warning Performing a costly unpadding operation! also some memory leak after apply on image?
my code is :-
CIImage *imagee = [Filter outputImage];
CIContext *context = [CIContext contextWithOptions:nil];
CGImageRef cgImage = [context createCGImage:
imagee fromRect: imagee.extent];
UIImage *resultUIImage = [[UIImage alloc ]initWithCGImage: cgImage];
image=resultUIImage;
CGImageRelease(cgImage);
cgImage=nil;
SaveImage=image;
[resultUIImage release];
You aren’t releasing your CIImage, which is most likely where that leak is coming from (Cocoa Memory Semantics require that class methods return objects with a +0 retain count so they must be retained by the caller). At the same time, you are performing an expensive filtering of the image. You see, images may be padded with a couple extra bytes to make sure that their lines end in a 2^nth byte. But in order to load the filter, iOS has to unpad the image, which involves going in and iterating through its bytes to remove padding, which takes a while. If it doesn’t affect anything performance-wise, you could always draw on a background thread. I don’t know how safe CIImage or UIImage are, but Core Graphics is generally threadsafe.