# free

Frees memory from malloc().

### Synopsis

`void free( void *p )`

### Description

The procedure frees a memory block that was allocated by a call to `malloc()`. It is identical to the `free()` procedure in standard C library. The freed memory is automatically returned to the memory list from which it was allocated.

Note: You should only use `malloc()` and `free()` when porting existing C programs to Portfolio. If you are writing programs specifically for Portfolio, use `AllocMem()` and `FreeMem()`, which allow you to specify the type of memory to allocate, such as VRAM or memory that begins on a page boundary.

### Arguments

p
  A pointer to the memory to be freed. This pointer may be NULL, in which case this function just returns.

### Implementation

Convenience call implemented in clib.lib V20.

### Associated Files

stdlib.h
  ANSI C Prototype

clib.lib
  ARM Link Library

### Notes

You can enable memory debugging in your application by compiling your entire project with the MEMDEBUG value defined on the compiler's command-line. Refer to the `CreateMemDebug()` function for more details.

### Caveats

Trusts that p is a result of a previous `malloc()` call.

### See Also

``FreeMem`(), FreeMemToMemList(), FreeMemToMemLists(), malloc()`

#