---
title: "makeScratchBuffer(minimumSize:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlioscratchbufferallocator/makescratchbuffer(minimumsize:)"
---

# makeScratchBuffer(minimumSize:)

Creates a scratch memory buffer for an input/output command queue.

## Declaration

```swift
func makeScratchBuffer(minimumSize: Int) -> (any MTLIOScratchBuffer)?
```

## Parameters

- `minimumSize`: The number of bytes the input/output command buffer needs to successfully run a command buffer.

## Return Value

Return Value An MTLIOScratchBuffer instance that your app implements or nil.

## Discussion

Discussion Your app can reduce additional callbacks from the framework by providing additional memory above minimumSize. If your implementation returns nil, the input/output command queue cancels the MTLIOCommandBuffer instance that needs the scratch buffer memory.
