BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.23k stars 4.61k forks source link

Memory leaks when use filters #2433

Open oleksandrtry opened 7 years ago

oleksandrtry commented 7 years ago

After the execution of the code, I have the memory usage increases. How can I free up memory after execution?

My Code:

`

   let contrastfilter = GPUImageContrastFilter()
    contrastfilter.contrast = 1.4

    let thresholdImageFilter = GPUImageAdaptiveThresholdFilter()
    thresholdImageFilter.blurRadiusInPixels = 16.0

    let filterGroup = GPUImageFilterGroup()
    filterGroup.addFilter(contrastfilter)
    filterGroup.addFilter(thresholdImageFilter)
    contrastfilter.addTarget(thresholdImageFilter)

    filterGroup.initialFilters = [ contrastfilter ]
    filterGroup.terminalFilter = thresholdImageFilter

    let resultImage = filterGroup.image(byFilteringImage: image)

`

bianzhifeng commented 7 years ago

OC: [[GPUImageContext sharedImageProcessingContext].framebufferCache purgeAllUnassignedFramebuffers];

oleksandrtry commented 7 years ago

I try to use this, but no effect. In what place I should write this?

bianzhifeng commented 7 years ago

After the effect image is displayed in the view

bianzhifeng commented 7 years ago

Or when the view is dealloc

oleksandrtry commented 7 years ago

I didn't show images. After filter processing I save images to file system.

oleksandrtry commented 7 years ago

The problem is reproduced only when I save the image in the file system. Can anyone help to solve this problem?