Skip to main content

A Space Consumption Analysis by Abstract Interpretation

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 6324))

Abstract

Safe is a first-order functional language with an implicit region-based memory system and explicit destruction of heap cells. Its static analysis for inferring regions, and a type system guaranteeing the absence of dangling pointers have been presented elsewhere.

In this paper we present a new analysis aimed at inferring upper bounds for heap and stack consumption. It is based on abstract interpretation, being the abstract domain the set of all n-ary monotonic functions from real non-negative numbers to a real non-negative result. This domain turns out to be a complete lattice under the usual \(\sqsubseteq\) relation on functions. Our interpretation is monotonic in this domain and the solution we seek is the least fixpoint of the interpretation.

We first explain the abstract domain and some correctness properties of the interpretation rules with respect to the language semantics, then present the inference algorithms for recursive functions, and finally illustrate the approach with the upper bounds obtained by our implementation for some case studies.

Work partially funded by the projects TIN2008-06622-C03-01/TIN (STAMP), S-0505/ TIC/ 0407 (PROMESAS) and the MEC FPU grant AP2006-02154.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Albert, E., Arenas, P., Genaim, S., Puebla, G.: Automatic Inference of Upper Bounds for Recurrence Relations in Cost Analysis. In: Alpuente, M., Vidal, G. (eds.) SAS 2008. LNCS, vol. 5079, pp. 221–237. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  2. Albert, E., Genaim, S., Gómez-Zamalloa, M.: Heap Space Analysis for Java Bytecode. In: Proc. Int. Symp. on Memory Management, ISMM’07, Montreal, Canada, pp. 105–116. ACM, New York (2007)

    Google Scholar 

  3. Albert, E., Genaim, S., Gómez-Zamalloa, M.: Live Heap Space Analysis for Languages with Garbage Collection. In: Proc. Int. Symp. on Memory Management, ISMM’09, Dublin, Ireland, pp. 129–138. ACM, New York (2009)

    Google Scholar 

  4. de Dios, J., Peña, R.: A Certified Implementation on top of the Java Virtual Machine. In: Alpuente, M. (ed.) FMICS 2009. LNCS, vol. 5825, pp. 181–196. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  5. de Dios, J., Peña, R.: Formal Certification of a Resource-Aware Language Implementation. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009. LNCS, vol. 5674, pp. 196–211. Springer, Heidelberg (2009)

    Google Scholar 

  6. Hofmann, M., Jost, S.: Static prediction of heap space usage for first-order functional programs. In: Proc. 30th ACM Symp. on Principles of Programming Languages, POPL’03, pp. 185–197. ACM Press, New York (2003)

    Google Scholar 

  7. Hughes, R.J.M., Pareto, L.: Recursion and Dynamic Data-Structures in Bounded Space; Towards Embedded ML Programming. In: Proc. Int. Conf. on Functional Programming, ICFP’99, Paris, pp. 70–81. ACM Press, New York (September 1999)

    Google Scholar 

  8. Hughes, R.J.M., Pareto, L., Sabry, A.: Proving the Correctness of Reactive Systems Using Sized Types. In: Conference Record of POPL ’96: The 23rd ACM SIGPLAN-SIGACT, pp. 410–423 (1996)

    Google Scholar 

  9. Lindholm, T., Yellin, F.: The Java Virtual Machine Sepecification, 2nd edn. The Java Series. Addison-Wesley, Reading (1999)

    Google Scholar 

  10. Lucas, S., Peña, R.: Rewriting Techniques for Analysing Termination and Complexity Bounds of SAFE Programs. In: Hanus, M. (ed.) LOPSTR 2008. LNCS, vol. 5438, pp. 43–57. Springer, Heidelberg (2009)

    Google Scholar 

  11. Montenegro, M., Peña, R., Segura, C.: A Resource-Aware Semantics and Abstract Machine for a Functional Language with Explicit Deallocation. In: Workshop on Functional and (Constraint) Logic Programming, WFLP’08, Siena, Italy. ENTCS, pp. 47–61 (July 2008)

    Google Scholar 

  12. Montenegro, M., Peña, R., Segura, C.: A Type System for Safe Memory Management and its Proof of Correctness. In: ACM Principles and Practice of Declarative Programming, PPDP’08, Valencia, Spain, pp. 152–162 (July 2008)

    Google Scholar 

  13. Montenegro, M., Peña, R., Segura, C.: A simple region inference algorithm for a first-order functional language. In: Escobar, S. (ed.) Functional and Constraint Logic Programming. LNCS, vol. 5979, pp. 145–161. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  14. Montenegro, M., Peña, R., Segura, C.: A space consumption analysis by abstract interpretation, extended version (2009), http://dalila.sip.ucm.es/safe

  15. Tamalet, A., Shkaravska, O., van Eekelen, M.: Size Analysis of Algebraic Data Types. In: Achten, P., Koopman, P., Morazán, M.T. (eds.) Trends in Functional Programming (TFP’08), vol. 9, pp. 33–48. Intellect (2009)

    Google Scholar 

  16. van Eekelen, M., Shkaravska, O., van Kesteren, R., Jacobs, B., Poll, E., Smetsers, S.: AHA: Amortized Space Usage Analysis. Selected Papers Trends in Functional Programming, TFP’07, New York, pp. 36–53. Intellect (2008)

    Google Scholar 

  17. van Kesteren, R., Shkaravska, O., van Eekelen, M.: Inferring static non-monotonically sized types through testing. In: Proc. Work. on Functional and (Constraint) Logic Programming, WFLP’07, Paris, France. ENTCS. Elsevier, Amsterdam (2007)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Montenegro, M., Peña, R., Segura, C. (2010). A Space Consumption Analysis by Abstract Interpretation. In: van Eekelen, M., Shkaravska, O. (eds) Foundational and Practical Aspects of Resource Analysis. FOPARA 2009. Lecture Notes in Computer Science, vol 6324. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-15331-0_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-15331-0_3

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-15330-3

  • Online ISBN: 978-3-642-15331-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics