Abstract
Existing implementations of dynamic memory allocators (DMA) employ a large spectrum of policies and techniques. The formal specifications of these techniques are quite complicated in isolation and very complex when combined. Therefore, the formal reasoning on a specific DMA implementation is difficult for automatic tools and mostly single-use. This paper proposes a solution to this problem by providing formal models for a full class of DMA, the class using various kinds of lists to manage the memory blocks controlled by the DMA. To obtain reusable formal models and tractable formal reasoning, we organise these models in a hierarchy ranked by refinement relations. We prove the soundness of models and the refinement relations using the modeling framework Event-B and the theorem prover Rodin. We demonstrate that our hierarchy is a basis for an algorithm theory for list based DMA: it abstracts various existing implementations of DMA and leads to new DMA implementations. The applications of this formalisation include model-based code generation, testing, and static analysis.
Similar content being viewed by others
References
Donald E K. The Art of Computer Programming, Volume I: Fundamental Algorithms. 3rd ed. Upper Saddle River: Addison-Wesley, 1973
Paul R W, Mark S J, Michael N, et al. Dynamic storage allocation: a survey and critical review. In: Proceedings of International Workshop on Memory Management, Kinross, 1995. 986: 1–116
Brian W K, Dennis R. The C Programming Language. 2nd ed. Upper Saddle River: Prentice-Hall, 1988
Doug L. dlmalloc. 2012. ftp://gee.cs.oswego.edu/pub/misc/malloc.c
Cristiano C, Dino D, Peter W O, et al. Beyond reachability: shape abstraction in the presence of pointer arithmetic. In: Proceedings of Static Analysis Symposium, Seoul, 2006. 4134. 182–203
Adam C. Mostly-automated verification of low-level programs in computational separation logic. In: Proceedings of ACM SIGPLAN Conference on Programming Language Design and Implementation, San Jose, 2011. 234–245
Gerwin K, Kevin E, Gernot H, et al. seL4: formal verification of an OS kernel. In: Proceedings of ACM Symposium on Operating Systems Principles, Big Sky, 2009. 207–220
Nicolas M, Reynald A, Akinori Y. Formal verification of the heap manager of an operating system using separation logic. In: Proceedings of International Conference on Formal Engineering Methods, Macao, 2006. 4260. 400–419
Harvey T, Gerwin K, Michael N. Types, bytes, and separation logic. In: Proceedings of ACM SIGPLAN Symposium on Principles of Programming Languages, Nice, 2007. 97–108
Peter WO, John C R, Yang H. Local reasoning about programs that alter data structures. In: Proceedings of European Association for Computer Science Logic, Paris, 2001. 1–19
Smith D R, Lowry M R. Algorithm theories and design tactics. Sci Comput Programming, 1990, 14: 305–321
Leslie A. Memory allocation in C. Sci Embed Syst Programm, 2008, 1: 35–42
Jonathan B. Inside memory management. 2004. http://www.ibm.com/developerworks/library/l-memory/sidefile.html
Abrial J-R. Modeling in Event-B: System and Software Engineering. Cambridge: Cambridge University Press, 2010
Abrial J R, Butler M, Hallerstede S, et al. Rodin: an open toolset for modelling and reasoning in Event-B. Int J Softw Tools Technol Transfer, 2010, 12: 447–466
Fang B, Sighireanu M. A refinement hierarchy for free list memory allocators. In: Proceedings of ACM SIGPLAN International Symposium on Memory Management, Barcelona, 2017. 104–114
Fang B, Sighireanu M. A Refinement Hierarchy for Free List Memory Allocators. Research Report hal-01510166, IRIF. 2017
George F, Christian C, Eckart Z, et al. Topsy -A Teachable Operating System. Technical Report, Version 1.1, 20000322. 2000
Miguel M, Ismael R, Alfons C, et al. TLSF: a new dynamic memory allocator for real-time systems. In: Proceedings of Euromicro Conference on Real-Time Systems, Catania, 2004. 79–86
Malik Q A, Lilius J, Laibinis L. Model-based testing using scenarios and Event-B refinements. In: Methods, Models and Tools for Fault Tolerance. Berlin: Springer, 2009. 177–195
Fang B, Sighireanu M. Hierarchical shape abstraction for analysis of free-list memory allocators. In: Proceedings of International Symposium on Logic-based Program Synthesis and Transformation, Edinburgh, 2016. 151–167
Liu J C, Xavier R. Abstraction of arrays based on non contiguous partitions. In: Proceedings of International Conference on Verification, Model Checking, and Abstract Interpretation, Paris, 2015. 8931. 282–299
Su W, Abrial J R, Pu G G, et al. Formal development of a real-time operating system memory manager. In: Proceedings of International Conference on Engineering of Complex Computer Systems, Gold Coast, 2015. 130–139
Chris H, Erez P. Automated verification of practical garbage collectors. In: Proceedings of ACM SIGPLAN Symposium on Principles of Programming Languages, Savannah, 2009. 441–453
Qin S C, Xu ZW, Ming Z. Survey of research on program verification via separation logic. J Softw, 2017, 28: 2010–2025
Chin W N, David C, Nguyen H H, et al. Automated verification of shape, size and bag properties via user-defined predicates in separation logic. Sci Comput Programming, 2012, 77: 1006–1036
Qin S, He G, Luo C, et al. Automatically refining partial specifications for heap-manipulating programs. Sci Comput Programming, 2014, 82: 56–76
Author information
Authors and Affiliations
Corresponding authors
Rights and permissions
About this article
Cite this article
Fang, B., Sighireanu, M., Pu, G. et al. Formal modelling of list based dynamic memory allocators. Sci. China Inf. Sci. 61, 122103 (2018). https://doi.org/10.1007/s11432-017-9280-9
Received:
Revised:
Accepted:
Published:
DOI: https://doi.org/10.1007/s11432-017-9280-9