<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/MemoryLayout/size",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s12MemoryLayoutOsRi_zRi0_zrlE4sizeSivpZ"
  },
  "title" : "size"
}
-->

# size

The contiguous memory footprint of `T`, in bytes.

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

## Discussion

A type’s size does not include any dynamically allocated or out of line
storage. In particular, `MemoryLayout<T>.size`, when `T` is a class
type, is the same regardless of how many stored properties `T` has.

When allocating memory for multiple instances of `T` using an unsafe
pointer, use a multiple of the type’s stride instead of its size.

---

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)