Type-Based Amortised Heap-Space Analysis

We present a type system for a compile-time analysis of heap-space requirements of Java style object-oriented programs with explicit deallocation. Our system is based on an amortised complexity analysis: the data is arbitrarily assigned a potential related to its size and layout; allocations must be “payed for” from this potential. The potential of each input then furnishes an upper bound on the heap space usage for the computation on this input. We successfully treat inheritance, downcast, update and aliasing. Example applications for the analysis include destination-passing style and doubly-linked lists. Type inference is explicitly not included; the contribution lies in the system itself and the nontrivial soundness theorem. This extended abstract elides most technical lemmas and proofs, even nontrivial ones, due to space limitations. A full version is available at the authors' web pages.

[1]  Martin Elsman,et al.  Programming with regions in the ML Kit , 1997 .

[2]  Yassine Lakhnech,et al.  Storeless semantics and alias logic , 2003, PEPM '03.

[3]  Matthias Felleisen,et al.  Classes and mixins , 1998, POPL '98.

[4]  Martin Hofmann,et al.  The Embounded project (project start paper) , 2005, Trends in Functional Programming.

[5]  Martin Hofmann,et al.  Static prediction of heap space usage for first-order functional programs , 2003, POPL '03.

[6]  R. Tarjan Amortized Computational Complexity , 1985 .

[7]  David Walker,et al.  Alias Types for Recursive Data Structures , 2000, Types in Compilation.

[8]  Mathieu Baudet,et al.  Controlling and Optimizing the Usage of One Resource , 2003, APLAS.

[9]  Armelle Bonenfant,et al.  Automatic Amortised Worst-Case Execution Time Analysis , 2007, WCET.

[10]  Shengchao Qin,et al.  Memory Usage Verification for OO Programs , 2005, SAS.

[11]  Kathryn S. McKinley,et al.  Reconsidering custom memory allocation , 2002, OOPSLA '02.

[12]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 2001, TOPL.

[13]  Alain Deutsch,et al.  Interprocedural may-alias analysis for pointers: beyond k-limiting , 1994, PLDI '94.

[14]  Mads Tofte,et al.  Region-based Memory Management , 1997, Inf. Comput..

[15]  Reinhard Wilhelm,et al.  A semantics for procedure local heaps and its abstractions , 2005, POPL '05.

[16]  Pierre Jouvelot,et al.  Polymorphic type, region and effect inference , 1992, Journal of Functional Programming.

[17]  Bernd Grobauer,et al.  Topics in Semantics-based Program Manipulation , 2001 .

[18]  John Hughes,et al.  Recursion and dynamic data-structures in bounded space: towards embedded ML programming , 1999, ICFP '99.

[19]  M. Sitaraman,et al.  Modular Verification of Performance Constraints , 2003 .

[20]  Tobias Nipkow,et al.  A machine-checked model for a Java-like language, virtual machine, and compiler , 2006, TOPL.

[21]  Yanhong A. Liu,et al.  Automatic Accurate Live Memory Analysis for Garbage-Collected Languages , 2001, OM '01.

[22]  Chris Okasaki,et al.  Purely functional data structures , 1998 .

[23]  Shengchao Qin,et al.  Memory Usage Inference for Object-Oriented Programs , 2005 .

[24]  Peter W. O'Hearn,et al.  BI as an assertion language for mutable data structures , 2001, POPL '01.

[25]  Yanhong A. Liu,et al.  Automatic time-bound analysis for a higher-order language , 2002, PEPM '02.