What causes »ARSessionDelegate is retaining X ARFrames« console warning?

Hi,

since iOS 15 I've repeatedly noticed the console warning »ARSessionDelegate is retaining X ARFrames. This can lead to future camera frames being dropped« even for rather simple projects using RealityKit and ARKit. Could someone from the ARKit team please elaborate what causes this warning and what can be done to avoid it? If I remember correctly I didn't even assign an ARSessionDelegate.

Thank you!

Facing the same problem here

Hi, some background on why this occurs

The camera delivery (AVFoundation) has a pool of CVPixelBuffers that it uses.

When a client retains that pixelBuffer for longer periods, AVFoundation’s pool of available buffers gets empty and CoreMedia starts dropping camera frames and the screen will appear frozen.

ARKit added a mechanism that keeps track of the frames that its delegate is consuming. If that count > 10, we’re emitting some warnings. Depending on the device the camera will start dropping frames at 15 to 20 retained frames.

Usually the reason for this is that the app’s main thread (or the queue that processes the delegate) is blocked, so this indicates a performance problem that should be resolved.

Now, if you are not using ARKit at all and just using RealityKit, that probably means that RealityKit is the one with the performance issue 😔. Could you file a bug report with the simplest project that generates this warning and put the feedback number here? That way we can investigate the issue. Also, this 'dropped frames' mechanism has been around for a while, it's just the warning that is new this year. So if you haven't seen any dropped frames thus far, it's probably ok to ignore the warning.

Facing same problem here. Any solution?

What causes »ARSessionDelegate is retaining X ARFrames« console warning?
 
 
Q