Real-Time Systems

, Volume 40, Issue 2, pp 149–179 | Cite as

A constant-time dynamic storage allocator for real-time systems

  • Miguel Masmano
  • Ismael Ripoll
  • Patricia Balbastre
  • Alfons Crespo


Dynamic memory allocation has been used for decades. However, it has seldom been used in real-time systems since the worst case of spatial and temporal requirements for allocation and deallocation operations is either unbounded or bounded but with a very large bound.

In this paper, a new allocator called TLSF (Two Level Segregated Fit) is presented. TLSF is designed and implemented to accommodate real-time constraints. The proposed allocator exhibits time-bounded behaviour, O(1), and maintains a very good execution time. This paper describes in detail the data structures and functions provided by TLSF. We also compare TLSF with a representative set of allocators regarding their temporal cost and fragmentation.

Although the paper is mainly focused on timing analysis, a brief study and comparative analysis of fragmentation incurred by the allocators has been also included in order to provide a global view of the behaviour of the allocators.

The temporal and spatial results showed that TLSF is also a fast allocator and produces a fragmentation close to that caused by the best existing allocators.


Dynamic storage allocation Real-time allocators Allocation algorithms evaluation 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. Atienza D, Mamagkakis S, Leeman M, Catthoor F, Mendias JM, Soudris D, Deconinck G (2003) Fast system-level prototyping of power-aware dynamic memory managers for embedded systems. In: Workshop on compilers and operating systems for low power Google Scholar
  2. Berger ED, Zorn BG, McKinley KS (2002a) Reconsidering custom memory allocation. In: ACM conference on object-oriented programming, systems, languages, and applications, Seattle, WA, pp 1–12 Google Scholar
  3. Berger ED, Zorn BG, McKinley KS (2002b) Reconsidering custom memory allocation. In: OOPSLA, pp 1–12 Google Scholar
  4. Bollella G, Gosling J (2000) The real-time specification for Java. IEEE Comput 33(6):47–54 Google Scholar
  5. Bonwick J (1994) The slab allocator: an object-caching Kernel memory allocator. In: USENIX summer, pp 87–98 Google Scholar
  6. Feizabadi S, Ravindran B, Jensen ED (2005) MSA: a memory-aware utility accrual scheduling algorithm. In: SAC, pp 857–862 Google Scholar
  7. OCERA, Open Components for Embedded Real-Time Applications (2002) IST 35102 European research project (
  8. Ford R (1996) Concurrent algorithms for real-time memory management. IEEE Softw 5(5):10–23 CrossRefGoogle Scholar
  9. Grunwald D, Zorn B (1993) CustoMalloc: efficient synthesized memory allocators. Softw Pract Exp 23(8):851–869 CrossRefGoogle Scholar
  10. Johnstone M, Wilson P (1998) The memory fragmentation problem: solved? In: Proc of the int symposium on memory management (ISMM98), Vancouver, Canada. ACM Press Google Scholar
  11. Knuth D (1973) Fundamental Algorithms. The art of computer programming, vol 1. Addison–Wesley, Reading Google Scholar
  12. LBNLab (2000) The Internet traffic archive. Lawrence Berkeley National Laboratory,
  13. Lea D (1996) A memory allocator. Unix/Mail 6/96 Google Scholar
  14. Masmano M, Ripoll I, Crespo A (2003) Dynamic storage allocation for real-time embedded systems. In: Real-time systems symposium, work-in-progress session, Cancun, Mexico Google Scholar
  15. Masmano M, Ripoll I, Crespo A, Real J (2004) TLSF: a new dynamic memory allocator for real-time systems. In: 16th Euromicro conference on real-time systems, Catania, Italy. IEEE, pp 79–88 Google Scholar
  16. Masmano M, Ripoll I, Real J, Crespo A, Wellings AJ (2007) Implementation of a constant-time dynamic storage allocator. Softw Pract Exp. DOI:  10.1002/spe.858 Google Scholar
  17. Ni N, Bhuyan L (2002) Fair scheduling in Internet routers. IEEE Trans Comput 51(6):686–701 CrossRefGoogle Scholar
  18. Nielsen NR (1977) Dynamic memory allocation in computer simulation. Commun ACM 20(11):864–873 CrossRefGoogle Scholar
  19. Ogasawara T (1995) An algorithm with constant execution time for dynamic storage allocation. In: 2nd int workshop on real-time computing systems and applications, p 21 Google Scholar
  20. Peterson J, Norman T (1977) Buddy systems. Commun ACM 20(6):421–431 zbMATHCrossRefGoogle Scholar
  21. Puaut I (2002) Real-time performance of dynamic memory allocation algorithms. In: 14th Euromicro conference on real-time systems, p 41 Google Scholar
  22. Puschner P, Burns A (2000) A review of worst-case execution-time analysis. J Real-Time Syst 18(2/3):115–128 CrossRefGoogle Scholar
  23. Robson JM (1971) An estimate of the store size necessary for dynamic storage allocation. J ACM 18(2):416–423 zbMATHCrossRefMathSciNetGoogle Scholar
  24. Robson JM (1974) Bounds for some functions concerning dynamic storage allocation. J ACM 21(3):491–499 zbMATHCrossRefMathSciNetGoogle Scholar
  25. Robson JM (1977) Worst case fragmentation of first fit and best fit storage allocation strategies. Comput J 20(3):242–244 CrossRefGoogle Scholar
  26. Sedgewick R (1998) Algorithms in C, 3rd edn. Addison–Wesley, Reading zbMATHGoogle Scholar
  27. Shore J (1975) On the external storage fragmentation produced by first-fit and best-fit allocation strategies. Commun ACM 18(8):433–440 zbMATHCrossRefGoogle Scholar
  28. Stephenson CJ (1983) Fast fits: new methods of dynamic storage allocation. Oper Sys Rev 15(5). Also in Proceedings of ninth symposium on operating systems principles, Bretton Woods, New Hampshire, October 1983 Google Scholar
  29. Wilson PR, Johnstone MS, Neely M, Boles D (1995) Dynamic storage allocation: a survey and critical review. In: Baker H (ed) Proc of the int workshop on memory management, Kinross, Scotland, UK, vol 986. Springer, Berlin, pp 1–116 Google Scholar
  30. Zorn B, Grunwald D (1994) Evaluating models of memory allocation. ACM Trans Model Comput Simul 107–131 Google Scholar

Copyright information

© Springer Science+Business Media, LLC 2008

Authors and Affiliations

  • Miguel Masmano
    • 1
  • Ismael Ripoll
    • 1
  • Patricia Balbastre
    • 1
  • Alfons Crespo
    • 1
  1. 1.Department of Computer EngineeringTechnical University of ValenciaValenciaSpain

Personalised recommendations