skip to main content

A separation logic for heap space under garbage collection

Published:12 January 2022Publication History
Skip Abstract Section

Abstract

We present SL♢, a Separation Logic that allows controlling the heap space consumption of a program in the presence of dynamic memory allocation and garbage collection. A user of the logic works with space credits, a resource that is consumed when an object is allocated and produced when a group of objects is logically deallocated, that is, when the user is able to prove that it has become unreachable and therefore can be collected. To prove such a fact, the user maintains pointed-by assertions that record the immediate predecessors of every object. Our calculus, SpaceLang, has mutable state, shared-memory concurrency, and code pointers. We prove that SL♢ is sound and present several simple examples of its use.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

5 minute presentation video.

References

  1. Elvira Albert, Samir Genaim, and Miguel Gómez-Zamalloa. 2007. Heap space analysis for Java bytecode. In International Symposium on Memory Management. 105–116. http://cliplab.org/papers/jvm-heap-ismm07.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  2. Elvira Albert, Samir Genaim, and Miguel Gómez-Zamalloa. 2009. Live heap space analysis for languages with garbage collection. In International Symposium on Memory Management. 129–138. http://oa.upm.es/5699/2/INVE_MEM_2009_70439.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  3. Elvira Albert, Samir Genaim, and Miguel Gómez-Zamalloa. 2010. Parametric inference of memory requirements for garbage collected languages. In International Symposium on Memory Management. 121–130. https://cliplab.org/papers/heap-usage-ISMM10.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  4. Elvira Albert, Samir Genaim, and Miguel Gómez-Zamalloa. 2013. Heap space analysis for garbage collected languages. Science of Computer Programming, 78, 9 (2013), 1427–1448. https://doi.org/10.1016/j.scico.2012.10.008 Google ScholarGoogle ScholarCross RefCross Ref
  5. David Aspinall, Lennart Beringer, Martin Hofmann, Hans-Wolfgang Loidl, and Alberto Momigliano. 2007. A program logic for resources. Theoretical Computer Science, 389, 3 (2007), 411–445. https://www.tcs.ifi.lmu.de/mitarbeiter/martin-hofmann/publikationen-pdfs/j25-ProgramLogisResources.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  6. David Aspinall and Adriana B. Compagnoni. 2003. Heap-Bounded Assembly Language. Journal of Automated Reasoning, 31, 3-4 (2003), 261–302. https://doi.org/10.1023/B:JARS.0000021014.79255.33 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. David Aspinall and Martin Hofmann. 2002. Another Type System for In-Place Update. In European Symposium on Programming (ESOP) (Lecture Notes in Computer Science, Vol. 2305). Springer, 36–52. https://www.tcs.ifi.lmu.de/mitarbeiter/martin-hofmann/publikationen-pdfs/c22-anothertypesystem.pdfGoogle ScholarGoogle Scholar
  8. Robert Atkey. 2011. Amortised Resource Analysis with Separation Logic. Logical Methods in Computer Science, 7, 2:17 (2011), http://bentnib.org/amortised-sep-logic-journal.pdfGoogle ScholarGoogle Scholar
  9. Guy E. Blelloch and John Greiner. 1996. A Provable Time and Space Efficient Implementation of NESL. In International Conference on Functional Programming (ICFP). 213–225. http://www.cs.cmu.edu/~guyb/papers/BG96nesl.pdfGoogle ScholarGoogle Scholar
  10. Richard Bornat, Cristiano Calcagno, Peter O’Hearn, and Matthew Parkinson. 2005. Permission accounting in separation logic. In Principles of Programming Languages (POPL). 259–270. http://www.cs.ucl.ac.uk/staff/p.ohearn/papers/permissions_paper.pdfGoogle ScholarGoogle Scholar
  11. John Boyland. 2003. Checking Interference with Fractional Permissions. In Static Analysis Symposium (SAS) (Lecture Notes in Computer Science, Vol. 2694). Springer, 55–72. http://www.cs.uwm.edu/~boyland/papers/permissions.pdfGoogle ScholarGoogle Scholar
  12. Víctor A. Braberman, Federico Javier Fernández, Diego Garbervetsky, and Sergio Yovine. 2008. Parametric prediction of heap memory requirements. In International Symposium on Memory Management. 141–150. https://www.researchgate.net/profile/Diego-Garbervetsky/publication/221032818_Parametric_Prediction_of_Heap_Memory_Requirements/links/00463517e5d2b2206b000000/Parametric-Prediction-of-Heap-Memory-Requirements.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  13. Víctor A. Braberman, Diego Garbervetsky, and Sergio Yovine. 2006. A Static Analysis for Synthesizing Parametric Specifications of Dynamic Memory Consumption. Journal of Object Technology, 5, 5 (2006), 31–58. https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.71.9647&rep=rep1&type=pdfGoogle ScholarGoogle ScholarCross RefCross Ref
  14. Stephen Brookes and Peter W. O’Hearn. 2016. Concurrent separation logic. SIGLOG News, 3, 3 (2016), 47–65. http://siglog.hosting.acm.org/wp-content/uploads/2016/07/siglog_news_9.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  15. Quentin Carbonneaux, Jan Hoffmann, Tahina Ramananandro, and Zhong Shao. 2014. End-to-end verification of stack-space bounds for C programs. In Programming Language Design and Implementation (PLDI). 270–281. http://flint.cs.yale.edu/flint/publications/veristack.pdfGoogle ScholarGoogle Scholar
  16. Arthur Charguéraud. 2020. Separation logic for sequential programs (functional pearl). Proceedings of the ACM on Programming Languages, 4, ICFP (2020), 116:1–116:34. https://doi.org/10.1145/3408998 Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Chris J. Cheney. 1970. A Nonrecursive List Compacting Algorithm. Commun. ACM, 13, 11 (1970), 677–678. https://doi.org/10.1145/362790.362798 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Wei-Ngan Chin, Huu Hai Nguyen, Corneliu Popeea, and Shengchao Qin. 2008. Analysing memory resource bounds for low-level programs. In International Symposium on Memory Management. 151–160. https://www7.in.tum.de/~popeea/research/memory.ismm08.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  19. Wei-Ngan Chin, Huu Hai Nguyen, Shengchao Qin, and Martin C. Rinard. 2005. Memory Usage Verification for OO Programs. In Static Analysis Symposium (SAS) (Lecture Notes in Computer Science, Vol. 3672). Springer, 70–86. https://doi.org/10.1007/11547662_7 Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. George E. Collins. 1960. A method for overlapping and erasure of lists. Commun. ACM, 3, 12 (1960), 655–657. https://doi.org/10.1145/367487.367501 Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Matthias Felleisen and Robert Hieb. 1992. The Revised Report on the Syntactic Theories of Sequential Control and State. Theoretical Computer Science, 103, 2 (1992), 235–271. https://www2.ccs.neu.edu/racket/pubs/tcs92-fh.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  22. Diego Garbervetsky, Sergio Yovine, Víctor A. Braberman, Martín Rouaux, and Alejandro Taboada. 2011. Quantitative dynamic-memory analysis for Java. Concurrency and Computation Practice and Experience, 23, 14 (2011), 1665–1678. https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.175.9907&rep=rep1&type=pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  23. Alejandro Gómez-Londoño, Johannes Åman Pohjola, Hira Taqdees Syeda, Magnus O. Myreen, and Yong Kiam Tan. 2020. Do you have space for dessert? A verified space cost semantics for CakeML programs. Proceedings of the ACM on Programming Languages, 4, OOPSLA (2020), 204:1–204:29. https://doi.org/10.1145/3428272 Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Chris Hawblitzel and Erez Petrank. 2010. Automated Verification of Practical Garbage Collectors. Logical Methods in Computer Science, 6, 3 (2010), arxiv:1004.3808Google ScholarGoogle Scholar
  25. Guanhua He, Shengchao Qin, Chenguang Luo, and Wei-Ngan Chin. 2009. Memory Usage Verification Using Hip/Sleek. In Automated Technology for Verification and Analysis (ATVA) (Lecture Notes in Computer Science, Vol. 5799). Springer, 166–181. https://dro.dur.ac.uk/6241/Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Jan Hoffmann, Klaus Aehlig, and Martin Hofmann. 2012. Multivariate amortized resource analysis. ACM Transactions on Programming Languages and Systems, 34, 3 (2012), 14:1–14:62. https://www.cs.cmu.edu/~janh/assets/pdf/HoffmannAH10.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  27. Jan Hoffmann, Klaus Aehlig, and Martin Hofmann. 2012. Resource Aware ML. In Computer Aided Verification (CAV) (Lecture Notes in Computer Science, Vol. 7358). Springer, 781–786. http://dx.doi.org/10.1007/978-3-642-31424-7_64 Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Jan Hoffmann, Ankush Das, and Shu-Chun Weng. 2017. Towards automatic resource bound analysis for OCaml. In Principles of Programming Languages (POPL). 359–373. http://www.cs.cmu.edu/~janh/papers/HoffmannDW17.pdfGoogle ScholarGoogle Scholar
  29. Martin Hofmann. 1999. Linear Types and Non-Size-Increasing Polynomial Time Computation. In Logic in Computer Science (LICS). 464–473. https://doi.org/10.1109/LICS.1999.782641 Google ScholarGoogle ScholarCross RefCross Ref
  30. Martin Hofmann. 2000. A type system for bounded space and functional in-place update. Nordic Journal of Computing, 7, 4 (2000), 258–289. http://www.dcs.ed.ac.uk/home/mxh/nordic.ps.gzGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  31. Martin Hofmann. 2003. Linear types and non-size-increasing polynomial time computation. Information and Computation, 183, 1 (2003), 57–85. https://doi.org/10.1016/S0890-5401(03)00009-9 Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Martin Hofmann and Steffen Jost. 2003. Static prediction of heap space usage for first-order functional programs. In Principles of Programming Languages (POPL). 185–197. http://www2.tcs.ifi.lmu.de/~jost/research/POPL_2003_Jost_Hofmann.pdfGoogle ScholarGoogle Scholar
  33. Martin Hofmann and Steffen Jost. 2006. Type-Based Amortised Heap-Space Analysis. In European Symposium on Programming (ESOP) (Lecture Notes in Computer Science, Vol. 3924). Springer, 22–37. https://www.tcs.ifi.lmu.de/mitarbeiter/martin-hofmann/publikationen-pdfs/c36-typebasedamortisedheap-space.pdfGoogle ScholarGoogle Scholar
  34. Martin Hofmann and Dulma Rodriguez. 2009. Efficient Type-Checking for Amortised Heap-Space Analysis. In Computer Science Logic (Lecture Notes in Computer Science, Vol. 5771). Springer, 317–331. https://doi.org/10.1007/978-3-642-04027-6_24 Google ScholarGoogle Scholar
  35. Martin Hofmann and Dulma Rodriguez. 2013. Automatic Type Inference for Amortised Heap-Space Analysis. In European Symposium on Programming (ESOP) (Lecture Notes in Computer Science, Vol. 7792). Springer, 593–613. https://doi.org/10.1007/978-3-642-37036-6_32 Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. John Hughes and Lars Pareto. 1999. Recursion and Dynamic Data-structures in Bounded Space: Towards Embedded ML Programming. In International Conference on Functional Programming (ICFP). 70–81. https://doi.org/10.1145/317636.317785 Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Chung-Kil Hur, Derek Dreyer, and Viktor Vafeiadis. 2011. Separation Logic in the Presence of Garbage Collection. In Logic in Computer Science (LICS). 247–256. http://people.mpi-sws.org/~dreyer/papers/gcsl/paper.pdfGoogle ScholarGoogle Scholar
  38. Iris. 2021. iris.base_logic.lib.gen_heap. https://plv.mpi-sws.org/coqdoc/iris/iris.base_logic.lib.gen_heap.htmlGoogle ScholarGoogle Scholar
  39. Steffen Jost, Kevin Hammond, Hans-Wolfgang Loidl, and Martin Hofmann. 2010. Static determination of quantitative resource usage for higher-order programs. In Principles of Programming Languages (POPL). 223–236. http://www2.tcs.ifi.lmu.de/~jost/research/POPL_2010__Higher-Order_AA__Jost_etAl.pdfGoogle ScholarGoogle Scholar
  40. Steffen Jost, Hans-Wolfgang Loidl, Kevin Hammond, Norman Scaife, and Martin Hofmann. 2009. "Carbon Credits" for Resource-Bounded Computations Using Amortised Analysis. In Formal Methods (FM) (Lecture Notes in Computer Science, Vol. 5850). Springer, 354–369. http://www2.tcs.ifi.lmu.de/~jost/research/FM09_AmortisedAnalysis__Jost_etAl.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  41. Steffen Jost, Pedro B. Vasconcelos, Mário Florido, and Kevin Hammond. 2017. Type-Based Cost Analysis for Lazy Functional Languages. Journal of Automated Reasoning, 59, 1 (2017), 87–120. https://www.dcc.fc.up.pt/~pbv/research/JAR2016-draft.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  42. Ralf Jung, Robbert Krebbers, Jacques-Henri Jourdan, Aleš Bizjak, Lars Birkedal, and Derek Dreyer. 2018. Iris from the ground up: A modular foundation for higher-order concurrent separation logic. Journal of Functional Programming, 28 (2018), e20. https://people.mpi-sws.org/~dreyer/papers/iris-ground-up/paper.pdfGoogle ScholarGoogle Scholar
  43. David M. Kahn and Jan Hoffmann. 2021. Automatic amortized resource analysis with the quantum physicist’s method. Proceedings of the ACM on Programming Languages, 5, ICFP (2021), 1–29. https://doi.org/10.1145/3473581 Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Ioannis T. Kassios and Eleftherios Kritikos. 2013. A Discipline for Program Verification Based on Backpointers and Its Use in Observational Disjointness. In European Symposium on Programming (ESOP) (Lecture Notes in Computer Science, Vol. 7792). Springer, 149–168. https://doi.org/10.1007/978-3-642-37036-6_10 Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Jean-Marie Madiot and François Pottier. 2021. A Separation Logic for Heap Space under Garbage Collection (Repository). https://gitlab.inria.fr/fpottier/diamondsGoogle ScholarGoogle Scholar
  46. Andrew McCreight, Tim Chevalier, and Andrew P. Tolmach. 2010. A certified framework for compiling and executing garbage-collected languages. In International Conference on Functional Programming (ICFP). 273–284. https://web.cecs.pdx.edu/~apt/icfp10.pdfGoogle ScholarGoogle Scholar
  47. Andrew McCreight, Zhong Shao, Chunxiao Lin, and Long Li. 2007. A general framework for certifying garbage collectors and their mutators. In Programming Language Design and Implementation (PLDI). 468–479. https://doi.org/10.1145/1250734.1250788 Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Yasuhiko Minamide. 1999. Space-Profiling Semantics of the Call-by-Value Lambda Calculus and the CPS Transformation. Electronic Notes in Theoretical Computer Science, 26 (1999), 105–120. https://doi.org/10.1016/S1571-0661(05)80286-5 Google ScholarGoogle ScholarCross RefCross Ref
  49. J. Gregory Morrisett, Matthias Felleisen, and Robert Harper. 1995. Abstract Models of Memory Management. In Functional Programming Languages and Computer Architecture (FPCA). 66–77. https://www.cs.cmu.edu/~rwh/papers/gc/fpca95.pdfGoogle ScholarGoogle Scholar
  50. Huu Hai Nguyen, Cristina David, Shengchao Qin, and Wei-Ngan Chin. 2007. Automated Verification of Shape and Size Properties Via Separation Logic. In Verification, Model Checking and Abstract Interpretation (VMCAI) (Lecture Notes in Computer Science, Vol. 4349). Springer, 251–266. https://dro.dur.ac.uk/6213/Google ScholarGoogle ScholarCross RefCross Ref
  51. Yue Niu and Jan Hoffmann. 2018. Automatic Space Bound Analysis for Functional Programs with Garbage Collection. In Logic for Programming Artificial Intelligence and Reasoning (LPAR) (EPiC Series in Computing, Vol. 57). 543–563. https://easychair.org/publications/paper/dcnDGoogle ScholarGoogle Scholar
  52. Peter W. O’Hearn. 2019. Separation logic. Commun. ACM, 62, 2 (2019), 86–95. https://doi.org/10.1145/3211968 Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Azalea Raad, Josh Berdine, Hoang-Hai Dang, Derek Dreyer, Peter W. O’Hearn, and Jules Villard. 2020. Local Reasoning About the Presence of Bugs: Incorrectness Separation Logic. In Computer Aided Verification (CAV) (Lecture Notes in Computer Science, Vol. 12225). Springer, 225–252. https://plv.mpi-sws.org/ISL/Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. John C. Reynolds. 2002. Separation Logic: A Logic for Shared Mutable Data Structures. In Logic in Computer Science (LICS). 55–74. http://www.cs.cmu.edu/~jcr/seplogic.pdfGoogle ScholarGoogle Scholar
  55. Adam Sandberg Ericsson, Magnus O. Myreen, and Johannes Åman Pohjola. 2019. A Verified Generational Garbage Collector for CakeML. Journal of Automated Reasoning, 63, 2 (2019), 463–488. https://doi.org/10.1007/s10817-018-9487-z Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. Hugo R. Simões, Pedro B. Vasconcelos, Mário Florido, Steffen Jost, and Kevin Hammond. 2012. Automatic amortised analysis of dynamic memory allocation for lazy functional programs. In International Conference on Functional Programming (ICFP). 165–176. https://paginas.fe.up.pt/~niadr/PUBLICATIONS/LIACC_publications_2011_12/pdf/C39_Automatic_Amortised_Analysis_HS_PV_MF_SJ_KH.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  57. Daniel Spoonhower, Guy E. Blelloch, Robert Harper, and Phillip B. Gibbons. 2010. Space profiling for parallel functional programs. Journal of Functional Programming, 20, 5-6 (2010), 417–461. https://www.cs.cmu.edu/~blelloch/papers/SBHG11.pdfGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  58. Mads Tofte and Jean-Pierre Talpin. 1994. Implementation of the Typed Call-by-Value λ -Calculus using a Stack of Regions. In Principles of Programming Languages (POPL). 188–201. http://www.irisa.fr/prive/talpin/papers/popl94.pdfGoogle ScholarGoogle Scholar
  59. Leena Unnikrishnan and Scott D. Stoller. 2009. Parametric heap usage analysis for functional programs. In International Symposium on Memory Management. 139–148. https://www3.cs.stonybrook.edu/~stoller/papers/ismm2009.pdfGoogle ScholarGoogle Scholar
  60. Simon Friis Vindum and Lars Birkedal. 2021. Contextual refinement of the Michael-Scott queue. In Certified Programs and Proofs (CPP). 76–90. https://cs.au.dk/~birke/papers/2021-ms-queue-final.pdfGoogle ScholarGoogle Scholar
  61. Shengyi Wang, Qinxiang Cao, Anshuman Mohan, and Aquinas Hobor. 2019. Certifying graph-manipulating C programs via localizations within data structures. Proceedings of the ACM on Programming Languages, 3, OOPSLA (2019), 171:1–171:30. https://doi.org/10.1145/3360597 Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A separation logic for heap space under garbage collection

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!