计算机科学与探索 ›› 2014, Vol. 8 ›› Issue (8): 978-988.DOI: 10.3778/j.issn.1673-9418.1402034

• 系统软件与软件工程 • 上一篇    下一篇

内存泄漏对象检测与度量方法

于  巧1,姜淑娟1+,王兴亚1,鞠小林1,2,董庆杰3   

  1. 1. 中国矿业大学 计算机科学与技术学院,江苏 徐州 221116
    2. 南通大学 计算机科学与技术学院,江苏 南通 226019
    3. 南水北调东线山东干线有限责任公司,济南 250013
  • 出版日期:2014-08-01 发布日期:2014-08-07

Detection and Measurement Method of Memory Leaking Objects

YU Qiao1, JIANG Shujuan1+, WANG Xingya1, JU Xiaolin1,2, DONG Qingjie3   

  1. 1. School of Computer Science and Technology, China University of Mining and Technology, Xuzhou, Jiangsu 221116, China
    2. School of Computer Science and Technology, Nantong University, Nantong, Jiangsu 226019, China
    3. Shandong Trunk Co. Ltd. in the Eastern Route of the South-to-North Water Diversion, Jinan 250013, China
  • Online:2014-08-01 Published:2014-08-07

摘要: 程序运行过程中一些不再被使用的对象未及时释放会引发内存泄漏问题,泄漏对象经过长期累积会降低系统性能,甚至导致系统崩溃。针对Java程序中的内存泄漏问题,提出了一种内存泄漏对象检测与度量方法。通过动态跟踪源程序的执行过程,周期性记录堆栈信息,并分析堆中可疑的泄漏对象。定义内存泄漏度计算方法,度量不同对象对程序泄漏的影响程度,从而确定产生泄漏的对象。最后选取两个开源程序进行验证,并与两种现有方法进行对比,结果表明该方法的泄漏检测率较高。

关键词: 泄漏对象, 动态检测, 堆栈信息, 内存泄漏度

Abstract: Memory leaks occur when objects that are no longer used cannot be released promptly during the execution of programs. After long-term accumulation, leaking objects will reduce system performance and cause the system to crash when they become serious. To solve memory leaks in Java programs, this paper proposes a detection and measurement method of memory leaking objects. Firstly, through tracing the execution of source programs dynamically, this method records stack information periodically and analyzes the suspicious leaking objects in heap. Then it defines a formula for calculating memory leaking confidence, which can measure the influence of different objects on program leaks, thereby confirming the leaked objects. Finally, this paper chooses two open-source programs for verification, and compared with two existing methods, the results show that the proposed method gets higher leak detection rate.

Key words: leaking objects, dynamic detection, stack information, memory leaking confidence