Create AVSemanticSegmentationMatte from image data seems to leak memory

I compared with several options to use get auxiliary images from CIImage.

These options leak AVSemanticSegmentationMatte when using debug memory graph

CIImage.init(data: data, options: [.auxiliarySemanticSegmentationSkinMatte: true])

CIImage.init(data: data, options: [.auxiliarySemanticSegmentationHairMatte: true])

CIImage.init(data: data, options: [.auxiliarySemanticSegmentationTeethMatte: true])

Other options .auxiliaryDisparity and .auxiliaryPortraitEffectsMatte do not leak AVDepthData nor AVPortraitEffectsMatte.

I am using Xcode13.1 with iOS15.0, code is tested on photos shot with iPhoneXS, using objc and swift, both have this memory leak issue.

Does it still exist after you released the CIContext you used for rendering? The context usually caches some intermediate images and objects to speed up consecutive render calls.

Create AVSemanticSegmentationMatte from image data seems to leak memory
 
 
Q