Computer Engineering and Applications ›› 2016, Vol. 52 ›› Issue (13): 76-80.

Previous Articles     Next Articles

Analysis and improvement of memory management scheme in FreeRTOS

LIU Lin1, ZHU Qing1, HE Zhaohui2   

  1. 1.College of Electrical and Information Engineering, Hunan University, Changsha 410082, China
    2.Wasion Group Ltd., Changsha 410205, China
  • Online:2016-07-01 Published:2016-07-15

FreeRTOS内存管理方案的分析与改进

刘  林1,朱  青1,何昭晖2   

  1. 1.湖南大学 电气与信息工程学院,长沙 410082
    2.威胜集团有限公司,长沙 410205

Abstract: The memory management shceme of Free Real Time Operating System(FreeRTOS) has some shortcomings, such as uncertain allocation time, frequent cutting, low utilization rate as well as inadequate consolidation mechanism, this paper adopts a strategy of “precised cutting” and “delayed merging” in order to reduce memory fragment and raise utilization rate furthest. Thus it introduces TLSF(Two-Level Segregated Fit) algorithm into FreeRTOS, using two levels of bitmap index to manage its dynamic memory and improving its process of memory allocation as well as release, then conducts the experimental test on the STM32 platform which ports with FreeRTOS. At last, the results show that this method improves the speed of memory allocation and reduces memory fragmentation rate.

Key words: FreeRTOS, memory management, Two-Level Segregated Fit(TLSF) algorithm, STM32 platform, memory fragment

摘要: 针对FreeRTOS内存管理方案分配时间不确定,切割次数较多,利用率低及合并机制不足等缺点,采用一种“精确切割”和“延时合并”相结合的策略以最大限度减少内存碎片,提高内存利用率。具体实现方法是在FreeRTOS中引入TLSF(Two-level Segregated Fit)算法数据结构,采用二级位图索引对动态内存进行管理,并改进TLSF算法的内存分配和释放过程;最后将改进的算法以及FreeRTOS移植到STM32开发平台上进行实验测试。测试结果表明该方法提高了FreeRTOS的内存分配速度,减少了内存碎片率。

关键词: FreeRTOS操作系统, 内存管理, TLSF算法, STM32开发平台, 内存碎片