<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLIOScratchBufferAllocator/makeScratchBuffer(minimumSize:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLIOScratchBufferAllocator(im)newScratchBufferWithMinimumSize:"
  },
  "title" : "makeScratchBuffer(minimumSize:)"
}
-->

# makeScratchBuffer(minimumSize:)

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

```
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

An [`MTLIOScratchBuffer`](/documentation/Metal/MTLIOScratchBuffer) instance that your app implements or `nil`.

## 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`](/documentation/Metal/MTLIOCommandBuffer) instance that needs the scratch buffer memory.

---

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)