为了降低实时垃圾搜集器(GC)系统的内存需求,提出一种将局部标记清除算法和引用计数算法相结合的混杂GC策略.通过对非循环垃圾采用引用计数算法渐进式回收,对循环垃圾采用局部标记清除算法渐进式回收,从而可在一个GC循环中及时回收部分循环垃圾以供系统重用;将混杂GC作为单独任务参与并发调度,以保证实时任务的时限要求.理论分析和仿真实验表明,与现有算法相比,该策略可以进一步降低嵌入式实时系统的内存需求.
For decreasing memory requirement of system with real-time garbage collection(GC), a real-time hybrid garbage collection, which is combined with partial mark-sweep algorithm and reference counting algorithm is proposed. Acyclic garbage is collected by reference counting algorithm incrementally and cyclic garbage is also collected by partial mark-sweep algorithm incrementally. Thus, partial cyclic garbage can be collected during one GC cycle for reuse. Hybrid GC can be scheduled with real-time tasks concurrently to make real-time tasks meet their deadlines. Theoretical analysis and experimental results demonstrated superiority in memory consumption of the proposed algorithm in comparison with the existing algorithms.