Name
XtMalloc — allocate storage.
Synopsis
char ∗XtMalloc(size);
unsigned int size;
Arguments
sizeSpecifies the number of bytes desired.
Description
XtMalloc returns a pointer to a block of storage of at least the specified size bytes. If there is insufficient memory to allocate the new block, XtMalloc terminates by calling XtErrorMsg.
If a widget is passed a pointer to resource data, it is expected to recopy the actual data into space of its own, so the application can do whatever it wants with its own data. The best way to preserve data is to allocate memory with XtMalloc and copy the data there.
XtMalloc makes no guarantee about the contents of the memory when it is allocated.
Memory allocated with XtMalloc must be deallocated with XtFree. The function XtMalloc is implemented by the Toolkit independently of the particular environment, so programs ported to a system not supporting malloc will still work.
XtNew and XtNewString provide slightly higher-level approaches to memory allocation.
See Also
XtCalloc(1), XtErrorMsg(1), XtFree(1), XtNew(1), XtNewString(1), XtRealloc(1).