<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLIndirectComputeCommand/setThreadgroupMemoryLength(_:index:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLIndirectComputeCommand(im)setThreadgroupMemoryLength:atIndex:"
  },
  "title" : "setThreadgroupMemoryLength(_:index:)"
}
-->

# setThreadgroupMemoryLength(_:index:)

Sets the size of a block of threadgroup memory.

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

## Parameters

`length`

The size of the threadgroup memory, in bytes, which needs to be a multiple of 16 bytes.

`index`

The index in the threadgroup memory argument table.

## Discussion

---

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)