Exploiting Java Objects Behavior for Memory Management and Optimizations

  • Zoe C. H. Yu
  • Francis C. M. Lau
  • Cho-Li Wang
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3302)


We study the behavior of Java objects in order to explore potential garbage collection optimization opportunities in Java programs. Our study has led to one probable strategy for using heap buffers effectively through obtaining liveness and type information of objects. To allow examination of the Java memory, we implement a heap profiling tool by instrumenting an existing Java virtual machine. The tool records useful object events during program execution, and groups the objects according to their types. We apply the tool to different benchmarks and analyze the results. We also try to characterize the objects’ behaviors and suggest that memory occupied by certain objects can be reused by other objects, leading to improved performance of the program. We implement a simple prototype to demonstrate the feasibility of the object reuse approach.


Java Program Garbage Collection Memory Management Object Instance Garbage Collector 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Acar, U.A., Blelloch, G.E., Harper, R.: Selective Memoization. In: Proceedings of the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, New Orleans, Louisiana, USA, pp. 14–25. ACM, New York (2003)CrossRefGoogle Scholar
  2. 2.
    Alpern, B., Attanasio, C.R., Barton, J.J., Burke, M.G., Cheng, P., Choi, J.-D., Cocchi, A., Fink, S.J., Grove, D., Hind, M., Hummel, S.F., Lieber, D., Litvinov, V., Mergen, M.F., Ngo, T., Russell, J.R., Sarkar, V., Serrano, M.J., Shepherd, J.C., Smith, S.E., Sreedhar, V.C., Srinivasan, H., Whaley, J.: The Jalapeño Virtual Machine. IBM System Journal 39(1) (2000)Google Scholar
  3. 3.
    Appel, A.W., Gonçalves, M.J.R.: Hash-consing Garbage Collection. Technical Report CS-TR-412-93, Princeton University (1993)Google Scholar
  4. 4.
    Bellman, R.: Dynamic Programming. Princeton University Press, Princeton (1957)zbMATHGoogle Scholar
  5. 5.
    Berk, E.J., Ananian, C.S.: JLex: A Lexical Analyzer Generator for Java(TM),
  6. 6.
    Blackburn, S.M., Singhai, S., Hertz, M., McKinley, K.S., Moss, J.E.B.: Pretenuring for Java. In: Proceedings of the OOPSLA 2001 Conference on Object Oriented Programming Systems Languages and Applications, Tampa Bay, Florida, pp. 342–352. ACM Press, New York (2001)Google Scholar
  7. 7.
  8. 8.
    Bonwick, J.: The Slab Allocator: An Object-Caching Kernel Memory Allocator. USENIX Summer 1994 Technical Conference. Boston, Massachusetts, USA (1994)Google Scholar
  9. 9.
    Cahoon, B., McKinley, K.S.: Data Flow Analysis for Software Prefetching Linked Data Structures in Java. In: International Conference on Parallel Architectures and Compilation Techniques (PACT 2001), Barcelona, Spain (2001)Google Scholar
  10. 10.
    Cheney, C.J.: A Nonrecursive List Computing Algorithm. Commun. ACM 13(11), 677–678 (1970)CrossRefzbMATHGoogle Scholar
  11. 11.
    Collins, G.E.: A Method For Overlapping and Erasure Of Lists. Commun. ACM 3(12), 655–657 (1960)MathSciNetCrossRefGoogle Scholar
  12. 12.
    Davis, T.E.: Build Your Own ObjectPool in Java to Boost App Speed: Increase the Speed of Your Applications while Reducing Memory Requirements (1998),
  13. 13.
    Dieckmann, S., Hölzle, U.: A Study of the Allocation Behavior of the SPECjvm98 Java Benchmarks. In: Guerraoui, R. (ed.) ECOOP 1999. LNCS, vol. 1628, pp. 92–115. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  14. 14.
    Ershov, A.P.: On Programming of Arithmetic Operations. Commun. ACM 1(8), 3–6 (1958)CrossRefzbMATHGoogle Scholar
  15. 15.
    Fenichel, R.R., Yochelson, J.C.: A Lisp Garbage-Collector for Virtual-Memory Computer Systems. Commun. ACM 12(11), 611–612 (1969)CrossRefzbMATHGoogle Scholar
  16. 16.
    Fitzgerald, R., Tarditi, D.: The Case for Profile-Directed Selection of Garbage Collectors. In: Proceedings of the 2nd International Symposium on Memory Management, Minneapolis, Minnesota, pp. 111–120. ACM Press, New York (2000)Google Scholar
  17. 17.
    Goto, E.: Monocopy and Associative Algorithms in an Extended Lisp. Technical Report 74-03, Information Science Laboratory, University of Tokyo, Tokyo, Japan (May 1974)Google Scholar
  18. 18.
    Hirzel, M., Diwan, A., Hosking, A.: On the Usefulness of Liveness for Garbage Collection and Leak Detection. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 181–206. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  19. 19.
    Hirzel, M., Diwan, A., Henkel, J.: On the Usefulness of Type and Liveness Accuracy for Garbage Collection and Leak Detection. ACM Transactions on Programming Languages and Systems 24(6), 593–624 (2002)CrossRefGoogle Scholar
  20. 20.
    Hudson, S.E., Flannery, F., Ananian, C.S.: CUP Parser Generator for Java,
  21. 21.
    Hudson, S.E.: JFlex—The Fast Scanner Generator for Java,
  22. 22.
    Jones, R., Lins, R.: Garbage Collection: Algorithms for Automatic Dynamic Memory Management. John Wiley & Sons Ltd., Chichester (1996)zbMATHGoogle Scholar
  23. 23.
    Kim, J.-S., Hsu, Y.: Memory System Behavior of Java Programs: Methodology and Analysis. ACM SIGMETRICS Performance Evaluation Review 28(1), 264–274 (2000)CrossRefGoogle Scholar
  24. 24.
    Lieberman, H., Hewitt, C.: A Real-Time Garbage Collector Based on the Lifetimes of Objects. Commun. ACM 26(6), 419–429 (1983)CrossRefGoogle Scholar
  25. 25.
    Marinov, D., O’Callahan, R.: Object Equality Profiling. In: Proceedings of the Conference on Object-Oriented Programming, Systems, Languages, and Applications, Anaheim, California, USA, pp. 313–325. ACM Press, New York (2003)Google Scholar
  26. 26.
    McCarthy, J.: Recursive Functions Symbolic Expressions and Their Computation by Machine. Part I. Commun. ACM 3(4), 184–195 (1960)CrossRefzbMATHGoogle Scholar
  27. 27.
    Michie, D.: Memo Functions and Machine Learning. Nature 218 (April 1968)Google Scholar
  28. 28.
    Pugh, W.: An Improved Replacement Strategy for Function Caching. In: Proceedings of the 1988 ACM Conference on LISP and Functional Programming, Snowbird, Utah, USA, pp. 269–276. ACM Press, New York (1988)CrossRefGoogle Scholar
  29. 29.
    Shaham, R., Kolodner, E.K., Sagiv, M.: On the Effectiveness of GC in Java. In: Proceedings of the 2nd International Symposium on Memory Management, Minneapolis, Minnesota, USA, pp. 12–17. ACM Press, New York (2000)Google Scholar
  30. 30.
    Shaham, R., Kolodner, E.K., Sagiv, M.: Heap Profiling for Space-Efficient Java. In: Proceedings of the ACM SIGPLAN 2001 Conference on Programming Language Design and Implementation, pp. 104–113. ACM Press, Snowbird (2001)CrossRefGoogle Scholar
  31. 31.
    Shaham, R., Kolodner, E.K., Sagiv, M.: Estimating the Impact of Heap Liveness Information on Space Consumption in Java. In: Proceedings of the 3rd International Symposium on Memory Management, Berlin, Germany, pp. 64–75. ACM, New York (2002)Google Scholar
  32. 32.
    Shuf, Y., Serrano, M.J., Gupta, M., Singh, J.P.: Characterizing the Memory Behavior of Java Workloads: A Structured View and Opportunities for Optimizations. In: Proceedings of the 2001 ACM SIGMETRICS International Conference on Measurement and Modeling of Computer Systems, Cambridge, Massachusetts, pp. 194–205. ACM, New York (2001)CrossRefGoogle Scholar
  33. 33.
    Shuf, Y., Gupta, M., Bordawekar, R., Singh, J.P.: Exploiting Prolific Types for Memory Management and Optimizations. In: Proceedings of the 29th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Portland, Oregon, USA, pp. 295–306. ACM Press, New York (2002)Google Scholar
  34. 34.
    Standard Performance Evaluation Corporation: SPEC JVM98 Benchmarks,
  35. 35.
    Yang, Q., Srisa-an, W., Skotiniotis, T., Chang, J.M.: Java Virtual Machine Timing Probes: A Study of Object Life Span and Garbage Collection. In: Proceedings of 21st IEEE International Performance, Computing, and Communications Conference, Phoenix, Arizona (2002)Google Scholar
  36. 36.
    Ungar, D.: Generation Scavenging: A Non-Disruptive High Performance Storage Reclamation Algorithm. In: Proceedings of the 1st ACM SIGSOFT/SIGPLAN Software Engineering Symposium on Practical Software Development Environments, pp. 157–167 (1984)Google Scholar
  37. 37.
    Wilson, P.R., Johnstone, M.S., Neely, M., Boles, D.: Dynamic Storage Allocation: A Survey and Critical Review. In: Baker, H.G. (ed.) IWMM-GIAE 1995. LNCS, vol. 986, pp. 1–116. Springer, Heidelberg (1995)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Zoe C. H. Yu
    • 1
  • Francis C. M. Lau
    • 1
  • Cho-Li Wang
    • 1
  1. 1.Department of Computer ScienceThe University of Hong KongHong Kong

Personalised recommendations