Heap Memory Management in Prolog with Tabling: Principles and Practice

Click on the title to obtain a gzip-ed PostScript version of the paper (190K).


Abstract:

We address memory management aspects of WAM-based logic programming systems that support tabled evaluation through the use of a suspension/resumption mechanism. We describe the memory organization and usefulness logic of such systems, and issues that have to be resolved for effective and efficient garbage collection. Special attention is given to early reset in the context of suspended computations and to what is involved in the implementation of a segment order preserving copying collector for a tabled Prolog system. We also report our experience from building two working heap garbage collectors (one mark & slide and one mark & copy) for the XSB system on top of a CHAT-based tabled abstract machine: we discuss general implementation choices for heap garbage collection in `plain' WAM and issues that are specific to WAM with tabling. Finally, we compare the performance of our collectors with those of other Prolog systems and extensively analyze their characteristics. Thus, this article documents our own implementation and serves as guidance to anyone interested in proper memory management of tabled systems or systems that are similar in certain aspects.