# OS_ClearExtraHeap

## Syntax

      #include <nitro/os.h>

      void OS_ClearExtraHeap( OSArenaId id, OSHeapHandle heap );

## Arguments

id | Arena ID of the arena that includes the special heap to be cleared
heap | Heap handler of the special heap to be cleared

## Return Values

None.

## Description

Clears and initializes an existing special heap.

This function clears the special heap created by the `OS_CreateExtraHeap` function. Use the `OS_ClearHeap` function for ordinary heaps created using the `OS_CreateHeap` function.

The arena ID should be an argument for the `OS_CreateExtraHeap` function, and heap, the heap handler, should be the return value for the `OS_CreateExtraHeap` function. Nothing happens if a value is specified that is different from the parameter for the special heap held internally on the system.

All memory blocks secured in heap are destroyed. However, that is for the 16-KB region at the top of the main memory, and when there is an enclave by the `OS_AddToHeap` function, that does not get targeted for initialization. Moreover, caution is advised because upon initialization, that region is removed from part of the heap.

This function cannot be called for NITRO ROM and TWL limited ROM. (It exists only for hybrid ROM builds, so a compile error is generated. ) Also, This function does nothing even if called while a hybrid ROM is running on TWL hardware in TWL mode.

## See Also

`OS_InitAlloc`
`OS_CreateExtraHeap`
`OS_AddExtraAreaToHeap`

## Revision History

2009/04/03 Initial version.

CONFIDENTIAL