Dalvik虚拟机垃圾回收算法的分析与性能优化
本文关键词:Dalvik虚拟机垃圾回收算法的分析与性能优化 出处:《东南大学》2015年硕士论文 论文类型:学位论文
更多相关文章: Android Dalvik虚拟机 垃圾回收算法 增量标记 分代算法
【摘要】:Dalvik虚拟机是Android系统的核心模块,它执行Java程序的速度直接影响Android系统的性能。Java语言采用自动垃圾回收机制,这使得程序员的工作量大大降低,并在很大程度上避免了内存泄漏问题。然而,该机制也给系统带来了性能下降、响应延迟等问题。本文主要对Dalvik原生垃圾回收算法进行了详细地分析并对其性能进行了优化。本文通过分析Dalvik虚拟机原生垃圾回收算法,找出了性能瓶颈。首先,针对并发GC初始标记阶段时间较长的特点设计了增量标记算法,将标记根集阶段划分成两次进行,每次先标记一部分根集再并发地标记这部分根集的引用,避免了长时间的暂停:其次,根据对象在生存时间和空间上的局部性,实现了按年龄大小分代的垃圾回收算法,通过在堆资源中添加年龄位图对对象年龄进行统计,当对象年龄达到老年代阈值时将其提升为老年代。同时,将大对象直接看作老年代,避免对它们的频繁操作。只有当回收年轻代不能满足应用程序需求时再进行全部收集,通过这种回收策略,本文将垃圾收集的工作主要放在对年轻代对象的收集上,减少了系统的暂停时间。本文通过Oxbenchmark测试软件在Nexus3手机上对改进后的算法进行测试,结果表明:在增量标记算法和原生算法整体花费时间持平的情况下,没有出现并发GC中长时间暂停的情况,长时间暂停的次数由12次减少为0次;在Oxbenchmark对系统的整体性能的测试中,按年龄大小分代算法最快耗时4093ms,较原生算法提升了36.97%,平均用时4497.85ms,提升了35.25%;在创建不同深度二叉树测试用时上,按年龄大小分代算法相对原生算法在垃圾回收性能的得分上提升了36%。
[Abstract]:Dalvik virtual machine is the core module of Android system. The speed of executing Java programs directly affects the performance of Android system. Java language adopts automatic garbage collection mechanism, which greatly reduces the workload of programmers. And to a large extent, the memory leak problem is avoided. However, this mechanism also brings the performance degradation to the system. This paper mainly analyzes the native garbage collection algorithm of Dalvik and optimizes its performance. This paper analyzes the native garbage collection algorithm of Dalvik virtual machine. The performance bottleneck is found. Firstly, the incremental marking algorithm is designed for the long time of concurrent GC initial marking phase, and the label root set stage is divided into two stages. A part of the root set is marked first at a time and then the reference of that part of the root set is labeled concurrently, thus avoiding a long pause: secondly, based on the locality of the object in time and space. A garbage collection algorithm based on age is implemented. The age bitmap is added to the heap resource to calculate the age of the object, and the age of the object is raised to the old age when the age reaches the threshold. At the same time. Treat large objects directly as older, avoiding frequent manipulation of them. Collect all objects only when the younger generation of recycling fails to meet the requirements of the application, through this recycling strategy. In this paper, the work of garbage collection is mainly focused on the collection of younger generation objects. This paper uses Oxbenchmark software to test the improved algorithm on Nexus3 mobile phone. The results show that when the whole time of incremental marking algorithm and native algorithm is equal, there is no long time pause in concurrent GC, and the number of long time pause is reduced from 12 times to 0 times. In the testing of the overall performance of the system by Oxbenchmark, the age generation algorithm can take 4093 Ms as the fastest time, which is 36.97% higher than the original algorithm. The average time used was 4497.85ms, which increased 35.25ms. In the test time of creating binary tree with different depth, the age generation algorithm improved the garbage collection performance by 36 points compared with the native algorithm.
【学位授予单位】:东南大学
【学位级别】:硕士
【学位授予年份】:2015
【分类号】:X705
【参考文献】
相关期刊论文 前9条
1 高士翔;葛霄;潘磊;郑滔;;Dalvik在iOS上的移植[J];计算机科学;2012年S1期
2 吴志军;何加铭;曾兴斌;史智慧;;基于嵌入式Java虚拟机的垃圾收集优化算法[J];计算机工程;2012年07期
3 张嗜军;高曙;;一种改进的增量式JVM垃圾收集算法[J];计算机工程;2012年01期
4 白江涛;钟勇;朱颢东;;基于实时性的Java虚拟机垃圾收集算法[J];计算机应用研究;2010年09期
5 周寻;;并发垃圾收集器及其调度方法的研究[J];计算机应用与软件;2010年09期
6 王溪波;尹振中;于戈;;基于动态优先级的实时Java垃圾回收策略[J];沈阳工业大学学报;2010年03期
7 李振汕;;JVM垃圾收集器的性能分析及编码建议[J];计算机时代;2009年11期
8 郭芬;刘明;;Python垃圾收集器原理研究及应用[J];信息技术;2009年07期
9 邹琼;章隆兵;;一种快速的滑动标记缩并垃圾收集算法[J];电子学报;2008年10期
相关博士学位论文 前1条
1 张宁;嵌入式内存管理垃圾搜集器实时算法研究[D];电子科技大学;2009年
相关硕士学位论文 前2条
1 伊鹏翔;Dalvik虚拟机结构与性能的研究[D];吉林大学;2011年
2 郑磊;Java虚拟机垃圾收集机制的研究及优化[D];华东理工大学;2011年
,本文编号:1412008
本文链接:https://www.wllwen.com/kejilunwen/huanjinggongchenglunwen/1412008.html