---
title: capacity
framework: swift
role: symbol
role_heading: Instance Property
path: swift/managedbufferpointer/capacity
---

# capacity

The actual number of elements that can be stored in this object.

## Declaration

```swift
var capacity: Int { get }
```

## Discussion

Discussion This value may be nontrivial to compute; it is usually a good idea to store this information in the “header” area when an instance is created.

## See Also

### Inspecting a Buffer

- [header](swift/managedbufferpointer/header.md)
- [buffer](swift/managedbufferpointer/buffer.md)
- [isUniqueReference()](swift/managedbufferpointer/isuniquereference().md)
