skip to main content
10.1145/1993498.1993530acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

LeakChaser: helping programmers narrow down causes of memory leaks

Published:04 June 2011Publication History

ABSTRACT

In large programs written in managed languages such as Java and C#, holding unnecessary references often results in memory leaks and bloat, degrading significantly their run-time performance and scalability. Despite the existence of many leak detectors for such languages, these detectors often target low-level objects; as a result, their reports contain many false warnings and lack sufficient semantic information to help diagnose problems. This paper introduces a specification-based technique called LeakChaser that can not only capture precisely the unnecessary references leading to leaks, but also explain, with high-level semantics, why these references become unnecessary.

At the heart of LeakChaser is a three-tier approach that uses varying levels of abstraction to assist programmers with different skill levels and code familiarity to find leaks. At the highest tier of the approach, the programmer only needs to specify the boundaries of coarse-grained activities, referred to as transactions. The tool automatically infers liveness properties of these transactions, by monitoring the execution, in order to find unnecessary references. Diagnosis at this tier can be performed by any programmer after inspecting the APIs and basic modules of a program, without understanding of the detailed implementation of these APIs. At the middle tier, the programmer can introduce application-specific semantic information by specifying properties for the transactions. At the lowest tier of the approach is a liveness checker that does not rely on higher-level semantic information, but rather allows a programmer to assert lifetime relationships for pairs of objects. This task could only be performed by skillful programmers who have a clear understanding of data structures and algorithms in the program.

We have implemented LeakChaser in Jikes RVM and used it to help us diagnose several real-world leaks. The implementation incurs a reasonable overhead for debugging and tuning. Our case studies indicate that the implementation is powerful in guiding programmers with varying code familiarity to find the root causes of several memory leaks---even someone who had not studied a leaking program can quickly find the cause after using LeakChaser's iterative process that infers and checks properties with different levels of semantic information.

