Improving Memory Usage in the BEAM

  • Ricardo Lopes
  • Vítor Santos Costa
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3350)

Abstract

A critical issue in the design of logic programming systems is their memory performance, both in terms of total memory usage and locality in memory accesses. BEAM, as most modern Prolog systems, requires both good emulator design and good memory performance for best performance. We report on a detailed study of the memory management techniques used on our sequential implementation of the EAM. We address questions like how effective are the techniques the BEAM uses to recover and reuse memory space, how garbage collection affects performance and how to classify and unify variables in a EAM environment. We also propose a finer variable allocation scheme to reduce memory overheads that is quite effective at reducing memory pressure, with only a small overhead.

Keywords

Logic Programming Extended Andorra Model MemoryManagement Language Implementation 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Ali, K.A.M.: A Simple Generational Real-Time Garbage Collection Scheme. New Generation Computing 16(2), 201–221 (1998)CrossRefGoogle Scholar
  2. 2.
    Appleby, K., Carlsson, M., Haridi, S., Sahlin, D.: Garbage collection for Prolog based on WAM. Communications of the ACM 31(6), 171–183 (1989)Google Scholar
  3. 3.
    Bevemyr, J., Lindgren, T.: PLILP 1994. LNCS, vol. 844, pp. 88–101. Springer, Heidelberg (1994)Google Scholar
  4. 4.
    Castro, L.F., Santos Costa, V.: Understanding Memory Management in Prolog Systems. In: Codognet, P. (ed.) ICLP 2001. LNCS, vol. 2237, p. 11. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  5. 5.
    Demoen, B., Nguyen, P.: So Many WAM Variations, So Little Time. In: Palamidessi, C., Moniz Pereira, L., Lloyd, J.W., Dahl, V., Furbach, U., Kerber, M., Lau, K.-K., Sagiv, Y., Stuckey, P.J. (eds.) CL 2000. LNCS (LNAI), vol. 1861, pp. 1240–1254. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  6. 6.
    Detlefs, D., Dosser, A., Zorn, B.: Memory allocation costs in large C and C++ programs. Software, Practice and Experience 24(6) (1994)Google Scholar
  7. 7.
    Gupta, G., Warren, D.H.D.: An Interpreter for the Extended Andorra Model. Technical report, Dep. of Computer Science, University of Bristol (November 1991)Google Scholar
  8. 8.
    Jaffar, J., Maher, M.: Constraint Logic Programming: a Survey. The Journal of Logic Programming 19/20 (May/July 1994)Google Scholar
  9. 9.
    Jones, R., Lins, R.: Garbage Collection: Algorithms for Automatic Dynamic Memory Management. John Wiley and Sons, Chichester (1996) (reprinted February 1997)Google Scholar
  10. 10.
    Lopes, R.: An Implementation of the Extended Andorra Model. PhD thesis, Universidade do Porto (December 2001)Google Scholar
  11. 11.
    Lopes, R., Castro, L., Costa, V.: From Simulation to Pratice: Cache Performance Study of a Prolog Systems. ACM SIGPLAN Notices 38(2), 56–64 (2003)CrossRefGoogle Scholar
  12. 12.
    Lopes, R., Costa, V.S., Silva, F.: A novel implementation of the extended Andorra model. In: Ramakrishnan, I.V. (ed.) PADL 2001. LNCS, vol. 1990, pp. 199–213. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  13. 13.
    Lopes, R., Costa, V.S., Silva, F.: On deterministic computations in the extended andorra model. In: Palamidessi, C. (ed.) ICLP 2003. LNCS, vol. 2916, pp. 407–421. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  14. 14.
    Lopes, R., Santos Costa, V., Silva, F.: Prunning in the extended andorra model. In: Jayaraman, B. (ed.) PADL 2004. LNCS, vol. 3057, pp. 120–134. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  15. 15.
    Ozawa, T., Hosoi, A., Hattori, A.: Generation Type Garbage Collection for Parallel Logic Languages. In: Proceedings of the North American Conference on Logic Programming, pp. 291–305. MIT Press, Cambridge (1990)Google Scholar
  16. 16.
    Santos Costa, V.: Optimising bytecode emulation for prolog. In: Nadathur, G. (ed.) PPDP 1999. LNCS, vol. 1702, pp. 261–267. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  17. 17.
    Shapiro, E.: The family of Concurrent Logic Programming Languages. ACM computing surveys 21(3), 412–510 (1989)CrossRefGoogle Scholar
  18. 18.
    Warren, D.H.D.: An Abstract Prolog Instruction Set. Technical Note 309, SRI International (1983)Google Scholar
  19. 19.
    Warren, D.H.D.: The Extended Andorra Model with Implicit Control. Presented at ICLP 1990 Workshop on Parallel Logic Programming, Eilat, Israel (June 1990)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Ricardo Lopes
    • 1
  • Vítor Santos Costa
    • 2
  1. 1.DCC-FC & LIACCUniversity of PortoPortoPortugal
  2. 2.COPPE/SistemasUniversidade Federal do Rio de JaneiroBrasil

Personalised recommendations