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.
- The Jikes Research Virtual Machine, 2011. http://jikesrvm.org.Google Scholar
- JML Reference Manual, 2010. http://www.jmlspecs.org.Google Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- CA Technologies. CA Wily Introscope LeakHunter. www.ca.com/ us/application-management.aspx.Google Scholar
- J. Clause and A. Orso. Leakpoint: pinpointing the causes of memory leaks. In International Conference on Software Engineering (ICSE), pages 515--224, 2010. Google ScholarDigital Library
- 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 ScholarDigital Library
- ej-technologies GmbH. JProfiler. www.ej-technologies.com.Google Scholar
- 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 Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- N. Mitchell. The runtime structure of object ownership. In European Conference on Object-Oriented Programming (ECOOP), pages 74--98, 2006. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarCross Ref
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- N. Mitchell, E. Schonberg, and G. Sevitsky. Four trends leading to Java runtime bloat. IEEE Software, 27 (1): 56--63, 2010. Google ScholarDigital Library
- 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 ScholarDigital Library
- Quest Software. JProbe. www.quest.com/jprobe.Google Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- The Standard Performance Evaluation Corporation. SPECjvm98 Benchmark Set. http://www.spec.org/jvm98/.Google Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
Index Terms
- LeakChaser: helping programmers narrow down causes of memory leaks
Recommendations
Automated memory leak detection for production use
ICSE 2014: Proceedings of the 36th International Conference on Software EngineeringThis paper presents Sniper, an automated memory leak detection tool for C/C++ production software. To track the staleness of allocated memory (which is a clue to potential leaks) with little overhead (mostly <3%), Sniper leverages instruction sampling ...
Efficiently and precisely locating memory leaks and bloat
PLDI '09: Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and ImplementationInefficient use of memory, including leaks and bloat, remain a significant challenge for C and C++ developers. Applications with these problems become slower over time as their working set grows and can become unresponsive. At the same time, memory ...
LeakChaser: helping programmers narrow down causes of memory leaks
PLDI '11In 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 ...
Comments