This Article 
 Bibliographic References 
 Add to: 
On the Prediction of Java Object Lifetimes
July 2006 (vol. 55 no. 7)
pp. 880-892
Accurately predicting object lifetimes is important for improving memory management systems. Current garbage collectors make relatively coarse-grained predictions (e.g., "short-lived” versus "long-lived”) and rely on application-independent heuristics related to the local characteristics of an allocation. This paper introduces a prediction method which is fully precise and makes its predictions based on application-specific training rather than application-independent heuristics. By "fully precise” we mean that the granularity of predictions is equal to the smallest unit of allocation. The method described here is the first to combine high precision and efficiency in a single lifetime predictor. Fully precise prediction enables us, for the first time, to study zero-lifetime objects. The paper reports results showing that zero-lifetime objects comprise a significant fraction of object allocations in benchmark programs for the Java programming language and that they are correlated with their allocation context (the call stack and allocation site). Beyond zero-lifetime objects, the paper reports results on predicting longer lived objects, where, in some cases, it is possible to predict the lifetime of objects based on their allocation context (the call stack and allocation site) well. For the SPEC benchmark programs, the number of dynamically allocated objects whose call sites have accurate predictors ranges from 0.2 percent to 61 percent. This method could potentially improve the performance of garbage collectors. The paper proposes a death-ordered collector (DOC) and analyzes its implementation overheads and its best possible performance. The study shows how memory performance could be enhanced using the extra information provided by fully precise prediction.

