---
title: makeCommandBufferWithUnretainedReferences()
framework: metal
role: symbol
role_heading: Instance Method
path: metal/mtlcommandqueue/makecommandbufferwithunretainedreferences()
---

# makeCommandBufferWithUnretainedReferences()

Returns a command buffer from the command queue that doesn’t maintain strong references to resources.

## Declaration

```swift
func makeCommandBufferWithUnretainedReferences() -> (any MTLCommandBuffer)?
```

## Mentioned in

Understanding the Metal 4 core API

## Discussion

Discussion Use this method to create a command buffer that doesn’t retain or release any of the resources it needs to run its commands. 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. This method sets the retainedReferences property to false for the command buffer it creates. Each command queue has a fixed number of command buffers for its lifetime (see makeCommandQueue(maxCommandBufferCount:)). This method blocks the calling CPU thread when the queue doesn’t have any free command buffers, and returns after the GPU finishes executing one.

## See Also

### Creating command buffers

- [makeCommandBuffer(descriptor:)](metal/mtlcommandqueue/makecommandbuffer(descriptor:).md)
- [makeCommandBuffer()](metal/mtlcommandqueue/makecommandbuffer().md)
