> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ApuHeapGetState

> ApuHeapGetState

# ApuHeapGetState

Queries the current state of the APU physical heap.

## Syntax

```cpp theme={null}
HRESULT ApuHeapGetState(  
         ApuHeapState* apuHeapState,  
         UINT32 flags = APU_ALLOC_CACHED  
)  
```

### Parameters

*apuHeapState*   \_Out\_\
Type: [ApuHeapState\*](/reference/audio/apu/structs/apuheapstate)

Current state of the heap.

*flags*   \
Type: UINT32

Heap to query: `APU_ALLOC_CACHED` for the cached heap, or `APU_ALLOC_NONCACHED` for the non-cached heap.

### Return value

Type: HRESULT

| Return code                  | Description                     |
| :--------------------------- | :------------------------------ |
| S\_OK                        | Success                         |
| APU\_E\_HEAP\_NOT\_ALLOCATED | APU heap has not been allocated |
| E\_INVALIDARG                | Invalid argument                |

## Remarks

This function returns an [ApuHeapState](/reference/audio/apu/structs/apuheapstate) structure.

To create an APU heap, call [ApuCreateHeap](/reference/audio/apu/functions/apucreateheap). An APU heap persists for the lifetime of the process.

## Requirements

**Header:** apu.h

**Library:** acphal.lib

**Supported platforms:** XBOX One family consoles and XBOX Series consoles

## See also

[ApuHeapState](/reference/audio/apu/structs/apuheapstate)\
[APU](/reference/audio/apu/apu_members)


## Related topics

- [ApuHeapState](/reference/audio/apu/structs/apuheapstate.md)
- [APU (Audio Processing Unit)](/reference/audio/apu/apu_members.md)
- [ApuCreateHeap](/reference/audio/apu/functions/apucreateheap.md)
- [XApuStateOptions](/reference/audio/xapu/enums/xapustateoptions.md)
- [XApuProcessType](/reference/audio/xapu/enums/xapuprocesstype.md)