[1] R.P. Fitzgerald and D. Tarditi, “The Case for Profile-Directed Selection of Garbage Collectors,” Proc. Second Int'l Symp. Memory Management (ISMM), pp. 111-120, 2000, html.
[2] T. Brecht, E. Arjomandi, C. Li, and H. Pham, “Controlling Garbage Collection and Heap Growth to Reduce the Execution Time of Java Applications,” Proc. Object-Oriented Programming, Systems, Langages and Applications Conf. (OOPSLA), pp. 353-366, 2001, .
[3] S.M. Blackburn, S. Singhai, M. Hertz, K.S. McKinley, and J.E. B. Moss, “Pretenuring for Java,” Proc. SIGPLAN 2001 Conf. Object-Oriented Programming, Languages, and Applications, pp. 342-352, Oct. 2001.
[4] D.A. Barrett and B.G. Zorn, “Using Lifetime Predictors to Improve Memory Allocation Performance,” Proc. SIGPLAN Conf. Programming Language Design and Implementation, pp. 187-196, 1993,
[5] M. Hertz, S.M. Blackburn, J.E.B. Moss, K.S. McKinley, and D. Stefanović, “Error-Free Garbage Collection Traces: How to Cheat and Not Get Caught,” Proc. SIGMETRICS 2002 Int'l Conf. Measurement and Modeling of Computer Systems, pp. 140-151, June 2002.
[6] B. Alpern, D. Attanasio, J. Barton, M. Burke, P. Cheng, J. Choi, A. Cocchi, S. Fink, D. Grove, M. Hind, S. Hummel, D. Lieber, V. Litvinov, T. Ngo, M. Mergen, V. Sarkar, M. Serrano, J. Shepherd, S. Smith, V. Sreedhar, H. Srinivasan, and J. Whaley, “The Jalapeño Virtual Machine,” IBM Systems J., vol. 39, no. 1, Feb. 2000.
[7] M.C. Carlisle and A. Rogers, “Software Caching and Computation Migration in Olden,” Proc. Fifth ACM SIGPLAN Symp. Principles and Practice of Parallel Programming, pp. 29-38, July 1995.
[8] A. Rogers, M. Carlisle, J.H. Reppy, and L.J. Hendren, “Supporting Dynamic Data Structures on Distributed-Memory Machines,” ACM Trans. Programming Languages and Systems, vol. 17, no. 2, pp. 233-263, Mar. 1995.
[9] B. Cahoon and K. McKinley, “Tolerating Latency by Prefetching Java Objects,” Proc. Workshop Hardware Support for Objects and Microarchitectures for Java, Oct. 1999, cahoon99tolerating.html .
[10] S. Dieckmann and U. Hölzle, “The Allocation Behavior of the SPECjvm98 Java Benchmarks,” Performance Evaluation and Benchmarking with Realistic Applications, R. Eigenman, ed., MIT Press, 2001.
[11] T.L. Harris, “Dynamic Adaptive Pre-Tenuring,” Proc. Second Int'l Symp. Memory Management (ISMM), pp. 127-136, 2000, citeseer.nj. nec.comharris00dynamic.html .
[12] D.A. Barrett and B. Zorn, “Garbage Collection Using a Dynamic Threatening Boundary,” Proc. SIGPLAN '95 Conf. Programming Languages Design and Implementation, pp. 301-314, June 1995.
[13] S. Dieckman and U. Hölzle, “A Study of the Allocation Behavior of the SPECjvm98 Java Benchmarks,” Proc. 12th European Conf. Object-Oriented Programming (ECOOP '98), E. Jul, ed., pp. 92-115, July 1998.
[14] Y. Shuf, M.J. Serrano, M. Gupta, and J.P. Singh, “Characterizing the Memory Behavior of Java Workloads: A Structured View and Opportunities for Optimizations,” SIGMETRICS/Performance, pp. 194-205, 2001, .
[15] M. Jump and B. Hardekopf, “Pretenuring Based on Escape Analysis,” Technical Report TR-03-48, Univ. of Texas at Austin, Nov. 2003.
[16] P. Cheng, R. Harper, and P. Lee, “Generational Stack Collection and Profile-Driven Pretenuring,” Proc. SIGPLAN '98 Conf. Programming Languages Design and Implementation, pp. 162-173, June 1998.
[17] D.A. Cohn and S. Singh, “Predicting Lifetimes in Dynamically Allocated Memory,” Advances in Neural Information Processing Systems, M.C. Mozer, M.I. Jordan, and T. Petsche, eds., vol. 9, p. 939, MIT Press, 1997, html .
[18] Y. Shuf, M. Gupta, R. Bordawekar, and J.P. Singh, “Exploiting Prolific Types for Memory Management and Optimizations,” Proc. Symp. Principles of Programming Languages, pp. 295-306, 2002, .
[19] M.L. Seidl and B. Zorn, “Predicting References to Dynamically Allocated Objects,” Technical Report CU-CS-826-97, Univ. of Colorado, 1997, .
[20] M.L. Seidl and B.G. Zorn, “Segregating Heap Objects by Reference Behavior and Lifetime,” Proc. Eighth Int'l Conf. Architectural Support for Programming Languages and Operating Systems, pp. 12-23, 1998.
[21] D.J. Cannarozzi, M.P. Plezbert, and R.K. Cytron, “Contaminated Garbage Collection,” Proc. 2000 ACM SIGPLAN Conf. Programming Language Design and Implementation (PLDI), pp. 264-273, 2000.
[22] B. Hayes, “Using Key Object Opportunism to Collect Old Objects,” Proc. SIGPLAN 1991 Conf. Object-Oriented Programming, Languages, and Applications, pp. 33-40, Oct. 1991.
[23] B. Hayes, “Key Objects in Garbage Collection,” PhD dissertation, Stanford Univ., Stanford, Calif., Mar. 1993.
[24] M. Hirzel, J. Henkel, A. Diwan, and M. Hind, “Understanding the Connectivity of Heap Objects,” Proc. Third Int'l Symp. Memory Management (ISMM), pp. 36-49, 2002.
[25] A. Deutsch, “On the Complexity of Escape Analysis,” Proc. 24th Ann. ACM Symp. Principles of Programming Languages, pp. 358-371, 1997.
[26] J.-D. Choi, M. Gupta, M. Serrano, V.C. Sreedhar, and S. Midkiff, “Escape Analysis for Java,” Proc. 1999 ACM SIGPLAN Conf. Object Oriented Programming Systems, Languages, and Applications (OOPSLA 99), Nov. 1999.
[27] S.M. Blackburn, R.E. Jones, K.S. McKinley, and J.E.B. Moss, “Beltway: Getting around Garbage Collection Gridlock,” Proc. SIGPLAN 2002 Conf. Programming Languages Design and Implementation (PLDI '02), June 2002, way.html .

Index Terms:
Object lifetimes, workload characterization, pretenuring, object-oriented programming languages, garbage collection, program behavior.
Hajime Inoue, Darko Stefanovic, Stephanie Forrest, "On the Prediction of Java Object Lifetimes," IEEE Transactions on Computers, vol. 55, no. 7, pp. 880-892, July 2006, doi:10.1109/TC.2006.107
Usage of this product signifies your acceptance of the Terms of Use.