Region-Based Memory Management for a Dynamically-Typed Language

  • Akihito Nagata
  • Naoki Kobayashi
  • Akinori Yonezawa
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3302)


Region-based memory management scheme has been proposed for the programming language ML. In this scheme, a compiler statically estimates the lifetime of each object by performing an extension of type inference (called region inference) and inserts code for memory allocation and deallocation. Advantages of this scheme are that memory objects can be deallocated safely (unlike with manual memory management using malloc/free) and often earlier than with run-time garbage collection. Since the region inference is an extension of the ML type inference, however, it was not clear whether the region-based memory management was applicable to dynamically-typed programming languages like Scheme. In this paper, we show that the region-based memory management can be applied to dynamically-typed languages by combining region inference and Cartwright et al.’s soft type system.


Type System Target Language Operational Semantic Garbage Collection Memory Management 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Aiken, A., Fahndrich, M., Levien, R.: Better static memory management: Improving region-based analysis of higher-order languages. In: Proc. of PLDI, pp. 174–185 (1995)Google Scholar
  2. 2.
    Birkedal, L., Tofte, M., Vejlstrup, M.: From region inference to von Neumann machines via region representation inference. In: Proc. of POPL, pp. 171–183. ACM Press, New York (1996)Google Scholar
  3. 3.
    Boyapati, C., Salcianu, A., Beebee, W., Rinard, J.: Ownership types for safe region-based memory management in Real-Time Java (2003)Google Scholar
  4. 4.
    Calcagno, C., Helsen, S., Thiemann, P.: Syntactic type soundness results for the region calculus. Info. Comput. 173(2), 199–221 (2002)MathSciNetCrossRefzbMATHGoogle Scholar
  5. 5.
    Cartwright, R., Fagan, M.: Soft typing. In: Proc. of PLDI, pp. 278–292 (1991)Google Scholar
  6. 6.
    Crary, K., Walker, D., Morrisett, G.: Typed memory management in a calculus of capabilities. In: Proc. of POPL, New York, NY, pp. 262–275 (1999)Google Scholar
  7. 7.
    Deters, M., Cytron, R.K.: Automated discovery of scoped memory regions for real-time java. In: Proceedings of ISMM 2002, pp. 25–35. ACM Press, New York (2002)Google Scholar
  8. 8.
    Gabriel, R.: Scheme version of the gabriel lisp benchmarks (1988)Google Scholar
  9. 9.
    Gay, D., Aiken, A.: Memory management with explicit regions. In: Proc. of PLDI, pp. 313–323 (1998)Google Scholar
  10. 10.
    Gay, D., Aiken, A.: Language support for regions. In: Proc. of PLDI, pp. 70–80 (2001)Google Scholar
  11. 11.
    Grossman, D., Morrisett, G., Jim, T., Hicks, M., Wang, Y., Cheney, J.: Region-based memory management in Cyclone. In: SIGPLAN Conference on Programming Language Design and Implementation, pp. 282–293 (2002)Google Scholar
  12. 12.
    Hallenberg, N., Elsman, M., Tofte, M.: Combining region inference and garbage collection. In: Proc. of PLDI, pp. 141–152. ACM Press, New York (2002)Google Scholar
  13. 13.
    Igarashi, A., Kobayashi, N.: Resource usage analysis. ACM Trans. Prog. Lang. Syst. (to appear); A summary appeared in Proc. of POPL, pp. 331–342 (2002)Google Scholar
  14. 14.
    Kelsey, R., Clinger, W., Rees, J. (eds.): Revised5 report on the algorithmic language Scheme. ACM SIGPLAN Notices, vol. 33(9), pp. 26–76 (1998)Google Scholar
  15. 15.
    Kobayashi, N.: Quasi-linear types. In: Proc. of POPL, pp. 29–42 (1999)Google Scholar
  16. 16.
    Lee, O., Yang, H., Yi, K.: Inserting safe memory reuse commands into ml-like programs. In: Cousot, R. (ed.) SAS 2003. LNCS, vol. 2694, pp. 171–188. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  17. 17.
    Makholm, H.: Region-based memory management in Prolog. Master’s thesis, DIKU, University of Copenhagen (2000)Google Scholar
  18. 18.
    Makholm, H.: A region-based memory manager for Prolog. In: B. Demoen (ed.) First Workshop on Memory Management in Logic Programming Implementations, CL 2000, vol. CW 294, London, England, pp. 28–40, Katholieke Universiteit Leuven (2000)Google Scholar
  19. 19.
    Nagata, A., Kobayashi, N., Yonezawa, A.: Region-based memory management for a dynamically-typed language (2004), Full version, available from:
  20. 20.
    Pessaux, F., Leroy, X.: Type-based analysis of uncaught exceptions. In: Proc. of POPL, pp. 276–290 (1999)Google Scholar
  21. 21.
    Rehof, J.: Polymorphic dynamic typing. Aspects of proof theory and inferencej. Master’s thesis, DIKU, University of Copenhagen (August 1995)Google Scholar
  22. 22.
    Tofte, M., Birkedal, L.: A region inference algorithm. ACM Trans. Prog. Lang. Syst. 20(4), 724–767 (1998)CrossRefzbMATHGoogle Scholar
  23. 23.
    Tofte, M., Talpin, J.-P.: Implementing the call-by-value lambda-calculus using a stack of regions. In: Proc. of POPL, pp. 188–201. ACM Press, New York (1994)Google Scholar
  24. 24.
    Turner, D.N., Wadler, P., Mossin, C.: Once upon a type. In: Proc. of Functional Programming Languages and Computer Architecture, San Diego, California, pp. 1–11 (1995)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Akihito Nagata
    • 1
  • Naoki Kobayashi
    • 2
  • Akinori Yonezawa
    • 1
  1. 1.Dept. of Computer ScienceUniversity of TokyoJapan
  2. 2.Dept. of Computer ScienceTokyo Institute of TechnologyJapan

Personalised recommendations