# OS_FreeAllToHeap

## C Specification

      #include <nitro/os.h>

      void OS_FreeAllToHeap( OSArenaId id, OSHeapHandle heap );

      void OS_FreeAllToMain( void );
      void OS_FreeAllToSubPriv( void );
      void OS_FreeAllToMainEx( void );
      void OS_FreeAllToITCM( void );
      void OS_FreeAllToDTCM( void );
      void OS_FreeAllToShared( void );
      void OS_FreeAllToWramMain( void );
      void OS_FreeAllToWramSub( void );
      void OS_FreeAllToSubPrivWram( void );

      void OS_FreeAll( void );

## Arguments

id | Arena ID of the arena for the heap for which all memory blocks are being released.
heap | Handle of the heap from which all memory blocks are being freed.

## Return Values

None.

## Description

This function frees all allocated memory blocks and returns them to the heap specified by heap.

You must specify an arena that has a heap. The arena is specified with the arena ID (id). To read more about this value, see `OS_InitArena()`.

Specifying OS_CURRENT_HEAP_HANDLE for heap is treated the same as if the arena's current heap had been specified.

`OS_FreeAllToMain()` is the inline function for `OS_FreeAllToHeap( OS_ARENA_MAIN, OS_CURRENT_HEAP_HANDLE, ...` .
`OS_FreeAllToSubPriv()` is the inline function for `OS_FreeAllToHeap( OS_ARENA_MAIN_SUBPRIV, OS_CURRENT_HEAP_HANDLE, ...` .
`OS_FreeAllToMainEx()` is the inline function for `OS_FreeAllToHeap( OS_ARENA_MAINEX, OS_CURRENT_HEAP_HANDLE, ...` .
`OS_FreeAllToICTM()` is the inline function for `OS_FreeAllToHeap( OS_ARENA_ITCM, OS_CURRENT_HEAP_HANDLE, ...` .
`OS_FreeAllToDTCM()` is the function for of `OS_FreeAllToHeap( OS_ARENA_DTCM, OS_CURRENT_HEAP_HANDLE, ...` .
`OS_FreeAllToShared()` is the inline function for `OS_FreeAllToHeap( OS_ARENA_SHARED, OS_CURRENT_HEAP_HANDLE, ...` .
`OS_FreeAllToWramMain()` is the inline function for `OS_FreeAllToHeap( OS_ARENA_WRAM_MAIN, OS_CURRENT_HEAP_HANDLE, ...` .
`OS_FreeAllToWramSub()` is the inline function for `OS_FreeAllToHeap( OS_ARENA_WRAM_SUB, OS_CURRENT_HEAP_HANDLE, ...` .
`OS_FreeAllToSubPrivWram()` is the inline function for `OS_FreeAllToHeap( OS_ARENA_WRAM_SUBPRIV, OS_CURRENT_HEAP_HANDLE, ...`

For ARM9, `OS_FreeAll()` is the inline function for `OS_FreeAllToHeap( OS_ARENA_MAIN, OS_CURRENT_HEAP_HANDLE, … )`.
For ARM7, `OS_FreeAll()` is the inline function for `OS_FreeAllToHeap( OS_ARENA_MAIN_SUBPRIV, OS_CURRENT_HEA_HANDLE, … )`

## See Also

`OS_InitArena, OS_AllocFromHeap, OS_FreeToHeap`

## Revision History

11/05/2004 Initial Version