ChorusOS 4.0 Migration Guide

3.2 malloc()

The standard memory allocation package, including the malloc() and free() functions have been reimplemented in the ChorusOS 4.0 operating system. To maintain compatibility with ChorusOS 3.2 malloc(), use the lib/classix/libomalloc.a library.

The package is based on the Solaris libc implementation and extended to release freed memory to the operating system. Yet, calling free() does not automatically return memory to the system. Since memory chunks are allocated by malloc() from page-aligned regions, these regions are only returned when all the chunks in the region have been freed. Furthermore, free() buffers memory chunks so that they can be reused by malloc(). As a result, memory will not be returned to the operating system until malloc() is called again. Use malloc_trim() to explicitly release this memory.

See the malloc(3STDC) man page for more information.