---
title: "setThreadgroupMemoryLength(_:offset:index:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrendercommandencoder/setthreadgroupmemorylength(_:offset:index:)"
---

# setThreadgroupMemoryLength(_:offset:index:)

Configures the size of a threadgroup memory buffer for an entry in the fragment or tile shader argument table.

## Declaration

```swift
func setThreadgroupMemoryLength(_ length: Int, offset: Int, index: Int)
```

## Parameters

- `length`: The threadgroup memory length, in bytes.
- `offset`: An integer that represents the location, in bytes, from the start of the buffer at index where the threadgroup memory begins.
- `index`: An integer that represents an entry in the buffer argument table.

## Discussion

Discussion You can only change the threadgroup memory’s size between tile dispatches (see dispatchThreadsPerTile(_:)). important: Exceeding the threadgroup memory allocation for the render pass can trigger a debug error.

## See Also

### Configuring persistent threadgroup memory

- [setObjectThreadgroupMemoryLength(_:index:)](metal/mtlrendercommandencoder/setobjectthreadgroupmemorylength(_:index:).md)
