# %free() function

The %free() function frees a block of
memory allocated by a call to %malloc().

## Syntax

```
(void)%free((char*)pointer)
```

## Parameter(s)

| pointer | Pointer to the area of memory allocated by a previous call to %malloc(). |
| --- | --- |
CAUTION: The result is unpredictable if *pointer* does not contain a valid address and can corrupt
memory. If this is suspected, exit the D3 process and restart the
line.

## Example(s)

```
%free((char*)ptr)
```

## See also

- [%malloc() function](https://d3codex.com/pickbasic-flashbasic/percent-malloc-function/)
- [FlashBASIC C functions overview](https://d3codex.com/pickbasic-flashbasic/flashbasic-c-functions-overview/)
- [cfunction statement](https://d3codex.com/pickbasic-flashbasic/cfunction-statement/)

---
Source: https://d3codex.com/pickbasic-flashbasic/percent-free-function/ - part of the D3Codex reference.
