# FreeMem

Frees memory from AllocMem().

### Synopsis

`void FreeMem( void *p, int32 size )`

### Description

This macro frees memory that was previously allocated by a call to `AllocMem()`. The size argument specifies the number of bytes to free. The freed memory is automatically returned to the memory list from which it was allocated.

### Arguments

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

size
  The size of the block to free, in bytes. This must be the same size that was specified when the block was allocated. If the memory being freed was allocated using MEMTYPE_TRACKSIZE, this argument should be set to -1.

### Implementation

Macro implemented in mem.h V20.

### Associated Files

mem.h
  ANSI C Macro definition

### 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.

### See Also

``AllocMem`()`

#