New option(.memoryTarget) in CIContextOption

What is the purpose of the new .memoryTarget option in CIContextOption added in iOS 17? And it is interesting that this option is added only in swift interface.

https://developer.apple.com/documentation/coreimage/cicontextoption/4172811-memorytarget

Answered by FrankSchlegel in 773135022

From the comment in the header file:

A NSNumber that specifies the maximum memory footprint (in megabytes) that the CIContext allocates for render tasks. Larger values could increase memory footprint while smaller values could reduce performance.

It basically sets how much memory Core Image is allowed to use (roughly) during rendering. From what I observed, the default seems to be 256 MB.

There is also an Obj-C constant for it.

Accepted Answer

From the comment in the header file:

A NSNumber that specifies the maximum memory footprint (in megabytes) that the CIContext allocates for render tasks. Larger values could increase memory footprint while smaller values could reduce performance.

It basically sets how much memory Core Image is allowed to use (roughly) during rendering. From what I observed, the default seems to be 256 MB.

New option(.memoryTarget) in CIContextOption
 
 
Q