• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

Computer Engineering & Science ›› 2024, Vol. 46 ›› Issue (11): 1916-1923.

• High Performance Computing • Previous Articles     Next Articles

Design and implementation of an efficient memory allocation algorithm based on TLSF algorithm

CHEN Zhao-hui1,DUAN Xiong2   

  1. (1.Institute of Advanced Technology Research,University of Science and Technology of China,Hefei 230031;
    2.Anhui Huami Information Technology Co.,Ltd.,Hefei 230088,China)
  • Received:2023-07-08 Revised:2023-10-07 Accepted:2024-11-25 Online:2024-11-25 Published:2024-11-27

Abstract: In embedded systems, due to the limited availability of memory resources, the perform- ance and fragmentation rate of memory allocators become crucial factors to consider. Currently, the primary algorithm employed is TLSF (two-level segregated fit), but this algorithm poses certain issues in embedded systems, such as external fragmentation caused by small memory allocations and internal fragmentation resulting from large memory allocations. To address these issues, optimizations have been made to the TLSF algorithm: (1) For small memory allocations, a static memory pool (POOL) algorithm is introduced to resolve the external fragmentation problem that arises from numerous small memory allocations in the TLSF algorithm; (2) For large memory allocations, a DBL (divided by level) memory allocation strategy based on hierarchical division is proposed to tackle the internal fragmentation issue in large memory allocations. Experiments have shown that by utilizing the optimized TLSF algorithm (DBL+POOL) for memory management, it is possible to better utilize memory resources, thereby enhancing the performance and reliability of embedded systems.

Key words: memory allocator, TLSF algorithm, static memory pool algorithm, memory fragmentation, embedded operating system