Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ XtFree(3x) — HP-UX ANSI C A.10.11

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XtCalloc(1)

XtMalloc(1)

XtNew(1)

XtNewString(1)

XtRealloc(1)

 

NAME

XtFree − free allocated memory. 

Synopsis

void XtFree(ptr);

    char *ptr;

Inputs

ptrSpecifies the address of the allocated memory to be freed. 

Description

XtFree() 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 provides 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 Also

XtCalloc(1), XtMalloc(1), XtNew(1), XtNewString(1), XtRealloc(1). 

Copyright O’Reilly & Assoc.  —  X Toolkit Intrinsics Reference Manual © O’Reilly & Associates

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026