XtFree()XtFree()NameXtFree - free allocated memory.
Synopsis
void XtFree(ptr);
char *ptr;
Inputs
ptr Specifies the address of the allocated memory to be freed.
DescriptionXtFree() frees a block of memory previously allocated by XtMalloc(),
XtRealloc(), XtCalloc(), XtNew() or XtNewString() so that it can be
reused by the system.
If ptr is NULL, XtFree() returns immediately.
Usage
The ptr argument is of type char *. In many cases, you will have to
cast the data you are freeing to this type in order to avoid warning
messages from your compiler.
A number of Xt functions return strings or other values that must be
freed with XtFree() when the caller will no longer need them. You
should be sure to check the documentation of any function that returns
a value to find out who "owns" the memory and who is expected to free
it.
Calling the Toolkit's XtMalloc() and XtFree() is more portable and pro‐
vides better error checking than calling system-specific malloc and
free. You should not use XtFree() on memory that was allocated with
malloc() or other non-Xt memory allocation routines.
See AlsoXtCalloc(1), XtMalloc(1), XtNew(1), XtNewString(1), XtRealloc(1).
Xt - Memory Allocation XtFree()