void *Tcl_AttemptAlloc(int size);

Tcl_AttemptAlloc is a function that was added to the Tcl C API in Tcl 8.4a2.

It is identical in function to Tcl_Alloc, except that Tcl_AttemptAlloc will not cause the Tcl interpreter to panic if the memory allocation fails. If the allocation fails, these functions will instead return NULL; the caller must check for this case. Note that this function is more appropriate when allocating a large memory chunk (e.g., image buffer) when failure is more likely and easier to recover from successfully.

See also