---
title: initWithCapacity
framework: kernel
role: pseudoSymbol
path: kernel/ioshareddataqueue/1810293-initwithcapacity
---

# initWithCapacity

Initializes an IOSharedDataQueue instance with the capacity specified in the size parameter.

## Declaration

```occ
virtual Boolean initWithCapacity(
 UInt32size); 
```

## Parameters

- `size`: The size of the data queue memory region.

## Return Value

Return Value Returns true on success and false on failure.

## Overview

Overview The actual size of the entire data queue memory region (to be shared into a user process) is equal to the capacity plus the IODataQueueMemory overhead. This overhead value can be determined from the DATA_QUEUE_MEMORY_HEADER_SIZE and DATA_QUEUE_MEMORY_APPENDIX_SIZE macro in <IOKit/IODataQueueShared.h>. The size of the data queue memory region must include space for the overhead of each IODataQueueEntry. This entry overhead can be determined from the DATA_QUEUE_ENTRY_HEADER_SIZE macro in <IOKit/IODataQueueShared.h>.

## See Also

### Miscellaneous

- [dequeue](kernel/ioshareddataqueue/1810190-dequeue.md)
- [getMemoryDescriptor](kernel/ioshareddataqueue/1810240-getmemorydescriptor.md)
- [peek](kernel/ioshareddataqueue/1810347-peek.md)
- [withCapacity](kernel/ioshareddataqueue/1810400-withcapacity.md)
- [withEntries](kernel/ioshareddataqueue/1810447-withentries.md)
