<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLHeap",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLHeap"
  },
  "title" : "MTLHeap"
}
-->

# MTLHeap

A memory pool from which you can suballocate resources.

```
protocol MTLHeap : MTLAllocation
```

## Overview

Don’t implement this protocol yourself; instead, to create a heap, configure an [`MTLHeapDescriptor`](/documentation/Metal/MTLHeapDescriptor) instance and call the [`makeHeap(descriptor:)`](/documentation/Metal/MTLDevice/makeHeap(descriptor:)) method of an [`MTLDevice`](/documentation/Metal/MTLDevice) instance.

You suballocate resources from a heap and make them *aliasable* or *non-aliasable*. A sub-allocated resource is non-aliased by default, preventing future resources allocated from the heap from using its memory. Resources are *aliased* when they share the same memory allocation on a heap.

All resources sub-allocated from the same heap share the same storage mode and CPU cache mode. You can make heaps purgeable, but not the resources allocated from the heap; they can only reflect the heap’s purgeability state.

## Topics

### Naming and identifying a heap

[`label`](/documentation/Metal/MTLHeap/label)

A string that identifies the heap.

### Creating buffers from a heap

[`makeBuffer(length:options:)`](/documentation/Metal/MTLHeap/makeBuffer(length:options:))

Creates a buffer on the heap.

[`makeBuffer(length:options:offset:)`](/documentation/Metal/MTLHeap/makeBuffer(length:options:offset:))

Creates a buffer at a specified offset on the heap.

### Creating textures from a heap

[`makeTexture(descriptor:)`](/documentation/Metal/MTLHeap/makeTexture(descriptor:))

Creates a texture on the heap.

[`makeTexture(descriptor:offset:)`](/documentation/Metal/MTLHeap/makeTexture(descriptor:offset:))

Creates a texture at a specified offset on the heap.

### Creating acceleration structure from a heap

[`makeAccelerationStructure(size:)`](/documentation/Metal/MTLHeap/makeAccelerationStructure(size:))

[`makeAccelerationStructure(size:offset:)`](/documentation/Metal/MTLHeap/makeAccelerationStructure(size:offset:))

[`makeAccelerationStructure(descriptor:)`](/documentation/Metal/MTLHeap/makeAccelerationStructure(descriptor:))

[`makeAccelerationStructure(descriptor:offset:)`](/documentation/Metal/MTLHeap/makeAccelerationStructure(descriptor:offset:))

### Configuring a heap’s purgeable state

[`setPurgeableState(_:)`](/documentation/Metal/MTLHeap/setPurgeableState(_:))

Sets the purgeable state of the heap.

### Checking a heap’s size information

[`maxAvailableSize(alignment:)`](/documentation/Metal/MTLHeap/maxAvailableSize(alignment:))

The maximum size of a resource, in bytes, that can be currently allocated from the heap.

[`size`](/documentation/Metal/MTLHeap/size)

The total size of the heap, in bytes.

[`usedSize`](/documentation/Metal/MTLHeap/usedSize)

The size of all resources currently in the heap, in bytes.

[`currentAllocatedSize`](/documentation/Metal/MTLHeap/currentAllocatedSize)

The size, in bytes, of the current heap allocation.

### Checking a heap’s permanent configuration

[`device`](/documentation/Metal/MTLHeap/device)

The device object that created the heap.

[`type`](/documentation/Metal/MTLHeap/type)

The heap’s type.

[`storageMode`](/documentation/Metal/MTLHeap/storageMode)

The heap’s storage mode.

[`cpuCacheMode`](/documentation/Metal/MTLHeap/cpuCacheMode)

The heap’s CPU cache mode.

[`hazardTrackingMode`](/documentation/Metal/MTLHeap/hazardTrackingMode)

The heap’s hazard tracking mode.

[`resourceOptions`](/documentation/Metal/MTLHeap/resourceOptions)

The options for resources created by the heap.



---

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)