# OS_ClearHeap

## Syntax

      #include <nitro/os.h>

      void OS_ClearHeap( OSArenaId id, OSHeapHandle heap, void* start, void* end );

## Arguments

id | Arena ID of the arena that includes the heap being cleared
heap | Heap handler of the heap to be cleared
start | Starting address of heap region
end | Ending address of address of heap region (+1)

## Return Values

None.

## Description

Clears and initializes an existing heap.

All memory blocks secured in heap are destroyed. Specify the heap region using start and end. If there is an isolated region of heap due to the use of the `OS_AddToHeap` or `OS_AddExtraAreaToHeap` function, that region is not initialized. Moreover, upon initialization, that region will be removed from a part. Caution should be exercised when initializing the heap.

This is a function for an ordinary heap created using the `OS_CreateHeap` function. Use the `OS_ClearExtraHeap` function for special heaps created using the `OS_CreateExtraHeap` function.

## See Also

`OS_InitAlloc`
`OS_AddToHeap`
`OS_ClearExtraHeap`

## Revision History

2009/04/03 Added description of special heaps.
2004/11/08 Initial version.

CONFIDENTIAL