---
title: withCapacity
framework: driverkit
role: symbol
role_heading: Static Method
path: driverkit/osset/withcapacity
---

# withCapacity

## Declaration

```occ
static OSSetPtr withCapacity(uint32_t capacity);
```

## Parameters

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

## Return Value

Return Value NULL on failure, otherwise the allocated OSSet with reference count 1 to be released by the caller.

## Discussion

Discussion Allocates an OSSet object with preallocated capacity.
