C程序内存泄漏智能化检测方法
作者:
作者单位:

作者简介:

朱亚伟(1993-),男,安徽寿县人,硕士生,CCF学生会员,主要研究领域为软件分析,软件测试.王林章(1973-),男,博士,教授,博士生导师,CCF杰出会员,主要研究领域为模型驱动的软件测试与验证,安全测试,软件测试自动化.左志强(1986-),男,博士,助理研究员,CCF专业会员,主要研究领域为系统软件,软件工程,程序语言,大数据系统.李宣东(1963-),男,博士,教授,博士生导师,CCF会士,主要研究领域为软件工程.

通讯作者:

王林章,E-mail:lzwang@nju.edu.cn

中图分类号:

基金项目:

国家重点研发计划(2016YFB1000802);国家自然科学基金(61802168,61632015);中央高校基本科研业务费专项资金(020214380047)


Memory Leak Intelligent Detection Method for C Programs
Author:
Affiliation:

Fund Project:

National Key Research and Development Program of China (2016YFB1000802); National Natural Science Foundation of China (61802168, 61632015); Fundamental Research Funds for the Central Universities (020214380047)

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    内存泄漏在采用显式内存管理机制的C语言中是一种常见的代码缺陷,内存泄漏的检测方法目前主要是静态分析与动态检测.动态检测开销大,且高度依赖测试用例;静态分析目前被学术界和工业界广泛应用,但是存在大量误报,需要人工对检测结果进行确认.内存泄漏静态分析的误报通常是由于对指针、分支语句和全局变量分析的不准确性导致的.提出了一种内存泄漏的智能化检测方法,通过使用机器学习算法学习程序特征与内存泄漏之间的相关性,构建机器学习分类器,并应用机器学习分类器进一步提高内存泄漏静态分析的准确性.首先构建机器学习分类器,然后通过静态分析方法构建从内存分配点开始的Sparse Value Flow Graph(SVFG),并从中提取内存泄漏相关特征,再使用规则和机器学习分类器进行内存泄漏的检测.实验结果显示,该方法在分析指针、分支语句和全局变量时是有效的,能够提高内存泄漏检测的准确性,降低内存泄漏检测结果的误报.最后,对未来研究的可行性以及面临的挑战进行了展望.

    Abstract:

    Memory leak is a common code bug for C programs which uses explicit memory management mechanisms. At present, the main detection methods of memory leaks are static analysis and dynamic detection. Dynamic detection has huge overhead and it is highly dependent on test cases. Static analysis is widely used by academic and industry, but there are a large number of false positives, which need to be manually confirmed. Inaccuracy in the analysis of pointers, branch statements, and global variables leads to false positives in static analysis of memory leaks. In this study, an intelligent detection method is proposed for memory leak. By using machine learning algorithms to learn the correlation between program's features and memory leaks, a machine learning classifier is built and applied to improve the accuracy of static analysis of memory leaks. Firstly, a machine learning classifier is trained. Then, the sparse value flow graph (SVFG) starting from allocation should be constructed by using the static analysis, the features related to memory leaks can be extracted from the SVFG. Lastly, the memory leaks are detected by using rules and machine learning classifier. Experimental results show that the proposed method is effective in analyzing pointers, branch statements, and global variables, and can reduce the false positives of memory leak detection. At the end of this paper, the feasibility of future research and the upcoming challenges are presented.

    参考文献
    相似文献
    引证文献
引用本文

朱亚伟,左志强,王林章,李宣东. C程序内存泄漏智能化检测方法.软件学报,2019,30(5):1330-1341

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2018-08-29
  • 最后修改日期:2018-10-31
  • 录用日期:
  • 在线发布日期: 2019-05-08
  • 出版日期:
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号