Excessive dirty memory

Dear All,
I'm developing an iOS app for drawing on a simple canvas.
The app manages one canvas per time (layers are managed differently).
I didn't use 3rd party libraries and all components are Apple friendly (canvas is PencilKit for example) while the UI is all SwiftUI.
The app never crashed but while testers are playing on it, the dirty memory grows and the app is noticeably slower.

The Instruments record shows a grew in correct memory when the app starts, but the memory used never decreases, even when the action using memory is finished. This causes a constant increase in dirty memory.

I'm working on simulator and testers on real devices like iPad 12.9 4th generation.

I heavily work with Dispatchers, UIImages and CIImages.

Attached part of the Instruments VM Tracker of dirty memory.





I need to understand why memory is not deallocated when a SwiftUI's view disappears.

This is the simple flow:
  • start the app 20MB memory

  • open canvas 200MB memory

  • close canvas (should be 20MB again) 200 MB

So:
is there a way in Instruments to find exactly which Object retains dirty memory?

Thanks
Excessive dirty memory
 
 
Q