---
title: handleSwapPrepare
framework: driverkit
role: symbol
role_heading: Instance Method
path: driverkit/ioreporter_ivars/handleswapprepare
---

# handleSwapPrepare

## Declaration

```occ
virtual IOReturn handleSwapPrepare(int newNChannels);
```

## Parameters

- `newNChannels`: Target number of channels

## Return Value

Return Value IOReturn code

## Discussion

Discussion Allocate memory in preparation for an instance variable swap ::handleSwapPrepare() is responsible for allocating appropriately- sized buffers (based on the new number of channels) and storing them in _swap* instance variables.  If returning and error, it must deallocate any buffers and set to NULL any _swap* variables. Locking: The caller must ensure that the config lock is HELD but that the reporter (data) lock is NOT HELD.
