 |
free |
Function (ROM Call 0xA3) |
Frees an allocated block.
free deallocates a memory block allocated by a previous call to
malloc or calloc.
Note: free is in fact an ANSI C alias for a TIOS routine originally called
HeapFreePtr.
Do not attempt to use free on a pointer which has changed after it was allocated
with malloc, calloc,
or realloc. For example, the following code
will certainly crash the calculator:
char *ptr = malloc (2);
if (ptr)
{
*(ptr++) = 'A'; // pointer changed here
*ptr = 0;
...
free (ptr);
}
Instead, preserve the original pointer and pass it to free.
Uses: HeapFree
See also: malloc, realloc, calloc