<!--
{
  "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/MTLHeapDescriptor/size",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTLHeapDescriptor(py)size"
  },
  "title" : "size"
}
-->

# size

The total amount of memory, in bytes, for the heaps you create with this descriptor.

```
var size: Int { get set }
```

## Discussion

You can use various [`MTLDevice`](/documentation/Metal/MTLDevice) methods to help you estimate an appropriate heap size, including the following:

- [`heapBufferSizeAndAlign(length:options:)`](/documentation/Metal/MTLDevice/heapBufferSizeAndAlign(length:options:))
- [`heapTextureSizeAndAlign(descriptor:)`](/documentation/Metal/MTLDevice/heapTextureSizeAndAlign(descriptor:))
- [`heapAccelerationStructureSizeAndAlign(size:)`](/documentation/Metal/MTLDevice/heapAccelerationStructureSizeAndAlign(size:))
- [`heapAccelerationStructureSizeAndAlign(descriptor:)`](/documentation/Metal/MTLDevice/heapAccelerationStructureSizeAndAlign(descriptor:))

> Note:
> Metal may round a heap’s size to a page boundary.

This property’s default value is `0`.

---

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)