skip to main content
article

Context- and path-sensitive memory leak detection

Published:01 September 2005Publication History
Skip Abstract Section

Abstract

We present a context- and path-sensitive algorithm for detecting memory leaks in programs with explicit memory management. Our leak detection algorithm is based on an underlying escape analysis: any allocated location in a procedure P that is not deallocated in P and does not escape from P is leaked. We achieve very precise context- and path-sensitivity by expressing our analysis using boolean constraints. In experiments with six large open source projects our analysis produced 510 warnings of which 455 were unique memory leaks, a false positive rate of only 10.8%. A parallel implementation improves performance by over an order of magnitude on large projects; over five million lines of code in the Linux kernel is analyzed in 50 minutes.

References

  1. W. Bush, J. Pincus, and D. Sielaff. A static analyzer for finding dynamic programming errors. Software|Practice & Experience, 30(7):775--802, June 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. T. Chilimbi and M. Hauswirth. Low-overhead memory leak detection using adaptive statistical profiling. In Proceedings of the 11th International Conference on Architectural Support for Programming Languages and Operating Systems, 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. A. Chou. Static Analysis for Bug Finding in Systems Software. PhD thesis, Stanford University, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. Emami, R. Ghiya, and L. Hendren. Context-sensitive interprocedural points-to analysis in the presence of function pointers. In Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation, 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. D. Evans. Static detection of dynamic memory errors. In Proceedings of the ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation, 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. B. Hackett and R. Rugina. Region-based shape analysis with tracked locations. In Proceedings of the 32nd Annual Symposium on Principles of Programming Languages, Jan. 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R. Hastings and B. Joyce. Purify: Fast detection of memory leaks and access errors. In Proceedings of the Winter USENIX Conference, Dec. 1992.]]Google ScholarGoogle Scholar
  8. D. L. Heine and M. S. Lam. A practical ow-sensitive and context-sensitive C and C++ memory leak detector. In Proceedings of the ACM SIGPLAN 2003 Conference on Programming Language Design and Implementation, pages 168--181, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. F. Ivancic, Z. Yang, M. Ganai, A. Gupta, and P. Ashar. Efficient SAT-based bounded model checking for software verification. In Proceedings of the 1st International Symposium on Leveraging Applications of Formal Methods, 2004.]]Google ScholarGoogle Scholar
  10. D. Jackson and M. Vaziri. Finding bugs with a constraint solver. In Proceedings of the 2000 ACM SIGSOFT International Symposium on Software Testing and Analysis, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. D. Kroening, E. Clarke, and K. Yorav. Behavioral consistency of C and Verilog programs using bounded model checking. In Proceedings of the 40th Design Automation Conference, pages 368--371. ACM Press, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. W. Landi and B. Ryder. A safe approximation algorithm for interprocedural pointer aliasing. In Proceedings of the ACM SIGPLAN 1992 Conference on Programming Language Design and Implementation, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. D. Liang and M. Harrold. Efficient computation of parameterized pointer information for interprocedural analysis. In Proceedings of the 8th Static Analysis Symposium, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. E. Ruf. Effective synchronization removal for Java. In Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. L. Semeria and G. D. Micheli. SpC: synthesis of pointers in C: application of pointer analysis to the behavioral synthesis from C. In Proceedings of the 1998 IEEE/ACM international conference on Computer-aided design, pages 340--346. ACM Press, 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. Whaley and M. Rinard. Compositional pointer and escape analysis for Java programs. In Proceedings of the 14th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. R. Wilson and M. Lam. Efficient context-sensitive pointer analysis for C programs. In Proceedings of the ACM SIGPLAN 1995 Conference on Programming Language Design and Implementation, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Y. Xie and A. Aiken. Scalable error detection using boolean satisfiability. In Proceedings of the 32nd Annual Symposium on Principles of Programming Languages, Jan. 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Y. Xie and A. Chou. Path sensitive analysis using boolean satisfiability. Technical report, Stanford University, Nov. 2002.]]Google ScholarGoogle Scholar

Index Terms

  1. Context- and path-sensitive memory leak detection

                Recommendations

                Comments

                Login options

                Check if you have access through your login credentials or your institution to get full access on this article.

                Sign in

                Full Access

                • Published in

                  cover image ACM SIGSOFT Software Engineering Notes
                  ACM SIGSOFT Software Engineering Notes  Volume 30, Issue 5
                  September 2005
                  462 pages
                  ISSN:0163-5948
                  DOI:10.1145/1095430
                  Issue’s Table of Contents
                  • cover image ACM Conferences
                    ESEC/FSE-13: Proceedings of the 10th European software engineering conference held jointly with 13th ACM SIGSOFT international symposium on Foundations of software engineering
                    September 2005
                    402 pages
                    ISBN:1595930140
                    DOI:10.1145/1081706

                  Copyright © 2005 ACM

                  Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                  Publisher

                  Association for Computing Machinery

                  New York, NY, United States

                  Publication History

                  • Published: 1 September 2005

                  Check for updates

                  Qualifiers

                  • article

                PDF Format

                View or Download as a PDF file.

                PDF

                eReader

                View online with eReader.

                eReader