Static Detection Method for C/C++ Memory Defects Based on Triad Memory Model

  • Yuxia Wang
  • Fusheng JinEmail author
  • Xiangyu Han
  • Runan Wang
Conference paper
Part of the Communications in Computer and Information Science book series (CCIS, volume 849)


The improper use of pointers in C/C++ programming language brings about a lot of memory-related issues. In this paper, causes of four kinds of memory defects are analyzed and summarized. Besides, a novel triad memory model has been proposed. Based on the model and the variable life cycle methodology, an approach for inner-procedure and inter-procedure detection has been presented too. Eventually, the prototype CAnalyzer is implemented on the basis of Clang static analyzer. Experiment results show that CAnalyzer can effectively detect the four types of memory defects.


Memory defects Memory model Life cycle Inner and Inter-procedure detection 


  1. Xu, Z., Zhang, J., Xu, Z.: Melton: a practical and precise memory leak detection tool for C programs. Front. Comput. Sci. 9(1), 34–54 (2015)MathSciNetCrossRefGoogle Scholar
  2. Zhang, S., Shang, Z.: Software defect pattern analysis and location based on Cppcheck. Comput. Eng. Appl. 51(3), 69–73 (2015). (in Chinese)Google Scholar
  3. Jung, Y., Yi, K.: Practical memory leak detector based on parameterized procedural summaries. In: Proceedings of the 7th International Symposium on Memory Management, pp. 131–140. ACM (2008)Google Scholar
  4. Cherem, S., Princehouse, L., Rugina, R.: Practical memory leak detection using guarded value-flow analysis. In: Proceedings of PLDI, pp. 480–491 (2007)CrossRefGoogle Scholar
  5. Sui, Y., Ye, D., Xue, J.: Static memory leak detection using full-sparse value-flow analysis. In: Proceedings of International Symposium on Software Testing and Analysis. pp. 254–264 (2012)Google Scholar
  6. Li, Q., Pan, M., Li, X.: Memory leak detection tools and evaluation methods. Comput. Sci. Explor. 3(1), 29–35 (2010). (in Chinese)Google Scholar
  7. Wang, S., Quan, Y., Sun, J.: False positive recognition method for hull pointer reference defect based on classification. J. Comput. Appl. 10(2968), 2972–3005 (2017). (in Chinese)Google Scholar
  8. Li, X., Zhou, Y., Li, M.C., Chen, Y.J., Xu, G.Q., Wang, L.Z., Li, X.D.: Automatically validating static memory leak warnings for C/C++ programs. Ruan Jian Xue Bao/J. Softw. 28(4), 827–844 (2017). (in Chinese)Google Scholar
  9. Xu, Z., Kremenek, T., Zhang, J.: A memory model for static analysis of C programs. In: Margaria, T., Steffen, B. (eds.) ISoLA 2010. LNCS, vol. 6415, pp. 535–548. Springer, Heidelberg (2010). Scholar
  10. Alam, S., Qu, Z., Riley, R., et al.: DroidNative: automating and optimizing detection of android native code malware variants. Comput. Secur. 65, 230–246 (2017)CrossRefGoogle Scholar
  11. Xie, Y., Aiken, A.: Context-and path-sensitive memory leak detection. In: ACM SIGSOFT Software Engineering Notes, vol. 30(5), pp. 115–125. ACM (2005)Google Scholar

Copyright information

© Springer Nature Singapore Pte Ltd. 2018

Authors and Affiliations

  • Yuxia Wang
    • 1
  • Fusheng Jin
    • 1
    Email author
  • Xiangyu Han
    • 2
  • Runan Wang
    • 1
  1. 1.Beijing Institute of TechnologyBeijingChina
  2. 2.Aerospace Automatic Control InstituteBeijingChina

Personalised recommendations