I am using this code to generate 5 blur images using GPUImage and it seems like there is a memory accumulation of about 20MB which never gets released. Am I doing something wrong?
Here is my code:
dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
GPUImageFastBlurFilter *blurFilter = [[GPUImageFastBlurFilter alloc] init];
GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:[image copy]];
[stillImageSource addTarget:blurFilter];
CGFloat maxBlur = 12.0;
for (int i=0; i < BLUR_STEPS; i++) {
if (!self.stopBlurOperation) { //stops blur operation on close
UIImageView *imageView;
if (i < self.blurredImageViews.count) {
imageView = (UIImageView *)self.blurredImageViews[i];
blurFilter.blurRadiusInPixels = maxBlur * (i+1) / BLUR_STEPS;
[blurFilter useNextFrameForImageCapture];
[stillImageSource processImage];
UIImage *blurredImage = [blurFilter imageFromCurrentFramebuffer];
dispatch_async( dispatch_get_main_queue(), ^{
[imageView setImage:blurredImage];
});
blurredImage = nil;
}
}
}
[blurFilter removeAllTargets];
[stillImageSource removeAllTargets];
[GPUImageContext setActiveShaderProgram:nil];
blurFilter = nil;
stillImageSource = nil;
});