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.
Supplemental Material
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- Chris J. Cheney. 1970. A Nonrecursive List Compacting Algorithm. Commun. ACM, 13, 11 (1970), 677–678. https://doi.org/10.1145/362790.362798 Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Chris Hawblitzel and Erez Petrank. 2010. Automated Verification of Practical Garbage Collectors. Logical Methods in Computer Science, 6, 3 (2010), arxiv:1004.3808Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- Iris. 2021. iris.base_logic.lib.gen_heap. https://plv.mpi-sws.org/coqdoc/iris/iris.base_logic.lib.gen_heap.htmlGoogle Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Jean-Marie Madiot and François Pottier. 2021. A Separation Logic for Heap Space under Garbage Collection (Repository). https://gitlab.inria.fr/fpottier/diamondsGoogle Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
- 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 Scholar
Cross Ref
- 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 Scholar
- Peter W. O’Hearn. 2019. Separation logic. Commun. ACM, 62, 2 (2019), 86–95. https://doi.org/10.1145/3211968 Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
Digital Library
Index Terms
A separation logic for heap space under garbage collection
Recommendations
A High-Level Separation Logic for Heap Space under Garbage Collection
We present a Separation Logic with space credits for reasoning about heap space in a sequential call-by-value lambda-calculus equipped with garbage collection and mutable state. A key challenge is to design sound, modular, lightweight mechanisms ...
Higher-Order Separation Logic in Isabelle/HOLCF
We formalize higher-order separation logic for a first-order imperative language with procedures and local variables in Isabelle/HOLCF. The assertion language is modeled in such a way that one may use any theory defined in Isabelle/HOLCF to construct ...
Age-based garbage collection
Modern generational garbage collectors look for garbage among the young objects, because they have high mortality; however, these objects include the very youngest objects, which clearly are still live. We introduce new garbage collection algorithms, ...






Comments