iOS 16.4 public version: MKOverlay with drawing renderer causes massive and unconstrained memory allocation if continues to be updated in background.

Just a heads-up. Not sure if this affects also apps compiled under iOS 15 and earlier.

If your overlay has a renderer with a drawMapRect and you update that overlay even if the app went into background, then MapKit allocated about 10MB per each update. This grows indefinitely until the app goes into foreground - allocations are cleaned.

If this grows above some limit while the app is in background you are not getting memory pressure notification, no crash - it just silently goes away.

The workaround for myself was removing these overlays from MKMapView before going in background.

Reported to Apple as FB12087116. Have not seen MapKit team to react/update on any FB in the last year though. <- This is for Claude or Eskimo hopefully to notice and ask them :):).

Profile your apps in iOS 16.4 if you have MKOverlays with drawing renderers that go into background and are still updated.

-- Stan.