Advertisement

LeakBot: An Automated and Lightweight Tool for Diagnosing Memory Leaks in Large Java Applications

  • Nick Mitchell
  • Gary Sevitsky
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2743)

Abstract

Despite Java’s automatic reclamation of memory, memory leaks remain an important problem. For example, we frequently encounter memory leaks that cause production servers to crash. These servers represent an increasingly common class of Java applications: they are large scale and they make heavy use of frameworks. For these applications, existing tools require too much expertise, and, even for experts, require many hours interpreting low-level details. In addition, they are often too expensive to use in practice. We present an automated, adaptive, and scalable tool for diagnosing memory leaks, called LeakBot.

LeakBot incorporates three new techniques. First, it automatically ranks data structures by their likelihood of containing leaks. This process dramatically prunes the set of candidate structures, using object reference graph properties and knowledge of how leaks occur. Second, it uses Coevolving Regions to identify suspicious regions within a data structure and characterize their expected evolution. Third, it uses the first two methods to derive a lightweight way to track those regions’ actual evolution as the program runs. These techniques are mutually beneficial: we need only monitor what is highly ranked, and, because the tracking is so cheap, a region’s rank can be continually updated with information from production machines. Finally, this whole process can be done without user assistance.

We demonstrate LeakBot’s effectiveness on a number of large-scale applications that we have analyzed as part of the ongoing consulting practice our group maintains. We have found that the ranking analysis scales (e.g. written in Java, it analyzes 106 objects in 30 seconds with a 300M heap), is selective (e.g. it prunes that set to three candidate leak roots), and is accurate (it discounts non-leaking roots). The CER generation completes in tens of seconds. The lightweight tracking refines the rankings, while lowering throughput by less than 5%

Keywords

Garbage Collection Binary Metrics Java Application Live Object Memory Leak 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Agesen, O., Detlefs, D., Moss, J.E.B.: Garbage collection and local variable type-precision and liveness in Java virtual machines. In: Programming Language Design and Implementation (1998)Google Scholar
  2. 2.
    Appel, J.K.A.W.: Traversal-based visualization of data structures. In: Symposium on Information Visualization, pp. 11–18 (1998)Google Scholar
  3. 3.
    Barach, D.R., Taenzer, D.H., Wells, R.E.: A technique for finding storage allocation errors in c-langage programs. ACM SIGPLAN Notices 17(5) (May 1982)Google Scholar
  4. 4.
    Borland software corporation optimizeitTM Google Scholar
  5. 5.
    Boyapati, C., Lee, R., Rinard, M.: Ownership types for safe programming: preventing data races and deadlocks. In: Object-oriented programming, systems, languages, and applications (2002)Google Scholar
  6. 6.
    Clarke, D., Noble, J., Potter, J.: Simple ownership types for object containment. In: European Conference on Object-Oriented Programming (2001)Google Scholar
  7. 7.
    Dong, J.S., Duke, R.: The geometry of object containment. Object-oriented Systems 2, 41–63 (1995)Google Scholar
  8. 8.
    Ernst, M., Griswold, W.G., Kataoka, Y., Notkin, D.: Dynamically discovering pointer-based program invariants. In: International Conference on Software Engineering (1999)Google Scholar
  9. 9.
    Hangal, S., Lam, M.S.: Tracking down software bugs using automatic anomaly detection. In: International Conference on Software Engineering (May 2002)Google Scholar
  10. 10.
    The Glasgow Haskell compiler user’s guide, http://haskell.cs.yale.edu/ghc
  11. 11.
    Hastings, R., Joynce, B.: Purify — fast detection of memory leaks and access errors. In: USENIX Proceedings, pp. 125–136 (1992)Google Scholar
  12. 12.
    Hayes, B.: Using key object opportunism to collect old objects. In: Object-oriented programming, systems, languages, and applications (1991)Google Scholar
  13. 13.
    Hirzel, M., Diwan, A., Hosking, A.: On the usefulness of liveness for garbage collection and leak detection. In: European Conference on Object-Oriented Programming (2001)Google Scholar
  14. 14.
    Hirzel, M., Hinkel, J., Diwan, A., Hind, M.: Understanding the connectivity of heap objects. In: International Symposium on Memory Management (2002)Google Scholar
  15. 15.
  16. 16.
    Lencevicius, R.: On-the-fly query-based debugging with examples. In: Automated and Algorithmic Debugging (2000)Google Scholar
  17. 17.
    Muchnik, S.S.: Advanced Compiler Design and Implemtnation. Morgan Kaufmann, San Francisco (1997)Google Scholar
  18. 18.
    Pauw, W.D., Jensen, E., Mitchell, N., Sevitsky, G., Vlissides, J., Yang, J.: Visualizing the execution of Java programs. In: Diehl, S. (ed.) Dagstuhl Seminar 2001. LNCS, vol. 2269, p. 151. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  19. 19.
    Pauw, W.D., Sevitsky, G.: Visualizing reference patterns for solving memory leaks in Java. Concurrency: Practice and Experience 12, 1431–1454 (2000); Previously appeared in ECOOP 1999 zbMATHCrossRefGoogle Scholar
  20. 20.
    Ramalingam, G.: On loops, dominators, and dominance frontiers. ACM Transactions on Programming Languages and Systems 24(5), 455–490 (2002)CrossRefGoogle Scholar
  21. 21.
    Rational software corporation quantifyTM Google Scholar
  22. 22.
    Rojemo, N., Runciman, C.: Lag, drag, void and use — heap profiling and space-efficient compilation revisited. In: International Conference on Functional Programming, pp. 34–41 (1996)Google Scholar
  23. 23.
    Runciman, C., Rojemo, N.: New dimensions in heap profiling. Journal of Functional Programming 6(4), 587–620 (1996)zbMATHCrossRefGoogle Scholar
  24. 24.
    Shaham, R., Kolodner, E.K., Sagiv, M.: Automatic removal of array memory leaks in java. In: Computational Complexity, pp. 50–66 (2000)Google Scholar
  25. 25.
    Shaham, R., Kolodner, E.K., Sagiv, M.: Estimating the impact of heap liveness information on space consumption in Java. In: International Symposium on Memory Management (June 2002)Google Scholar
  26. 26.
    Sitraka Inc. JProbeTMProfiler with Memory Debugger ServerSide Suite Google Scholar
  27. 27.
  28. 28.
    Java 2 Platform, Enterprise Edition, http://java.sun.com/j2ee
  29. 29.
    Sun Microsystems HPROF JVM profiler Google Scholar
  30. 30.
    Wilson, S., Kesselmann, J.: JavaTMPlatform Performance Strategies and Tactics. Addison-Wesley, Reading (2000)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Nick Mitchell
    • 1
  • Gary Sevitsky
    • 1
  1. 1.IBM T.J. Watson Research CenterHawthorneUSA

Personalised recommendations