References

  1. The Jikes Research Virtual Machine, 2011. http://jikesrvm.org.Google ScholarGoogle Scholar
  2. JML Reference Manual, 2010. http://www.jmlspecs.org.Google ScholarGoogle Scholar
  3. E. E. Aftandilian and S. Z. Guyer. GC Assertions: Using the garbage collector to check heap properties. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 235--244, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. E. Altman, M. Arnold, S. Fink, and N. Mitchell. Performance analysis of idle programs. In ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 739--753, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. M. Arnold, M. Vechev, and E. Yahav. QVM: An efficient runtime for detecting defects in deployed systems. In ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 143--162, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. M. Blackburn and K. S. McKinley. Immix: a mark-region garbage collector with space efficiency, fast collection, and mutator performance. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 22--32, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. VanDrunen, von Dincklage, and Wiedermann}dacapo-oopsla06-fullS. M. Blackburn, R. Garner, C. Hoffman, A. M. Khan, K. S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S. Z. Guyer, M. Hirzel, A. Hosking, M. Jump, H. Lee, J. E. B. Moss, A. Phansalkar, D. Stefanović, T. VanDrunen, D. von Dincklage, and B. Wiedermann. The DaCapo benchmarks: Java benchmarking development and analysis. In ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 169--190, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. M. D. Bond and K. S. McKinley. Bell: Bit-encoding online memory leak detection. In International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), pages 61--72, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. D. Bond and K. S. McKinley. Leak pruning. In International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), pages 277--288, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. D. Bond and K. S. McKinley. Tolerating memory leaks. In ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 109--126, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. J. Burnim and K. Sen. Asserting and checking determinism for multithreaded programs. In ACM SIGSOFT International Symposium on the Foundations of Software Engineering (FSE), pages 3--12, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. J. Burnim and K. Sen. Determin: Inferring likely deterministic specifications of multithreaded programs. In International Conference on Software Engineering (ICSE), pages 415--424, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. CA Technologies. CA Wily Introscope LeakHunter. www.ca.com/ us/application-management.aspx.Google ScholarGoogle Scholar
  14. J. Clause and A. Orso. Leakpoint: pinpointing the causes of memory leaks. In International Conference on Software Engineering (ICSE), pages 515--224, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. B. Dufour, B. G. Ryder, and G. Sevitsky. A scalable technique for characterizing the usage of temporaries in framework-intensive Java applications. In ACM SIGSOFT International Symposium on the Foundations of Software Engineering (FSE), pages 59--70, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. ej-technologies GmbH. JProfiler. www.ej-technologies.com.Google ScholarGoogle Scholar
  17. R. Hastings and B. Joyce. Purify: A tool for detecting memory leaks and access errors in C and C programs. In Winter 1992 USENIX Conference, pages 125--138, 1992Google ScholarGoogle Scholar
  18. M. Hauswirth and T. M. Chilimbi. Low-overhead memory leak detection using adaptive statistical profiling. In International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), pages 156--164, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. hertz-toplas06M. Hertz, S. M. Blackburn, J. E. B. Moss, K. S. McKinley, and D. Stefanović. Generating object lifetime traces with Merlin. ACM Transactions on Programming Languages and Systems (TOPLAS), 28 (3): 476--516, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. M. Jump and K. S. McKinley. Cork: Dynamic memory leak detection for garbage-collected languages. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pages 31--38, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. N. Mitchell. The runtime structure of object ownership. In European Conference on Object-Oriented Programming (ECOOP), pages 74--98, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. N. Mitchell and G. Sevitsky. The causes of bloat, the limits of health. In ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 245--260, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. N. Mitchell and G. Sevitsky. Leakbot: An automated and lightweight tool for diagnosing memory leaks in large Java applications. In European Conference on Object-Oriented Programming (ECOOP), pages 351--377, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  24. N. Mitchell, G. Sevitsky, and H. Srinivasan. Modeling runtime behavior in framework-based applications. In European Conference on Object-Oriented Programming (ECOOP), pages 429--451, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. N. Mitchell, E. Schonberg, and G. Sevitsky. Making sense of large heaps. In European Conference on Object-Oriented Programming (ECOOP), pages 77--97, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. N. Mitchell, E. Schonberg, and G. Sevitsky. Four trends leading to Java runtime bloat. IEEE Software, 27 (1): 56--63, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. G. Novark, E. D. Berger, and B. G. Zorn. Efficiently and precisely locating memory leaks and bloat. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 397--407, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Quest Software. JProbe. www.quest.com/jprobe.Google ScholarGoogle Scholar
  29. D. Rayside and L. Mendel. Object ownership profiling: A technique for finding and fixing memory leaks. In International Conference on Automated Software Engineering (ASE), pages 194--203, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. C. Reichenbach, N. Immerman, Y. Smaragdakis, E. Aftandilian, and S. Z. Guyer. What can the GC compute efficiently? A language for heap assertions at GC time. In ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 256--269, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. O. Shacham, M. Vechev, and E. Yahav. Chameleon: Adaptive selection of collections. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 408--418, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. A. Shankar, M. Arnold, and R. Bodik. Jolt: Lightweight dynamic analysis and removal of object churn. In ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 127--142, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Y. Tang, Q. Gao, and F. Qin. LeakSurvivor: Towards safely tolerating memory leaks for garbage-collected languages. In The USENIX Anual Technical Conference (USENIX), pages 307--320, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. The Standard Performance Evaluation Corporation. SPECjvm98 Benchmark Set. http://www.spec.org/jvm98/.Google ScholarGoogle Scholar
  35. M. Vechev, E. Yahav, and G. Yorsh. PHALANX: Parallel checking of expressive heap assertions. In International Symposium on Memory Management (ISMM), pages 41--50, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. G. Xu and A. Rountev. Precise memory leak detection for Java software using container profiling. In International Conference on Software Engineering (ICSE), pages 151--160, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. G. Xu and A. Rountev. Detecting inefficiently-used containers to avoid bloat. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 160--173, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. G. Xu, M. Arnold, N. Mitchell, A. Rountev, and G. Sevitsky. Go with the flow: Profiling copies to find runtime bloat. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 419--430, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Xu, Mitchell, Arnold, Rountev, Schonberg, and Sevitsky}xu-pldi10-DataStructureG. Xu, N. Mitchell, M. Arnold, A. Rountev, E. Schonberg, and G. Sevitsky. Finding low-utility data structures. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 174--186, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Xu, Mitchell, Arnold, Rountev, and Sevitsky}xu-foser10G. Xu, N. Mitchell, M. Arnold, A. Rountev, and G. Sevitsky. Software bloat analysis: Finding, removing, and preventing performance problems in modern large-scale object-oriented applications. In ACM SIGSOFT FSE/SDP Workshop on the Future of Software Engineering Research, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. LeakChaser: helping programmers narrow down causes of memory leaks

        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 '11: Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation
          June 2011
          668 pages
          ISBN:9781450306638
          DOI:10.1145/1993498
          • General Chair:
          • Mary Hall,
          • Program Chair:
          • David Padua
          • cover image ACM SIGPLAN Notices
            ACM SIGPLAN Notices  Volume 46, Issue 6
            PLDI '11
            June 2011
            652 pages
            ISSN:0362-1340
            EISSN:1558-1160
            DOI:10.1145/1993316
            Issue’s Table of Contents

          Copyright © 2011 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: 4 June 2011

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article

          Acceptance Rates

          Overall Acceptance Rate406of2,067submissions,20%

          Upcoming Conference

          PLDI '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader