next up previous contents index
Next: Compiling and Consulting Up: System Description Previous: Command Line Arguments   Contents   Index


Memory Management

All execution stacks are automatically expanded in Version 2.5, including the local stack/heap region, the trail/choice point region, and the completion stack region. Each of these regions begin with an initial value set by the user (or the default stated in Section 3.5), and double their size until it is not possible to do so with available system memory. At that point XSB tries to find the maximal amount of space that will still fit in system memory. Garbage collection is automatically performed for retracted clauses. In addition, heap garbage collection is automatically included in XSB [8,20]. (To change the algorithm used for heap garbage collection or to turn it off altogether, see the predicate garbage_collection/1 or Section 3.5 for command-line options).

The program area (the area into which the code is loaded) is also dynamically expanded as needed, and the area occupied by dynamic code (created using assert/1, or the standard predicate load_dyn/1) is reclaimed when that code is retracted. Version 2.5 provides memory management for table space as well. Space for tables is dynamically allocated as needed and reclaimed through use of the predicates abolish_all_tables/0 and abolish_table_pred/1 (see Section 6.13).


next up previous contents index
Next: Compiling and Consulting Up: System Description Previous: Command Line Arguments   Contents   Index
Luis Fernando P. de Castro 2003-06-27