Memory keeps building up and not releasing with GPUImage. If I change the filter on a UIImage, the old filter memory is never released
My code:
Have a UIImageView as a class property:
@property(nonatomic,strong) UIImageView *capturedImageView;
I apply the filter like so
GPUImageFilter filter = [[GPUImageGrayscaleFilter alloc] init];
UIImage *filteredImage = [filter imageByFilteringImage:[UIImage imageWithCGImage:myImage.CGImage]];
[filter removeAllTargets];
[filter endProcessing];
I then set the imageView.image property to the filtered image
self.capturedImageView.image = filteredImage;
Now at any time I might change the filter (based on what a user selects (ie an instagram like filter list)). When I do change the filter I just use the code above (but alloc a different filter)
I don't understand why memory keeps building up? I tried setting my imageview.image property to nil and GPIFilter to nil but that does nothing