作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程

• 体系结构与软件技术 • 上一篇    下一篇

基于生命期预测的分代式垃圾收集算法

张涛1,白瑞林1,邹骏宇2   

  1. (1.江南大学轻工过程先进控制教育部重点实验室,江苏 无锡 214122; 2.无锡信捷电气股份有限公司,江苏 无锡 214072)
  • 收稿日期:2014-06-27 出版日期:2015-07-15 发布日期:2015-07-15
  • 作者简介:张涛(1989-),男,硕士研究生,主研方向:嵌入式系统,机器人;白瑞林,教授、博士生导师;邹骏宇,工程师。
  • 基金资助:

    江苏高校优势学科建设工程基金资助项目(PAPD);江苏省产学研前瞻性联合研究基金资助项目(BY2012056)。

Generational Garbage Collection Algorithm Based on Lifespan Prediction

ZHANG Tao 1,BAI Ruilin 1,ZOU Junyu 2   

  1. (1.Key Laboratory of Advanced Process Control for Light Industry,Ministry of Education,Jiangnan University,Wuxi 214122,China; 2.Xinje Electronic Co.,Ltd.,Wuxi 214072,China)
  • Received:2014-06-27 Online:2015-07-15 Published:2015-07-15

摘要:

针对嵌入式虚拟机中垃圾收集效率低的问题,提出一种新的分代式垃圾收集方法。通过对分配对象的生命期进行预测,将生命期长的对象直接分配到年长代,减少了从年轻代到年长代复制的数量,进而缩短垃圾回收的执行时间。在分代内收集方面,年轻代实现一种对象分配和垃圾收集同时进行的非暂停模式,年长代使用lazy-buddy算法结合mark-sweep算法的综合策略,实现空间的快速分配和回收,既避免了对象拷贝操作,又控制了内存碎片数量。实验结果表明,该算法能够使垃圾收集时间减少约23.9%,用例运行时间减少约17.2%,系统整体执行性能得到明显提升。

关键词: 虚拟机, 垃圾收集, 生命期预测, 分代, Lazy-buddy算法, Mark-sweep算法

Abstract:

For the Garbage Collection(GC) low efficiency in embedded virtual machine environment,this paper proposes an improved generational GC algorithm based on lifespan prediction.Through the prediction of object’s lifespan,objects predicted to be long-lived are allocated directly into the old generation,and the need to copy such objects from the young generation is eliminated,thereby reducing the execution time of GC.In young generation,this paper adopts a kind of un-stop-the-world strategy which objects allocation and promotion perform concurrently.In old generation,it uses lazy-buddy algorithm combining with mark-sweep algorithm to achieve fast allocation and recovery.It not only avoids the copy operation,but also controls the amount of memory fragmentation.Experimental results show that,with this algorithm,the GC time decreases by about 23.9% and the program running time decreases by about 17.2%,the overall system execution performance is significantly improved.

Key words: virtual machine, Garbage Collection(GC), lifespan prediction, generation, Lazy-buddy algorithm, Mark-sweep algorithm

中图分类号: