• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

Computer Engineering & Science

Previous Articles     Next Articles

C++ program memory leakage analysis
based on static test
 

CHEN Bei1,XU Qingguo1,2   

  1. (1.School of Computer Engineering and Science,Shanghai University,Shanghai 200444;
    2.Laboratory of Computer Software Evaluating and Testing,Shanghai 200444,China)
  • Received:2015-09-10 Revised:2015-12-02 Online:2017-01-25 Published:2017-01-25

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.

Key words: memory leakage, static testing, abstract syntax tree, control flow graph