ABSTRACT
We present a heap-profiling tool for exploring the potential for space savings in Java programs. The output of the tool is used to direct rewriting of application source code in a way that allows more timely garbage collection (GC) of objects, thus saving space. The rewriting can also avoid allocating some objects that are never used.
The tool measures the difference between the actual collection time and the potential earliest collection time of objects for a Java application. This time difference indicates potential savings. Then the tool sorts the allocation sites in the application source code according to the accumulated potential space saving for the objects allocated at the sites. A programmer can investigate the source code surrounding the sites with the highest savings to find opportunities for code rewriting that could save space. Our experience shows that in many cases simple code rewriting leads to actual space savings and in some cases also to improvements in program runtime.
Experimental results using the tool and manually rewriting code show average space savings of 18% for the SPECjvm98 benchmark suite. Results for other benchmarks are also promising. We have also classified the program transformations that we have used and argue that in many cases improvements can be achieved by an optimizing compiler.
- 1.O. Agesen, D. Detlefs, amd E. Moss. Garbage Collection amd Locad Vau'iable Type-Precision and Liveness in Java Virtual Mamhines. In SIGPLAN Conf. on Prog. Lang. Design and Impl., pages 269-279, June 1998.]] Google ScholarDigital Library
- 2.J. M. Barth. Shifting garbage collection overhead to compile time. Commun. ACM, 20(7):513-518, 1977.]] Google ScholarDigital Library
- 3.B. Blanchet. Escape amdysis for object oriented languages, application to Javatin. In Conf. on Object-Oriented Prog. Syst., Lang. and AppL, Denver, 1998.]] Google ScholarDigital Library
- 4.R. Bodlk, R. Gupta, amd M. L. Sofia. Complete removal of redundant expressions. ACM SIGPLAN Notices, 33(5):1 14, May 1998.]] Google ScholarDigital Library
- 5.A. Deutsch. Semantic models and abstramt interpretation for inductive data structures amd pointers. In Proc. of ACM Symposium on Partial Evaluation and Semantics-Based Program Manipulation, PEPM'95, pages 226 228, New York, NY, June 1995. ACM Press.]] Google ScholarDigital Library
- 6.E. Duesterwald, R. Gupta, and M. Sofia. A practical farmework for demand driven interprocedural data flow analysis. In Trans. on Prog. Lang. and Syst., 1998.]] Google ScholarDigital Library
- 7.J. Gosling, B. Joy, and G. Steele. The Java Language Specification. The Java Series. Addison-Wesely, 1996.]] Google ScholarDigital Library
- 8.G. W. Hamilton. Compile-time garbage collection for lazy functiomd languages. In Memory Management, International Workshop IWMM 95, 1995.]] Google ScholarDigital Library
- 9.M. Hind and A. Pioli. Which pointer analysis should I use? In Int. Symp. on Soft. Test. and Anal., 2000.]] Google ScholarDigital Library
- 10.IBM JDK 1.3. Available at http://www.ibm.com/java.]]Google Scholar
- 11.JavaCC - The Java Parser Generator. Available at http://www.met mnat a.com/j avamc.]]Google Scholar
- 12.Java Grande Benchmark Suite. Available at http://www.epcc.ed.ac.uk/j avagmnde.]]Google Scholar
- 13.Sun JDK 1.2. Available at http://java.sun.com/j2se.]]Google Scholar
- 14.Sun HotSpot Client 1.3. Available at http: //java.sun.com/products/hotspot.]]Google Scholar
- 15.T. P. Jensen and T. Mogensen. A backward analysis for compile-time garbage collection. In European Symp. on Prog., pages 222-239, 1990.]] Google ScholarDigital Library
- 16.R. Jones. Garbage Collection. Algorithms for Automatic Dynamic Memory Management. John Wiley and Sons, 1999.]] Google ScholarDigital Library
- 17.J. Knoop, O. Rtithing, and B. Steffen. Optimal code motion: Theory and practice. ACM Transactions on Programming Languages and Systems, 16(4):1111-1155, July 1994.]] Google ScholarDigital Library
- 18.S. Muchnick. Advanced Compiler Design and Implementation. Morgan Kaufmann, 1997.]] Google ScholarDigital Library
- 19.W. D. Pauw and G. Sevitski. Visualizing reference patterns for solving memory leadcs in java. In ECOOP'99, pages 116-134, Lisbon, Portugad, 1999.]] Google ScholarDigital Library
- 20.S. Porat, B. Mendelson, and I. Shapira. Sharpening global static amadysis to cope with java. In CASCON, 1998.]] Google ScholarDigital Library
- 21.N. Rojemo amd C. Runcimam. Lag, drag, void amd use heap profiling and space-efficient compilation revisited. In Proceedings of the 1996 ACM SIGPLAN Int. Conf. on Func. Prog., pages 34-41, Philadelphia, Pennsylvania, 24 26 May 1996.]] Google ScholarDigital Library
- 22.M. Sagiv, T. Reps, amd S. Horwitz. Precise interprocedurad datafiow analysis with applications to constamt propagation. Theor. Comp. Sci., 167:131-170, 1996.]] Google ScholarDigital Library
- 23.M. Serramo amd H.-J. Boehm. Understanding memory allocation of scheme progrmns. In Intertional Conference on Functional Programming, pages 245-256, 2000.]] Google ScholarDigital Library
- 24.R. Shadmm, E. K. Kolodner, and M. Sagiv. Automatic removed of array memory leodrs in java. In Int. Conf. on Comp. Construct. Springer, Apr. 2000.]]Google Scholar
- 25.R. Shadmm, E. K. Kolodner, amd M. Sagiv. On the effectiveness of GC in java. In Int. Symp. on Memory Management. ACM, Oct. 2000.]] Google ScholarDigital Library
- 26.SPECjvm98. Standard Performance Evaluation Corporation (SPEC), Fairfax, VA, 1998. Available at http://www.spec.org/osg/j vm98/.]]Google Scholar
- 27.J. Whadey and M. Rinard. Compositional pointer amd escape analysis for java progrmns. In Conf. on Object-Oriented Prog. Syst., Lang. and Appl., 1998.]] Google ScholarDigital Library
- 28.P. R. Wilson. Uniprocessor garbage collection techniques. In Memory Management, International Workshop IWMM, Sept. 1992.]] Google ScholarDigital Library
Index Terms
- Heap profiling for space-efficient Java
Recommendations
Detailed heap profiling
ISMM 2018: Proceedings of the 2018 ACM SIGPLAN International Symposium on Memory ManagementModern software systems heavily use the memory heap. As systems grow more complex and compute with increasing amounts of data, it can be difficult for developers to understand how their programs actually use the bytes that they allocate on the heap and ...
Heap profiling for space-efficient Java
We present a heap-profiling tool for exploring the potential for space savings in Java programs. The output of the tool is used to direct rewriting of application source code in a way that allows more timely garbage collection (GC) of objects, thus ...
Heap space analysis for java bytecode
ISMM '07: Proceedings of the 6th international symposium on Memory managementThis article presents a heap space analysis for (sequential) Java bytecode. The analysis generates heap space cost relations which define at compile-time the heap consumption of a program as a function of its data size. These relations can be used to ...
Comments