skip to main content
10.1145/1250734.1250789acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
Article

Practical memory leak detection using guarded value-flow analysis

Published:10 June 2007Publication History

ABSTRACT

This paper presents a practical inter-procedural analysis algorithm for detecting memory leaks in C programs. Our algorithm tracks the flow of values from allocation points to deallocation points using a sparse representation of the program consisting of a value flow graph that captures def-use relations and value flows via program assignments. Edges in the graph are annotated with guards that describe branch conditions in the program. The memory leak analysis is reduced to a reachability problem over the guarded value flowgraph. Our implemented tool has been effective at detecting more than 60 memory leaks in the SPEC2000 benchmarks and in two open-source applications, bash and sshd, while keeping the false positive rate below 20%. The sparse program representation makes the tool efficient in practice, and allows it to report concise error messages.

References

  1. Thomas Ball, Rupak Majumdar, Todd Millstein, and Sriram K. Rajamani. Automatic predicate abstraction of C programs. In Proceedings of the ACM Conference on Program Language Design and Implementation, Snowbird, Utah, June 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Thomas Ball and Sriram K. Rajamani. The SLAM project: debugging system software via static analysis. In Proceedings of the Annual ACM Symposium on the Principles of Programming Languages, Portland, OR, January 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Ron Cytron, Jeanne Ferrante, Barry Rosen, Mark Wegman, and F. Kenneth Zadeck. An efficient method of computing static single assignment form. In Proceedings of the Annual ACM Symposium on the Principles of Programming Languages, Austin, TX, June 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Manuvir Das, Sorin Lerner, and Mark Seigle. ESP: Path-sensitive program verification in polynomial time. In Proceedings of the ACM Conference on Program Language Design and Implementation, Berlin, Germany, June 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Nurit Dor, Michael Rodeh, and Mooly Sagiv. Checking cleanness in linked lists. In Proceedings of the International Static Analysis Symposium, Santa Barbara, CA, July 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Dawson Engler, Benjamin Chelf, Andy Chou, and Seth Hallem. Checking system rules using system-specific, programmer-written compiler extensions. In Proceedings of the Symposium on Operating System Design and Implementation, San Diego, CA, October 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Jeffrey S. Foster, Robert Johnson, John Kodumal, and Alex Aiken. Flow-insensitive type qualifiers. ACM Transactions on Programming Languages and Systems, 28(6):1035--1087, November 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Emden R. Gansner and Stephen C. North. An open graph visualization system and its applications to software engineering. Software -- Practice and Experience, 30(11):1203--1233, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Brian Hackett and Radu Rugina. Shape analysis with tracked locations. In Proceedings of the Annual ACM Symposium on the Principles of Programming Languages, Long Beach, CA, January 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. David L. Heine and Monica S. Lam. A practical flow-sensitive and context-sensitive C and C++ memory leak detector. In Proceedings of the ACM Conference on Program Language Design and Implementation, San Diego, CA, June 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. David L. Heine and Monica S. Lam. Static detection of leaks in polymorphic containers. In Proceeding of the International Conference on Software Engineering (ICSE), Shanghai, China, May 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Gerard J. Holzmann. UNO: Static source code checking for userdefined properties. In Proceedings of the World Conference on Integrated Design and Process Technology, Pasadena, CA, June 2002.Google ScholarGoogle Scholar
  13. V. Benjamin Livshits and Monica S. Lam. Tracking pointers with path and context sensitivity for bug detection in C programs. In ACM SIGSOFT Symposium on the Foundations of Software Engineering, Helsinki, Finland, September 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Maksim Orlovich and Radu Rugina. Memory leak analysis by contradition. In Proceedings of the International Static Analysis Symposium, Seoul, Korea, August 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Daniel Le Berre (project leader). SAT4J: A satisfiability library for java. http://www.sat4j.org/, January 2006.Google ScholarGoogle Scholar
  16. Thomas Reps, Susan Horowitz, and Mooly Sagiv. Precise interprocedural dataflow analysis via graph reachability. In Proceedings of the Annual ACM Symposium on the Principles of Programming Languages, San Francisco, CA, January 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Mooly Sagiv, Thomas Reps, and Reinhard Wilhelm. Parametric shape analysis via 3-valued logic. In Proceedings of the Annual ACM Symposium on the Principles of Programming Languages, San Antonio, TX, January 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Gregor Snelting, Torsten Robschink, and Jens Krinke. Efficient path conditions in dependence graphs for software safety analysis. ACM Transactions on Software Engineering and Methodology, 15(4):410--457, October 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Bjarne Steensgaard. Points-to analysis in almost linear time. In Proceedings of the Annual ACM Symposium on the Principles of Programming Languages, St. Petersburg Beach, FL, January 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Peng Tu and David Padua. Efficient building and placing of gating functions. In Proceedings of the ACM Conference on Program Language Design and Implementation, La Jolla, CA, June 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. J. Uniejewski. SPEC Benchmark Suite: Designed for today's advanced systems. SPEC Newsletter Volume 1, Issue 1, SPEC, Fall 1989.Google ScholarGoogle Scholar
  22. Yichen Xie and Alex Aiken. Context- and path-sensitive memory leak detection. In ACM SIGSOFT Symposium on the Foundations of Software Engineering, Lisbon, Portugal, September 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Junfeng Yang, Paul Twohey, Dawson Engler, and Madanlal Musuvathi. Using model checking to find serious file system errors. In Proceedings of the Symposium on Operating System Design and Implementation, San Francisco, CA, December 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Practical memory leak detection using guarded value-flow analysis

            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
            • Published in

              cover image ACM Conferences
              PLDI '07: Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and Implementation
              June 2007
              508 pages
              ISBN:9781595936332
              DOI:10.1145/1250734
              • cover image ACM SIGPLAN Notices
                ACM SIGPLAN Notices  Volume 42, Issue 6
                Proceedings of the 2007 PLDI conference
                June 2007
                491 pages
                ISSN:0362-1340
                EISSN:1558-1160
                DOI:10.1145/1273442
                Issue’s Table of Contents

              Copyright © 2007 ACM

              Publisher

              Association for Computing Machinery

              New York, NY, United States

              Publication History

              • Published: 10 June 2007

              Permissions

              Request permissions about this article.

              Request Permissions

              Check for updates

              Qualifiers

              • Article

              Acceptance Rates

              Overall Acceptance Rate406of2,067submissions,20%

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader
            About Cookies On This Site

            We use cookies to ensure that we give you the best experience on our website.

            Learn more

            Got it!