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.
- The Apache Software Foundation. Apache Harmony. http://harmony.apache.org/Google Scholar
- The Apache Software Foundation. Apache Tomcat. http://tomcat.apache.org/Google Scholar
- The Apache Software Foundation. Apache Tuscany. http://tuscany.apache.org/Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- P. Chan, R. Lee, and D. Kramer. The Java Class Libraries, Second Edition, Addison Wesley, 1998.Google Scholar
- 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 Scholar
Digital Library
- A. P. Ershov. On Programming of Arithmetic Operations. In Communications of the ACM, Vol. 1, No. 8, pp. 3--9, 1958. Google Scholar
Digital Library
- J. Gosling, B. Joy, G. Steele, and G. Bracha. The Java Language Specification, Third Edition, Addison Wesley, 2005. Google Scholar
Digital Library
- E. Goto. Monocopy and Associative Algorithms in an Extended Lisp. Technical Report 74-03, Information Science Laboratory, University of Tokyo, 1974.Google Scholar
- 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 Scholar
Digital Library
- IBM Corporation. IBM Trade Performance Benchmark. https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=trade6Google Scholar
- IBM Corporation. WebSphere Application Server. http://www.ibm.com/software/webservers/appserv/was/Google Scholar
- R. Jones and R. Lins. Garbage Collection: Algorithms for Automatic Dynamic Memory Management, Wiley, 1996. Google Scholar
Digital Library
- S. P. Jones. Haskell 98 Language and Libraries: The Revised Report, Cambridge University Press, 2003.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
- T. Lindholm and F. Yellin. The Java Virtual Machine Specification, Second Edition, Addison Wesley, 1999. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- Open SOA. Service Component Architecture Home. http://osoa.org/display/Main/Service+Component+Architecture+HomeGoogle Scholar
- Standard Performance Evaluation Corporation. SPEC JVM98 Benchmarks. http://www.spec.org/osg/jvm98/Google Scholar
- 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 Scholar
- The Unicode Consortium. The Unicode Standard, Version 5.0, Addison Wesley, 2006.Google Scholar
- 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 Scholar
Digital Library
Index Terms
Analysis and reduction of memory inefficiencies in Java strings
Recommendations
Analysis and reduction of memory inefficiencies in Java strings
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 ...
Controlling garbage collection and heap growth to reduce the execution time of Java applications
In systems that support garbage collection, a tension exists between collecting garbage too frequently and not collecting it frequently enough. Garbage collection that occurs too frequently may introduce unnecessary overheads at the risk of not ...
Implementing an on-the-fly garbage collector for Java
ISMM '00: Proceedings of the 2nd international symposium on Memory managementJava uses garbage collection (GC) for the automatic reclamation of computer memory no longer required by a running application. GC implementations for Java Virtual Machines (JVM) are typically designed for single processor machines, and do not ...







Comments