Understanding Memory Management in Prolog Systems

Actual performance of Prolog based applications largely depends on how the underlying system implements memory management. Most Prolog systems are based on the WAM, which is built around a set of stacks. TheWAM is highly optimized to recover memory on backtracking and on tail-recursive predicates. Still, deterministic computations can create intermediate structures that can only be freed through garbage collection.There is a significant amount of literature regarding memory management for Prolog. Unfortunately, we found relatively little data on how modern Prolog systems perform memory-wise. Open questions range from whether Prolog systems consume the same amount of space, to how effective garbage collection is in practice, and to whether we should be using sliding or copying based garbage collectors.This work aims at investigating the practicalasp ects of memory management in Prolog systems. We present a methodology to compare the memory performance of such systems, and we use it to compare two different WAM-based systems, namely XSB and Yap. We suggest novel techniques for variable shunting and we propose a scheme that can improve the performance of sliding-based garbage collectors. Last, we evaluate our methodology with larger-scale applications.

[1]  C. R. Ramakrishnan,et al.  Fighting Livelock in the i-Protocol: A Comparative Study of Verification Tools , 1999, TACAS.

[2]  Mats Carlsson,et al.  Variable Shunting for the WAM , 1991 .

[3]  Rafael Dueire Lins,et al.  Garbage collection: algorithms for automatic dynamic memory management , 1996 .

[4]  Mats Carlsson,et al.  Garbarge collection for Prolog based on WAM , 1988, CACM.

[5]  Evan Tick,et al.  Memory performance of Prolog architectures , 1987, The Kluwer international series in engineering and computer science.

[6]  David H. D. Warren,et al.  Applied logic : its use and implementation as a programming tool , 1978 .

[7]  James Cussens,et al.  Markov Chain Monte Carlo using Tree-Based Priors on Model Structure , 2001, UAI.

[8]  Soo-Mook Moon,et al.  Reducing sweep time for a nearly empty heap , 2000, POPL '00.

[9]  Gertjan van Noord FSA Utilities: A Toolbox to Manipulate Finite-State Automata , 1996, Workshop on Implementing Automata.

[10]  Bart Demoen,et al.  Heap Garbage Collection in XSB: Practice and Experience , 2000, PADL.

[11]  Dan Sahlin Making garbage collection independent of the amount of garbage , 1987 .

[12]  Bart Demoen,et al.  So Many WAM Variations, So Little Time , 2000, Computational Logic.

[13]  Bart Demoen Early reset and reference counting improve variable shunting in the WAM , 2000 .

[14]  Juliana Freire,et al.  The XSB Programmer’s Manual , 1800 .

[15]  Mats Carlsson,et al.  SICStus Prolog User''s Manual , 1993 .