Encountered similar issue.
According to apple documentation -
"An image renderer keeps a cache of Core Graphics contexts, so reusing the same renderer can be more efficient than creating new renderers."
Looks like the context is cached for subsequent operations.
There is also a stackoverflow post that discusses on crashes due to image scaling using high memory - https://stackoverflow.com/questions/61263161/why-use-a-lot-of-memory-when-drawing-image-with-uigraphicsimagerenderer?rq=3
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: