Abstract
Starting from a theoretical understanding of the usefulness logic of a logic programming system with built-in tabling, and from a collector that did not take the characteristics of a tabled abstract machine into account we have build two heap garbage collectors (one mark&slide, one mark©) for XSB on top of the CHAT implementation model for the suspension/resumption of consumers. Based on this experience we discuss implementation issues that are general to heap garbage collection for the WAM and also issues that are specific to an implementation with tabling: as such, this paper documents our own implementation and can serve as guidance for anyone attempting a similar feat. We report on the behaviour of the garbage collectors on different kinds of programs. We also present figures on the extent of internal fragmentation and the effectiveness of early reset in Prolog systems with and without tabling.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
K. Appleby, M. Carlsson, S. Haridi, and D. Sahlin. Garbage collection for Prolog based on WAM. Communications of the ACM, 31(6):719–741, June 1988.
Y. Bekkers, O. Ridoux, and L. Ungaro. Dynamic memory management for sequential logic programming languages. In IWMM’92: International Workshop on Memory Management, number 637 in LNCS, pages 82–102, Sept. 1992. Springer.
J. Bevemyr and T. Lindgren. A simple and efficient copying garbage collector for prolog. In M. Hermenegildo and J. Penjam, editors, Proceedings of the 6th PLILP, number 844 in LNCS, pages 88–101, Madrid, Spain, Sept. 1994. Springer-Verlag.
M. Carlsson. Design and Implementation of an Or-Parallel Prolog Engine. PhD thesis, The Royal Institute of Technology (KTH), Stokholm, Sweden, Mar. 1990.
C. J. Cheney. A nonrecursive list compacting algorithm. Communications of the ACM, 13(11):677–678, Nov. 1970.
B. Demoen, G. Engels, and P. Tarau. Segment preserving copying garbage collection for WAM based Prolog. In Proceedings of the 1996 ACM Symposium on Applied Computing, pages 380–386, Philadelphia, Feb. 1996. ACM Press.
B. Demoen and K. Sagonas. CAT: the Copying Approach to Tabling. In C. Palamidessi, H. Glaser, and K. Meinke, editors, Principles of Declarative Programming, number 1490 in LNCS, pages 21–35, Pisa, Italy, Sept. 1998. Springer.
B. Demoen and K. Sagonas. Memory management for Prolog with tabling. In Proceedings of ISMM’98: ACM SIGPLAN International Symposium on Memory Management, pages 97–106, Vancouver, B.C., Canada, Oct. 1998. ACM Press.
B. Demoen and K. Sagonas. CHAT: the Copy-Hybrid Approach to Tabling. In G. Gupta, editor, Practical Aspects of Declarative Languages (PADL), number 1551 in LNCS, pages 106–121, San Antonio, Texas, Jan. 1999. Springer.
M. S. Johnstone and P. R. Wilson. The memory fragmentation problem: Solved? In Proceedings of ISMM’98: ACM SIGPLAN International Symposium on Memory Management, pages 26–36, Vancouver, B.C., Canada, Oct. 1998. ACM Press.
F. L. Morris. A time-and space-efficient garbage compaction algorithm. Communications of the ACM, 21(8):662–665, Aug. 1978.
E. Pittomvils, M. Bruynooghe, and Y. D. Willems. Towards a real time garbage collector for Prolog. In Proceedings of Symp. on Logic Progr., pages 185–198, 1985.
I. V. Ramakrishnan, P. Rao, K. Sagonas, T. Swift, and D. S. Warren. Efficient access mechanisms for tabled logic programs. J. of Logic Progr., 38(1):31–54, 1999.
K. Sagonas and T. Swift. An abstract machine for tabled execution of fixed-order stratified logic programs. ACM Trans. Prog. Lang. Syst., 20(3):586–634, May 1998.
K. Sagonas, T. Swift, and D. S. Warren. An abstract machine for computing the well-founded semantics. In Proceedings of JICSLP’96, pages 274–288, Sept. 1996.
P.M. Sansom. Combining copying and compacting garbage collection or Dual-mode garbage collection. In Functional Programming, Glasgow, Aug. 1991. Springer.
J. Schimpf. Garbage collection for Prolog based on twin cells. In Proceedings of the 1990 NACLP Implementation Workshop, pages 16–25, Austin, Texas, 1990.
H. Touati and T. Hama. A light-weight Prolog garbage collector. In Proceedings of FGCS’88, pages 922–930, Tokyo, Japan, Nov./Dec. 1988. OHMSHA and Springer.
D. H. D. Warren. An abstract Prolog instruction set. Technical Report 309, SRI International, Menlo Park, U.S.A., Oct. 1983.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1999 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Demoen, B., Sagonas, K. (1999). Heap Garbage Collection in XSB: Practice and Experience. In: Pontelli, E., Santos Costa, V. (eds) Practical Aspects of Declarative Languages. PADL 2000. Lecture Notes in Computer Science, vol 1753. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-46584-7_7
Download citation
DOI: https://doi.org/10.1007/3-540-46584-7_7
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-66992-0
Online ISBN: 978-3-540-46584-3
eBook Packages: Springer Book Archive