skip to main content
research-article

Precise memory leak detection for java software using container profiling

Published:30 July 2013Publication History
Skip Abstract Section

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. Ca Wily Technology. 2013. Wily introscope leakhunter. http://www.adhoc-international.com/pages/en/structure/download/cawily_introscope2.pdf.Google ScholarGoogle Scholar
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. Dacapo Benchmarks. 2006. DaCapo benchmarks. http://www.dacapo-bench.org.Google ScholarGoogle Scholar
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. Depauw, W. and Sevitsky, G. 2000. Visualizing reference patterns for solving memory leaks in java. Concurr. Pract. Exper. 12, 14, 1431--1454.Google ScholarGoogle ScholarCross RefCross Ref
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. Ej-Technologies Gmbh. 2013. JProfiler. http://www.ej-technologies.com.Google ScholarGoogle Scholar
  14. 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 ScholarGoogle Scholar
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle Scholar
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. Jikes Research Virtual Machine. 2013. http://jikesrvm.org.Google ScholarGoogle Scholar
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. Jump, M. and Mckinley, K. S. 2010. Detecting memory leaks in managed languages with cork. Softw. Pract. Exper. 40, 1, 1--22. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. Mitchell, N. 2006. The runtime structure of object ownership. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'06). 74--98. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  26. Mitchell, N., Schonberg, E., and Sevitsky, G. 2010. Four trends leading to java runtime bloat. IEEE Softw. 27, 1, 56--63. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. 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 ScholarGoogle Scholar
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. Nicholas, E. 2006. http://weblogs.java.net/blog/enicholas/archive/2006/04/leaking evil.html.Google ScholarGoogle Scholar
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. Orlovich, M. and Rugina, R. 2006. Memory leak analysis by contradiction. In Proceedings of the Static Analysis Symposium (SAS'06). 405--424. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  34. Quest Software. 2013. JProbe memory debugging. http://www.quest.com/jprobe.Google ScholarGoogle Scholar
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  37. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  38. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  39. Standard Performance Evaluation Corporation. 2000. SPECjbb2000. http://www.spec.org/jbb2000.Google ScholarGoogle Scholar
  40. Sun Bug Database. 2013. http://bugs.sun.com/bugdatabase.Google ScholarGoogle Scholar
  41. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  42. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  43. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  44. Xu, G. 2011. Analyzing large-scale object-oriented software to find and remove runtime bloat. Ph.D. thesis, The Ohio State University. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  46. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  47. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  48. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  49. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  50. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  51. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Precise memory leak detection for java software using container profiling

            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 Transactions on Software Engineering and Methodology
              ACM Transactions on Software Engineering and Methodology  Volume 22, Issue 3
              In memoriam, fault detection and localization, formal methods, modeling and design
              July 2013
              414 pages
              ISSN:1049-331X
              EISSN:1557-7392
              DOI:10.1145/2491509
              Issue’s Table of Contents

              Copyright © 2013 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: 30 July 2013
              • Accepted: 1 March 2012
              • Revised: 1 February 2012
              • Received: 1 November 2011
              Published in tosem Volume 22, Issue 3

              Permissions

              Request permissions about this article.

              Request Permissions

              Check for updates

              Qualifiers

              • research-article
              • Research
              • Refereed

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader