GPUImage
GPUImage copied to clipboard
Memory is Not Decreasing after Applying Filters
I am using five Filters at a time on a UIImage
and once it's completed I am de-allocting all the objects but still memory is increasing if I apply filter to next UIImage
.
@autoreleasepool {
GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:faxImage];
GPUImageSaturationFilter *saturationFilter = [[GPUImageSaturationFilter alloc]init];
[saturationFilter setSaturation:0];
[stillImageSource addTarget:saturationFilter];
[stillImageSource processImage];
[saturationFilter useNextFrameForImageCapture];
UIImage *copyImage=[saturationFilter imageFromCurrentFramebuffer];
stillImageSource=[[GPUImagePicture alloc] initWithImage:copyImage];
GPUImagePicture *copyGPUimage = [[GPUImagePicture alloc] initWithImage:copyImage];
GPUImageColorInvertFilter *invertFilter=[[GPUImageColorInvertFilter alloc]init];
[copyGPUimage addTarget:invertFilter];
[copyGPUimage processImage];
[invertFilter useNextFrameForImageCapture];
UIImage *imgTempr=[invertFilter imageFromCurrentFramebuffer];
copyGPUimage= [[GPUImagePicture alloc]initWithImage:imgTempr];
GPUImageGaussianBlurFilter *gaussianBlur=[[GPUImageGaussianBlurFilter alloc]init];
[gaussianBlur setBlurRadiusInPixels:5.0];
[copyGPUimage addTarget:gaussianBlur];
[copyGPUimage processImage];
[gaussianBlur useNextFrameForImageCapture];
UIImage *imgTempa=[gaussianBlur imageFromCurrentFramebuffer];
copyGPUimage= [[GPUImagePicture alloc]initWithImage:imgTempa];
GPUImageColorDodgeBlendFilter *colorDodge=[[GPUImageColorDodgeBlendFilter alloc]init];
[stillImageSource addTarget:colorDodge];
[copyGPUimage addTarget:colorDodge];
[stillImageSource processImage];
[copyGPUimage processImage];
[colorDodge useNextFrameForImageCapture];
UIImage *imageWithAppliedThreshold=[colorDodge imageFromCurrentFramebuffer];
stillImageSource = [[GPUImagePicture alloc] initWithImage:imageWithAppliedThreshold];
GPUImageMonochromeFilter *monochromeFilter=[[GPUImageMonochromeFilter alloc]init];
[monochromeFilter setIntensity:0.75];
[monochromeFilter setColorRed:0.0 green:0.0 blue:0.0];
[monochromeFilter setBackgroundColorRed:1.0 green:1.0 blue:1.0 alpha:1.0];
[stillImageSource addTarget: monochromeFilter];
[stillImageSource processImage];
[monochromeFilter useNextFrameForImageCapture];
imageWithAppliedThreshold=[monochromeFilter imageFromCurrentFramebuffer];
stillImageSource = nil;
saturationFilter = nil;
copyGPUimage = nil;
invertFilter = nil;
gaussianBlur = nil;
colorDodge = nil;
monochromeFilter = nil;
return imageWithAppliedThreshold;
}
Tried many solution but no luck. The max memory goes to 1 GB on iPhone 6s Plus, if I apply filters to 10 UIImages
at a time.
Besides, above solution I also tried removeTargets
and removeOutputFrameBuffer
but no luck. Please guide me I need the filters but memory should not increse by 100 MB.
我也遇到了同样的问题,capturePhotoAsImageProcessedUpToFilter后内存升高了好多
后来怎么解决的呢?,我也遇见了