在运行时系统中,堆碎片对内存管理以及应用程序运行性能具有十分重要影响。碎片降低了堆空间的利用率并且影响了数据的局部性特性,增加了对象访问的开销。随着程序长时间运行,碎片化严重时就会由于无法满足应用程序内存分配的需求,而导致提前触发堆空间的垃圾回收,从而导致更多的性能开销。针对以上问题,本文首先分析了堆空间碎片产生的原因以及对运行时性能的影响,提出了局部堆碎片消除机制,在此基础上设计了动态调节堆预留空间的大小方案,提高了堆空间利用率。
In programming language runtime systems,heap fragmentation is one of the major performance bottleneck. The heap fragment reduces the heap usage utilization as well as affects the data locality. As the program runs for a long time,the fragmentation becomes seriously,and the heap will be unable to meet the demand of allocations. It also could trigger ahead of schedule,and then bring performance penalty. To solve the aboved problem,this paper first analyses how the heap produced the fragments and then proposes an improved partial heap compaction mechanism. After that,method of dynamic adjustment for compaction reserve space is also presented to improve the heap usage utilization.