Typing Safe Deallocation

  • Gérard Boudol
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4960)


In this work we address the problem of proving, by static analysis means, that allocating and deallocating regions in the store provides a safe way to achieve memory management. That is, the goal is to provably ensure that a program does not use pointers into a deallocated region. A well-known approach to this problem is the one of Tofte and Talpin. Our first contribution is to provide a simple proof, by means of a subject reduction property, of type safety for their region calculus. Our second, main contribution is that we actually do this for an extension of Tofte-Talpin’s calculus, featuring a primitive construct for deallocating regions, similar to C’s free, that allows one to circumvent the strict stack-of-regions discipline enforced in Tofte-Talpin’s calculus. Our static analysis consists in a novel type and effect system, extending the one of Tofte and Talpin, where we record deallocation effects.


Operational Semantic Region Constant Memory Management Evaluation Context Intermediate Language 
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.


  1. 1.
    Aiken, A., Fähndrich, M., Levien, R.: Better static memory management: improving region-based analysis of higher-order languages. In: PLDl 1995, pp. 174–185 (1995)Google Scholar
  2. 2.
    Banerjee, A., Heintze, N., Riecke, J.: Region analysis and the polymorphic lambda-calculus. In: LICS 1999, pp. 88–97 (1999)Google Scholar
  3. 3.
    Birkedal, L., Tofte, M., Vejlstrup, M.: From region inference to von Neumann machines via region representation inference. In: POPL 1996, pp. 171–183 (1996)Google Scholar
  4. 4.
    Calcagno, C.: Stratified operational semantics for safety and correctness of the region calculus. In: POPL 2001, pp. 155–165 (2001)Google Scholar
  5. 5.
    Calcagno, C., Helsen, S., Thiemann, P.: Syntactic type soundness results for the region calculus. Information and Computation 173(2), 199–221 (2002)zbMATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    Dal Zilio, S., Gordon, A.: Region analysis and a π-calculus with groups. J. of Functional Programming 12(3), 229–292 (2002)zbMATHCrossRefGoogle Scholar
  7. 7.
    Fähndrich, M., DeLine, R.: Adoption and focus: practical linear types for imperative programming. In: PLDI 2002, pp. 13–24 (2002)Google Scholar
  8. 8.
    Fluet, M., Morrisett, G., Ahmed, A.: Linear regions are all you need. In: Sestoft, P. (ed.) ESOP 2006 and ETAPS 2006. LNCS, vol. 3924, Springer, Heidelberg (2006)CrossRefGoogle Scholar
  9. 9.
    Gay, D., Aiken, A.: Memory management with explicit regions. In: PLDI 1998, pp. 313–323 (1998)Google Scholar
  10. 10.
    Gay, D., Aiken, A.: Language support for regions. In: PLDI 2001, pp. 70–80 (2001)Google Scholar
  11. 11.
    Helsen, S., Thiemann, P.: Syntactic type soundness for the region calculus. HOOTS 2000, ENTCS 41(3), 1–19 (2001)Google Scholar
  12. 12.
    Henglein, F., Makholm, H., Niss, F.: A direct approach to control-flow sensitive region-based memory management. In: PPDP 2001, pp. 175–186 (2001)Google Scholar
  13. 13.
    Henglein, F., Makholm, H., Niss, F.: Effect Types and Region-Based Memory Management. In: Pierce, B.C. (ed.) Chap. 3 of Advanced Topics in Types and Programming Languages, pp. 87–135. MIT Press, Cambridge (2005)Google Scholar
  14. 14.
    Lucassen, J.M., Gifford, D.K.: Polymorphic effect systems. In: POPL 1988, pp. 47–57 (1988)Google Scholar
  15. 15.
    Tofte, M., Talpin, J.-P.: Implementation of the typed call-by-value λ-calculus using a stack of regions. In: POPL 1994, pp. 188–201 (1994)Google Scholar
  16. 16.
    Tofte, M., Talpin, J.-P.: Region-based memory management. Information and Computation 132(2), 109–176 (1997)zbMATHCrossRefMathSciNetGoogle Scholar
  17. 17.
    Tofte, M., Birkedal, L., Elsman, M., Hallenberg, N.: A retrospective on region-based memory management. HOSC 17(2), 245–265 (2004)zbMATHGoogle Scholar
  18. 18.
    Walker, D., Crary, K., Morrisett, G.: Typed memory management via static capabilities. TOPLAS 22(4), 701–771 (2000)CrossRefGoogle Scholar
  19. 19.
    Walker, D., Watkins, K.: On regions and linear types. In: ICFP 2001, pp. 181–192 (2001)Google Scholar
  20. 20.
    Wright, A., Felleisen, M.: A syntactic approach to type soundness. Information and Computation 115(1), 38–94 (1994)zbMATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Gérard Boudol
    • 1
  1. 1.INRIA, 06902 Sophia AntipolisFrance

Personalised recommendations