Abstract
A memory leak in a Java program occurs when object references that are no longer needed are unnecessarily maintained. Such leaks are difficult to detect because static analysis typically cannot precisely identify these redundant references, and existing dynamic leak detection tools track and report fine-grained information about individual objects, producing results that are usually hard to interpret and lack precision.
In this article we introduce a novel container-based heap-tracking technique, based on the fact that many memory leaks in Java programs occur due to incorrect uses of containers, leading to containers that keep references to unused data entries. The novelty of the described work is twofold: (1) instead of tracking arbitrary objects and finding leaks by analyzing references to unused objects, the technique tracks only containers and directly identifies the source of the leak, and (2) the technique computes a confidence value for each container based on a combination of its memory consumption and its elements' staleness (time since last retrieval), while previous approaches do not consider such combined metrics. Our experimental results show that the reports generated by the proposed technique can be very precise: for two bugs reported by Sun, a known bug in SPECjbb 2000, and an example bug from IBM developerWorks, the top containers in the reports include the containers that leak memory.
- Altman, E., Arnold, M., Fink, S., and Mitchell, N. 2010. Performance analysis of idle programs. In Proceedings of the ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'10). 739--753. Google ScholarDigital Library
- Bond, M. D. and Mckinley, K. S. 2006. Bell: Bit-encoding online memory leak detection. In Proceedings of the International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS'06). 61--72. Google ScholarDigital Library
- Ca Wily Technology. 2013. Wily introscope leakhunter. http://www.adhoc-international.com/pages/en/structure/download/cawily_introscope2.pdf.Google Scholar
- Cherem, S., Princehouse, L., and Rugina, R. 2007. Practical memory leak detection using guarded value-flow analysis. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'07). 480--491. Google ScholarDigital Library
- Choi, J., Gupta, M., Serrano, M., Sreedhar, V., and Midkiff, S. 1999. Escape analysis for java. In Proceedings of the ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'99). 1--19. Google ScholarDigital Library
- Clause, J. and Orso, A. 2010. Leakpoint: Pinpointing the causes of memory leaks. In Proceedings of the International Conference on Software Engineering (ICSE'10). 515--224. Google ScholarDigital Library
- Dacapo Benchmarks. 2006. DaCapo benchmarks. http://www.dacapo-bench.org.Google Scholar
- Depauw, W., Lorenz, D., Vlissides, J., and Wegman, M. 1998. Execution patterns in object-oriented visualization. In Proceedings of the USENIX Conference on Object-Oriented Technologies and Systems (COOTS'98). 219--234. Google ScholarDigital Library
- Depauw, W. and Sevitsky, G. 2000. Visualizing reference patterns for solving memory leaks in java. Concurr. Pract. Exper. 12, 14, 1431--1454.Google ScholarCross Ref
- Dor, N., Rodeh, M., and Sagiv, S. 2000. Checking cleanness in linked lists. In Proceedings of the Static Analysis Symposium (SAS'00). 115--134. Google ScholarDigital Library
- Dufour, B., Ryder, B. G., and Sevitsky, G. 2007. Blended analysis for performance understanding of framework-based applications. In Proceedings of the ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA'07). 118--128. Google ScholarDigital Library
- Dufour, B., Ryder, B. G., and Sevitsky, G. 2008. A scalable technique for characterizing the usage of temporaries in framework-intensive java applications. In Proceedings of the ACM SIGSOFT International Symposium on the Foundations of Software Engineering (FSE'08). 59--70. Google ScholarDigital Library
- Ej-Technologies Gmbh. 2013. JProfiler. http://www.ej-technologies.com.Google Scholar
- Gupta, S. C. and Palanki, R. 2005. Java memory leaks -- Catch me if you can. http://www.ibm.com/developerworks/rational/library/05/0816_GuptaPalanki/.Google Scholar
- Hackett, B. and Rugina, R. 2005. Region-based shape analysis with tracked locations. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL'05). 310--323. Google ScholarDigital Library
- Hastings, R. and Joyce, B. 1992. Purify: A tool for detecting memory leaks and access errors in c and c++ programs. In Proceedings of the Winter USENIX Conference. 125--138.Google Scholar
- Hauswirth, M. and Chilimbi, T. M. 2004. Low-overhead memory leak detection using adaptive statistical profiling. In Proceedings of the International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS'04). 156--164. Google ScholarDigital Library
- Heine, D. L. and Lam, M. S. 2003. A practical flow-sensitive and context-sensitive c and c++ memory leak detector. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'03). 168--181. Google ScholarDigital Library
- Heine, D. L. and Lam, M. S. 2006. Static detection of leaks in polymorphic containers. In Proceedings of the International Conference on Software Engineering (ICSE'06). 252--261. Google ScholarDigital Library
- Jikes Research Virtual Machine. 2013. http://jikesrvm.org.Google Scholar
- Jump, M. and Mckinley, K. S. 2007. Cork: Dynamic memory leak detection for garbage-collected languages. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL'07). 31--38. Google ScholarDigital Library
- Jump, M. and Mckinley, K. S. 2010. Detecting memory leaks in managed languages with cork. Softw. Pract. Exper. 40, 1, 1--22. Google ScholarDigital Library
- Maxwell, E. K., Back, G., and Ramakrishnan, N. 2010. Diagnosing memory leaks using graph mining on heap dumps. In Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD'10). 115--124. Google ScholarDigital Library
- Mitchell, N. 2006. The runtime structure of object ownership. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'06). 74--98. Google ScholarDigital Library
- Mitchell, N., Schonberg, E., and Sevitsky, G. 2009. Making sense of large heaps. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'09). 77--97. Google ScholarDigital Library
- Mitchell, N., Schonberg, E., and Sevitsky, G. 2010. Four trends leading to java runtime bloat. IEEE Softw. 27, 1, 56--63. Google ScholarDigital Library
- Mitchell, N. and Sevitsky, G. 2003. Leakbot: An automated and lightweight tool for diagnosing memory leaks in large java applications. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'03). 351--377.Google Scholar
- Mitchell, N. and Sevitsky, G. 2007. The causes of bloat, the limits of health. In Proceedings of the ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'07). 245--260. Google ScholarDigital Library
- Mitchell, N., Sevitsky, G., and Srinivasan, H. 2006. Modeling runtime behavior in framework-based applications. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'06). 429--451. Google ScholarDigital Library
- Nicholas, E. 2006. http://weblogs.java.net/blog/enicholas/archive/2006/04/leaking evil.html.Google Scholar
- Novark, G., Berger, E. D., and Zorn, B. G. 2009. Efficiently and precisely locating memory leaks and bloat. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'09). 397--407. Google ScholarDigital Library
- Orlovich, M. and Rugina, R. 2006. Memory leak analysis by contradiction. In Proceedings of the Static Analysis Symposium (SAS'06). 405--424. Google ScholarDigital Library
- Qin, F., Lu, S., and Zhou, Y. 2005. Safemem: Exploiting ecc-memory for detecting memory leaks and memory corruption during production runs. In Proceedings of the International Symposium on High-Performance Computer Architecture (HPCA'05). 291--302. Google ScholarDigital Library
- Quest Software. 2013. JProbe memory debugging. http://www.quest.com/jprobe.Google Scholar
- Rayside, D. and Mendel, L. 2007. Object ownership profiling: A technique for finding and fixing memory leaks. In Proceedings of the International Conference on Automated Software Engineering (ASE'07). 194--203. Google ScholarDigital Library
- Shacham, O., Vechev, M., and Yahav, E. 2009. Chameleon: Adaptive selection of collections. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'09). 408--418. Google ScholarDigital Library
- Shaham, R., Kolodner, E. K., and Sagiv, M. 2000. Automatic removal of array memory leaks in java. In Proceedings of the International Conference on Compiler Construction (CC'00). 50--66. Google ScholarDigital Library
- Shankar, A., Arnold, M., and Bodik, R. 2008. JOLT: Lightweight dynamic analysis and removal of object churn. In Proceedings of the ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'08). 127--142. Google ScholarDigital Library
- Standard Performance Evaluation Corporation. 2000. SPECjbb2000. http://www.spec.org/jbb2000.Google Scholar
- Sun Bug Database. 2013. http://bugs.sun.com/bugdatabase.Google Scholar
- Vallee-Rai, R., Gagnon, E., Hendren, L., Lam, P., Pominville, P., and Sundaresan, V. 2000. Optimizing java bytecode using the soot framework: Is it feasible? In Proceedings of the International Conference on Compiler Construction (CC'00). 18--34. Google ScholarDigital Library
- Xiao, X., Zhou, J., and Zhang, C. 2011. Tracking data structures for postmortem analysis. In Proceedings of the International Conference on Software Engineering (ICSE'11). 896--899. Google ScholarDigital Library
- Xie, Y. and Aiken, A. 2005. Context- and path-sensitive memory leak detection. In Proceedings of the ACM SIGSOFT International Symposium on the Foundations of Software Engineering (FSE'05). 115--125. Google ScholarDigital Library
- Xu, G. 2011. Analyzing large-scale object-oriented software to find and remove runtime bloat. Ph.D. thesis, The Ohio State University. Google ScholarDigital Library
- Xu, G., Arnold, M., Mitchell, N., Rountev, A., and Sevitsky, G. 2009. Go with the flow: Profiling copies to find runtime bloat. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'09). 419--430. Google ScholarDigital Library
- Xu, G., Arnold, M., Mitchell, N., Rountev, A., Schonberg, E., And Sevitsky, G. 2010a. Finding low-utility data structures. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'10). 174--186. Google ScholarDigital Library
- Xu, G., Mitchell, N., Arnold, M., Rountev, A., and Sevitsky, G. 2010b. Software bloat analysis: Finding, removing, and preventing performance problems in modern large-scale object-oriented applications. In Proceedings of the FSE/SDP Working Conference on the Future of Software Engineering Research (FoSER'10). 421--426. Google ScholarDigital Library
- Xu, G., Bond, M. D., Qin, F., and Rountev, A. 2011. LeakChaser: Helping programmers narrow down causes of memory leaks. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'11). 270--282. Google ScholarDigital Library
- Xu, G. and Rountev, A. 2008. Precise memory leak detection for java software using container profiling. In Proceedings of the International Conference on Software Engineering (ICSE'08). 151--160. Google ScholarDigital Library
- Xu, G. and Rountev, A. 2010. Detecting inefficiently-used containers to avoid bloat. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'10). 160--173. Google ScholarDigital Library
- Yan, D., Xu, G., and Rountev, A. 2012. Uncovering performance problems in java applications with reference propagation profiling. In Proceedings of the International Conference on Software Engineering (ICSE'12). Google ScholarDigital Library
Index Terms
- Precise memory leak detection for java software using container profiling
Recommendations
Low-overhead memory leak detection using adaptive statistical profiling
ASPLOS XI: Proceedings of the 11th international conference on Architectural support for programming languages and operating systemsSampling has been successfully used to identify performance optimization opportunities. We would like to apply similar techniques to check program correctness. Unfortunately, sampling provides poor coverage of infrequently executed code, where bugs ...
Precise memory leak detection for java software using container profiling
ICSE '08: Proceedings of the 30th international conference on Software engineeringA memory leak in a Java program occurs when object references that are no longer needed are unnecessarily maintained. Such leaks are difficult to understand because static analyses typically cannot precisely identify these redundant references, and ...
Practical memory leak detection using guarded value-flow analysis
PLDI '07: Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and ImplementationThis 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 ...
Comments