---
title: size
framework: metal
role: symbol
role_heading: Instance Property
path: metal/mtlheapdescriptor/size
---

# size

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

## Declaration

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

## Discussion

Discussion You can use various MTLDevice methods to help you estimate an appropriate heap size, including the following: heapBufferSizeAndAlign(length:options:) heapTextureSizeAndAlign(descriptor:) heapAccelerationStructureSizeAndAlign(size:) heapAccelerationStructureSizeAndAlign(descriptor:) note: Metal may round a heap’s size to a page boundary. This property’s default value is 0.

## See Also

### Configuring a heap

- [type](metal/mtlheapdescriptor/type.md)
- [storageMode](metal/mtlheapdescriptor/storagemode.md)
- [cpuCacheMode](metal/mtlheapdescriptor/cpucachemode.md)
- [hazardTrackingMode](metal/mtlheapdescriptor/hazardtrackingmode.md)
- [resourceOptions](metal/mtlheapdescriptor/resourceoptions.md)
- [sparsePageSize](metal/mtlheapdescriptor/sparsepagesize.md)
