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?

I am facing the same problem and having issues with restarting the AESESSION. This error is repeatable with every test execution. Where is there a more detailed log for the ARSESSION that will be seen outside of the Xcode execution?

ARSession <0x12b068c80>: The delegate of ARSession is retaining 11 ARFrames. The camera will stop delivering camera images if the delegate keeps holding on to too many ARFrames. This could be a threading or memory management issue in the delegate and should be fixed. Type: Error | Timestamp: 2025-02-03 12:01:39.720227-06:00 | Library: ARKitCore | Subsystem: com.apple.ARKit | Category: Session | TID: 0x9224 ARSession <0x12b068c80>: The delegate of ARSession is retaining 12 ARFrames. The camera will stop delivering camera images if the delegate keeps holding on to too many ARFrames. This could be a threading or memory management issue in the delegate and should be fixed. Type: Error | Timestamp: 2025-02-03 12:01:39.791606-06:00 | Library: ARKitCore | Subsystem: com.apple.ARKit | Category: Session | TID: 0x9224 Attempting to enable an already-enabled session. Ignoring... Type: Error | Timestamp: 2025-02-03 12:01:39.947296-06:00 | Library: Recon3D | Subsystem: com.apple.Recon3D | Category: cv3d.recon.sng | TID: 0x63fa ARWorldTrackingTechnique <0x109827480>: World tracking performance is being affected by resource constraints [25] Type: Error | Timestamp: 2025-02-03 12:01:40.055249-06:00 | Library: ARKitCore | Subsystem: com.apple.ARKit | Category: Technique | TID: 0x9036 ARSession <0x12b068c80>: The delegate of ARSession is retaining 11 ARFrames. The camera will stop delivering camera images if the delegate keeps holding on to too many ARFrames. This could be a threading or memory management issue in the delegate and should be fixed. Type: Error | Timestamp: 2025-02-03 12:01:50.583027-06:00 | Library: ARKitCore | Subsystem: com.apple.ARKit | Category: Session | TID: 0x92a5 ARSession <0x12b068c80>: The delegate of ARSession is retaining 12 ARFrames. The camera will stop delivering camera images if the delegate keeps holding on to too many ARFrames. This could be a threading or memory management issue in the delegate and should be fixed. Type: Error | Timestamp: 2025-02-03 12:01:51.683169-06:00 | Library: ARKitCore | Subsystem: com.apple.ARKit | Category: Session | TID: 0x9222 ARWorldTrackingTechnique <0x109827480>: World tracking performance is being affected by resource constraints [25] Type: Error | Timestamp: 2025-02-03 12:01:53.013283-06:00 | Library: ARKitCore | Subsystem: com.apple.ARKit | Category: Technique | TID: 0x92ca ARSession <0x12b068c80>: The delegate of ARSession is retaining 12 ARFrames. The camera will stop delivering camera images if the delegate keeps holding on to too many ARFrames. This could be a threading or memory management issue in the delegate and should be fixed. Type: Error | Timestamp: 2025-02-03 12:01:54.176881-06:00 | Library: ARKitCore | Subsystem: com.apple.ARKit | Category: Session | TID: 0x92d8 ARSession <0x12b068c80>: The delegate of ARSession is retaining 13 ARFrames. The camera will stop delivering camera images if the delegate keeps holding on to too many ARFrames. This could be a threading or memory management issue in the delegate and should be fixed. Type: Error | Timestamp: 2025-02-03 12:01:55.130128-06:00 | Library: ARKitCore | Subsystem: com.apple.ARKit | Category: Session | TID: 0x92ea

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