首页 | 本学科首页   官方微博 | 高级检索  
     

基于静态检测的C++内存泄漏分析
引用本文:陈贝,许庆国.基于静态检测的C++内存泄漏分析[J].计算机工程与科学,2017,39(1):118-124.
作者姓名:陈贝  许庆国
作者单位:;1.上海大学计算机工程与科学学院;2.上海市计算机软件评测重点实验室
基金项目:国家自然科学基金(61170044,61572306,61502294)
摘    要:C++是一种非常流行的计算机编程语言,在使用的过程中容易出现内存泄漏问题,而该问题往往难以识别。给出了一种对C++内存泄漏问题进行分析的方法,该方法得到C++源代码的抽象语法树,从抽象语法树中提取程序控制流图,然后将类的构造函数、普通成员函数以及析构函数的程序控制流图相互连接形成新的程序控制流图,并设计算法对控制流图进行检测。最后通过一些内存泄漏的典型实例进行测试,实验表明本方法有效。

关 键 词:内存泄漏  静态检测  抽象语法树  控制流图
收稿时间:2015-09-10
修稿时间:2017-01-25

C++ program memory leakage analysis based on static test
CHEN Bei,XU Qing guo.C++ program memory leakage analysis based on static test[J].Computer Engineering & Science,2017,39(1):118-124.
Authors:CHEN Bei  XU Qing guo
Affiliation:(1.School of Computer Engineering and Science,Shanghai University,Shanghai 200444; 2.Laboratory of Computer Software Evaluating and Testing,Shanghai 200444,China)
Abstract:C++ is a very popular computer programming language and memory leakage is one of the most hard to find common error in C++ programs. We design a static analyzer that can detect memory leakage for C++ programs. Firstly, we extract the control flow graph from the abstract syntax tree generated from C++ source via g++. Secondly, we build some new control flow graphs by connecting the control flow graphs of memory functions for the same class. Finally, we design and implement an algorithm to analyze the new control flow graphs to report all possible errors. Experiment results, for some examined examples, show that our method is effective.
Keywords:memory leakage  static testing  abstract syntax tree  control flow graph  
点击此处可从《计算机工程与科学》浏览原始摘要信息
点击此处可从《计算机工程与科学》下载全文
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号