<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLCommandBufferDescriptor/retainedReferences",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTLCommandBufferDescriptor(py)retainedReferences"
  },
  "title" : "retainedReferences"
}
-->

# retainedReferences

A Boolean value that indicates whether the command buffer the descriptor creates maintains strong references to the resources it uses.

```
var retainedReferences: Bool { get set }
```

## Discussion

Set this property to <doc://com.apple.documentation/documentation/Swift/true> (its default) to create a command buffer that maintains strong references to resource instances that its commands need. Otherwise, set it to <doc://com.apple.documentation/documentation/Swift/false> to create a command buffer that doesn’t maintain strong references to its resources.

Apps typically create command buffers that don’t maintain references to resources for extremely performance-critical situations. Even though the runtime cost for retaining or releasing a single resource is trivial, the aggregate time savings may be worth it.

It’s your app’s responsibility to maintain strong references to all the resources the command buffer uses until it finishes running on the GPU.

> Important:
> Releasing a resource before a command buffer’s commands complete may trigger a runtime error or erratic behavior.

You can determine whether an existing command buffer retains references by checking its [`retainedReferences`](/documentation/Metal/MTLCommandBuffer/retainedReferences) property.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)