skip to main content
10.1145/1449764.1449795acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Analysis and reduction of memory inefficiencies in Java strings

Published:19 October 2008Publication History

ABSTRACT

This paper describes a novel approach to reduce the memory consumption of Java programs, by focusing on their "string memory inefficiencies". In recent Java applications, string data occupies a large amount of the heap area. For example, about 40% of the live heap area is used for string data when a production J2EE application server is running. By investigating the string data in the live heap, we identified two types of memory inefficiencies -- "duplication" and "unused literals". In the heap, there are many string objects that have the same values. There also exist many string literals whose values are not actually used by the application. Since these inefficiencies exist as live objects, they cannot be eliminated by existing garbage collection techniques, which only remove dead objects. Quantitative analysis of Java heaps in real applications revealed that more than 50% of the string data in the live heap is wasted by these inefficiencies. To reduce the string memory inefficiencies, this paper proposes two techniques at the Java virtual machine level, "StringGC" for eliminating duplicated strings at the time of garbage collection, and "Lazy Body Creation" for delaying part of the literal instantiation until the literal's value is actually used. We also present an interesting technique at the Java program level, which we call "BundleConverter", for preventing unused message literals from being instantiated. Prototype implementations on a production Java virtual machine have achieved about 18% reduction of the live heap in the production application server. The proposed techniques could also reduce the live heap of standard Java benchmarks by 11.6% on average, without noticeable performance degradation.

References

  1. The Apache Software Foundation. Apache Harmony. http://harmony.apache.org/Google ScholarGoogle Scholar
  2. The Apache Software Foundation. Apache Tomcat. http://tomcat.apache.org/Google ScholarGoogle Scholar
  3. The Apache Software Foundation. Apache Tuscany. http://tuscany.apache.org/Google ScholarGoogle Scholar
  4. A. W. Appel and M. J. R. Goncalves. Hash-consing garbage collection. Technical Report CS-TR-412-93, Department of Computer Science, Princeton University, 1993.Google ScholarGoogle Scholar
  5. C. Bailey. Java Technology, IBM Style: Introduction to the IBM Developer Kit: An overview of the new functions and features in the IBM implementation of Java 5.0, 2006. http://www.ibm.com/developerworks/java/library/j-ibmjava1.htmlGoogle ScholarGoogle Scholar
  6. S. M. Blackburn, et al. The DaCapo Benchmarks: Java Benchmarking Development and Analysis. In Proceedings of the 21st ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA '06), pp. 169--190, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. P. Chan, R. Lee, and D. Kramer. The Java Class Libraries, Second Edition, Addison Wesley, 1998.Google ScholarGoogle Scholar
  8. S. Dieckmann and U. Holzle. A Study of the Allocation Behavior of the SPECjvm98 Java Benchmark. In Proceedings of the 13th European Conference on Object-Oriented Programming (ECOOP '99), pp. 92--115, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. A. P. Ershov. On Programming of Arithmetic Operations. In Communications of the ACM, Vol. 1, No. 8, pp. 3--9, 1958. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. Gosling, B. Joy, G. Steele, and G. Bracha. The Java Language Specification, Third Edition, Addison Wesley, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. E. Goto. Monocopy and Associative Algorithms in an Extended Lisp. Technical Report 74-03, Information Science Laboratory, University of Tokyo, 1974.Google ScholarGoogle Scholar
  12. N. Grcevski, A. Kielstra, K. Stoodley, M. Stoodley, and V. Sundaresan. Java Just-In-Time Compiler and Virtual Machine Improvements for Server and Middleware Applications. In Proceedings of the 3rd USENIX Virtual Machine Research and Technology Symposium (VM '04), pp. 151--162, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. IBM Corporation. IBM Trade Performance Benchmark. https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=trade6Google ScholarGoogle Scholar
  14. IBM Corporation. WebSphere Application Server. http://www.ibm.com/software/webservers/appserv/was/Google ScholarGoogle Scholar
  15. R. Jones and R. Lins. Garbage Collection: Algorithms for Automatic Dynamic Memory Management, Wiley, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. S. P. Jones. Haskell 98 Language and Libraries: The Revised Report, Cambridge University Press, 2003.Google ScholarGoogle Scholar
  17. M. Jump and K. S. McKinley. Cork: Dynamic Memory Leak Detection for Garbage-Collected Languages. In Proceedings of the 34th ACM Symposium on Principles of Programming Languages (POPL '07), pp. 31--38, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. K. Kawachiya, K. Ogata, and T. Onodera. A Quantitative Analysis of Space Waste from Java Strings and its Elimination at Garbage Collection Time. Research Report RT0750, IBM Tokyo Research Laboratory, 2007.Google ScholarGoogle Scholar
  19. T. Lindholm and F. Yellin. The Java Virtual Machine Specification, Second Edition, Addison Wesley, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. D. Marinov and R. O'Callahan. Object equality profiling. In Proceedings of the 18th ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA '03), pp. 313--325, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. N. Mitchell and G. Sevitsky. LeakBot: An Automated and Lightweight Tool for Diagnosing Memory Leaks in Large Java Applications. In Proceedings of the 17th European Conference on Object-Oriented Programming (ECOOP '03), pp. 351--377, 2003.Google ScholarGoogle ScholarCross RefCross Ref
  22. N. Mitchell and G. Sevitsky. The Causes of Bloat, The Limits of Health. In Proceedings of the 22nd ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA '07), pp. 245--260, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Open SOA. Service Component Architecture Home. http://osoa.org/display/Main/Service+Component+Architecture+HomeGoogle ScholarGoogle Scholar
  24. Standard Performance Evaluation Corporation. SPEC JVM98 Benchmarks. http://www.spec.org/osg/jvm98/Google ScholarGoogle Scholar
  25. Sun Microsystems. Java2 Platform Standard Edition 5.0 API Specification: java.lang.String. http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.htmlGoogle ScholarGoogle Scholar
  26. The Unicode Consortium. The Unicode Standard, Version 5.0, Addison Wesley, 2006.Google ScholarGoogle Scholar
  27. M. Vaziri, F. Tip, S. Fink, and J. Dolby. Declarative Object Identity Using Relation Types. In Proceedings of the 21st European Conference on Object-Oriented Programming (ECOOP '07), pp. 54--78, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Analysis and reduction of memory inefficiencies in Java strings

    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

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!