Memory Management

The standard C library memory allocation functions (malloc, calloc, realloc, and free) are available in foreign code, but cannot reuse any free memory that SICStus Prolog’s memory manager may have available, and so may contribute to memory fragmentation.

The following functions provide the same services via SICStus Prolog’s memory manager.


Allocates a piece of memory.


Allocates memory for an array of elements, and clears the allocated memory.


Changes the size of an allocated piece of memory.


Deallocates a piece of memory.


Makes a copy of a string in allocated memory.

Send feedback on this subject.