Sun Java System Web Server 7.0 Update 4 NSAPI Developer's Guide

CALLOC() Macro

The CALLOC macro is a platform-independent substitute for the C library routine calloc. It allocates size bytes from the request’s memory pool and initializes the memory to zeros. The memory can be explicitly freed by a call to FREE. If the memory is not explicitly freed, it is automatically freed after processing of the current request has been completed. If pooled memory has been disabled in the configuration file with the pool-init built-in SAF, PERM-CALLOC and CALLOC both obtain their memory from the system heap. However, because memory allocated by CALLOC is automatically freed, the memory should not be shared with threads.


void *CALLOC(int size)

Return Values

A void pointer to a block of memory.


int size is the number of bytes to allocate.


char *name;
name = (char *) CALLOC(100);

See Also

FREE() Macro, MALLOC() Macro, REALLOC() Macro, STRDUP() Macro, PERM_CALLOC() Macro