---
title: ensureCapacity
framework: Kernel
role: symbol
role_heading: Instance Method
platforms: [driverkit 19.0+, macOS 10.15+]
path: kernel/osarray/3180809-ensurecapacity
---

# ensureCapacity

Allocates capacity for members in array.

## Declaration

```occ
virtual uint32_t ensureCapacity(uint32_t newCapacity);
```

```occ
virtual unsigned int ensureCapacity(unsigned int newCapacity);
```

## Parameters

- `newCapacity`: Count of allocated capacity for members in array.

## Return Value

Return Value New count of capacity for members in array, may return prior capacity on failure.

## See Also

### Inspecting an Array

- [getCount](kernel/osarray/3180813-getcount.md)
- [getCapacity](kernel/osarray/3180812-getcapacity.md)
