Contents

size

The contiguous memory footprint of T, in bytes.

Declaration

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.

See Also

Accessing the Layout of a Type