Go to the first, previous, next, last section, table of contents.


3.1 Memory Management

The memory_t module is the foundation of our library. All memory management is performed in a portable manner using the memory_t module, which helps identify memory leaks without using expensive and nonportable third party applications, such as purify. The memory_create() function replaces malloc(), while the memory_destroy() function replaces free(). Other functions are provided to replace the standard C memory functions.

The vector_t module is also widely used, and is equally indispensable. A vector_t is a length-delimited sequence of objects of arbitrary type. The objects are parameterized by the size of their representations, via the sizeof() primitive. The vector_t module supports dynamic resizing, concatenation, insertion, sorting, and portable input/output. Indeed, we often use vector_t where LISP programmers would use lists. Since the vector_t objects aren't boxed and are arranged linearly in memory, vector_t operations are at least twice as fast as lists and require significantly less storage than lists (eg., up to 16 times less storage for one byte objects on a machine with 8 byte pointers).


Go to the first, previous, next, last section, table of contents.