Implementation of a constant-time dynamic storage allocator

M. Masmano, I. Ripoll, J. Real, A. Crespo, A. J. Wellings

Research output: Contribution to journalArticlepeer-review


This paper describes the design criteria and implementation details of a dynamic storage allocator for real-time systems. The main requirements that have to he considered when designing a new allocator are concerned with temporal and spatial constraints. The proposed algorithm, called TLSF (two-level segregated fit, has an asymptotic constant cost, O(1), maintaining a fast response time (less than 200 processor instructions on a x86 processor) and a low level of memory usage (low fragmentation). TLSF uses two levels of segregated lists to arrange free memory blocks and an incomplete search policy. This policy is implemented with word-size bitmaps and logical processor instructions. Therefore, TLSF can be categorized as a good-fit allocator. The incomplete search policy is shown also to be a good policy in terms of fragmentation. The fragmentation caused by TLSF is slightly smaller (better) than that caused by best fit (which is one of the best allocators regarding memory fragmentation). In order to evaluate the proposed allocator, three analyses are presented in this paper. The first one is based on worst-case scenarios. The second one provides a detailed consideration or the execution cost of the internal operations of the allocator and its fragmentation. The third analysis is a comparison with other well-known allocators front the temporal (number of cycles and processor instructions) and spatial (fragmentation) points of view. In order to compare them, a task model has been presented. Copyright (C) 2007 John Wiley & Sons, Ltd.

Original languageEnglish
Pages (from-to)995-1026
Number of pages32
JournalSoftware-Practice & experience
Issue number10
Publication statusPublished - Aug 2008


  • dynamic storage management
  • real-time systems
  • operating systems
  • FIT

Cite this