Next: , Up: Operating System Services   [Contents][Index]


6.4.7.1 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.

SP_malloc()

Allocates a piece of memory.

SP_calloc()

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

SP_realloc()

Changes the size of an allocated piece of memory.

SP_free()

Deallocates a piece of memory.

SP_strdup()

Makes a copy of a string in allocated memory.


Send feedback on this subject.