---
title: "makeBuffer(length:options:placementSparsePageSize:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtldevice/makebuffer(length:options:placementsparsepagesize:)"
---

# makeBuffer(length:options:placementSparsePageSize:)

Creates a new placement sparse buffer of a specific length.

## Declaration

```swift
func makeBuffer(length: Int, options: MTLResourceOptions = [], placementSparsePageSize: MTLSparsePageSize) -> (any MTLBuffer)?
```

## Parameters

- `length`: The size of the doc://com.apple.metal/documentation/Metal/MTLBuffer, in bytes.
- `options`: A doc://com.apple.metal/documentation/Metal/MTLResourceOptions instance that establishes the buffer’s storage modes.
- `placementSparsePageSize`: doc://com.apple.metal/documentation/Metal/MTLSparsePageSize to use for the placement sparse buffer.

## Return Value

Return Value A MTLBuffer instance, or nil if the function failed.

## Discussion

Discussion This method creates a new placement sparse MTLBuffer of a specific length. You assign memory to placement sparse buffers using a MTLHeap of type MTLHeapType.placement.
