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

Computer Engineering & Science

Previous Articles     Next Articles

Memory leak mechanism analysis
and detection of C Programs

ZHANG Jing1,HUANG Zhi-qiu1,2,SHEN Guo-hua1,2,YU Yao-shen1,AI Lei1   

  1. (1.College of Computer Science and Technology,Nanjing University of Aeronautics and Astronautics,Nanjing 211016;
    2.Key Laboratory of Safety-Critical Software(Nanjing University of Aeronautics and Astronautics),
    Ministry of Industry and Information Technology,Nanjing 211106,China)
     
  • Received:2019-09-05 Revised:2019-12-11 Online:2020-05-25 Published:2020-05-25

Abstract:

As the main implementation language of safety-critical software, memory leak defects of C language are highly concealed and harmful. How to ensure the accuracy and efficiency of memory leak detection is a big challenge. Static analysis has the advantage of directly analyzing the source code, detecting software errors early, so it can reduce the cost of repairs. Based on static analysis technology, the paper proposes a memory leak detection method based on path-sensitive value-flow analysis. Firstly, pointer analysis is performed to generate precise point-to information. Secondly, based on the point-to information, value-flow constraints are constructed, and reachability analysis is performed to identify the memory leak paths in the program. Finally, the memory leak paths are verified by the effective life cycle of pointers and memory addresses. Experimental results on typical benchmark C programs show that the proposed method can improve the efficiency and accuracy compared with the existing technology.

 
 

Key words: memory leak, static analysis, pointer analysis, value-flow analysis