GCH: Hints for Triggering Garbage Collections

  • Dries Buytaert
  • Kris Venstermans
  • Lieven Eeckhout
  • Koen De Bosschere
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4050)


This paper shows that Appel-style garbage collectors often make suboptimal decisions both in terms of when and how to collect. We argue that garbage collection should be done when the amount of live bytes is low (in order to minimize the collection cost) and when the amount of dead objects is high (in order to maximize the available heap size after collection). In addition, we observe that Appel-style collectors sometimes trigger a nursery collection in cases where a full-heap collection would have been better.

Based on these observations, we propose garbage collection hints (GCH) which is a profile-directed method for guiding garbage collection. Off-line profiling is used to identify favorable collection points in the program code. In those favorable collection points, the garbage collector dynamically chooses between nursery and full-heap collections based on an analytical garbage collector cost-benefit model. By doing so, GCH guides the collector in terms of when and how to collect. Experimental results using the SPECjvm98 benchmarks and two generational garbage collectors show that substantial reductions can be obtained in garbage collection time (up to 29X) and that the overall execution time can be reduced by more than 10%. In addition, we also show that GCH reduces the maximum pause times and outperforms user-inserted forced garbage collections.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Blackburn, S.M., Cheng, P., McKinely, K.S.: Myths and realities: the performance impact of garbage collection. In: Proceedings of SIGMETRICS’04, ACM Press, New York (2004)Google Scholar
  2. 2.
    Appel, A.W.: Simple generational garbage collection and fast allocation. Software practices and experience 19, 171–183 (1989)CrossRefGoogle Scholar
  3. 3.
    Blackburn, S.M., Cheng, P., McKinley, K.S.: Oil and water? High performance garbage collection in Java with JMTk. In: Proceedings of ICSE’04, pp. 137–146 (2004)Google Scholar
  4. 4.
    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 Systems Journal 39, 211–238 (2000)CrossRefGoogle Scholar
  5. 5.
    Browne, S., Dongarra, J., Garner, N., Ho, G., Mucci, P.: A portable programming interface for performance evaluation on modern processors. The international journal of high performance computing applications 14, 189–204 (2000)CrossRefGoogle Scholar
  6. 6.
    Hertz, M., Blackburn, S.M., Moss, J.E.B., McKinley, K.S., Stefanovic, D.: Error free garbage collection traces: how to cheat and not get caught. In: Proceedings of SIGMETRICS’02, pp. 140–151. ACM Press, New York (2002)Google Scholar
  7. 7.
    Lindholm, T., Yellin, F.: The Java Virtual Machine Specification, 2nd edn. Addison-Wesley, Reading (1999)Google Scholar
  8. 8.
    Boehm, H., Weiser, M.: Garbage collection in an uncooperative environment. Software practices and experience 18, 807–820 (1988)CrossRefGoogle Scholar
  9. 9.
    Brecht, T., Arjomandi, E., Li, C., Pham, H.: Controlling garbage collection and heap growth to reduce the execution time of Java applications. In: Proceedings of OOPSLA’01, pp. 353–366. ACM Press, New York (2001)Google Scholar
  10. 10.
    Wilson, P.R., Moher, T.G.: Design of the opportunistic garbage collector. In: Proceedings of OOPSLA’89, pp. 23–35. ACM Press, New York (1989)Google Scholar
  11. 11.
    Ding, C., Zhang, C., Shen, X., Ogihara, M.: Gated memory control for memory monitoring, leak detection and garbage collection. In: Proceedings of MSP’05, pp. 62–67. ACM Press, New York (2005)Google Scholar
  12. 12.
    Buytaert, D., Venstermans, K., Eeckhout, L., De Bosschere, K.: Garbage collection hints. In: Conte, T., Navarro, N., Hwu, W.-m.W., Valero, M., Ungerer, T. (eds.) HiPEAC 2005. LNCS, vol. 3793, pp. 233–348. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  13. 13.
    Detlefs, D., Flood, C., Heller, S., Printezis, T.: Garbage-first garbage collection. In: Proceedings of ISMM’04, pp. 37–48. ACM Press, New York (2004)Google Scholar
  14. 14.
    J. M. Velasco, K. Olcoz, F.T.: Adaptive tuning of reserved space in an Appel collector. In: Proceedings of ECOOP’04, ACM (2004) 543–559Google Scholar
  15. 15.
    Stefanovic, D., Hertz, M., Blackburn, S.M., McKinley, K.S., Moss, J.E.B.: Older-first garbage collection in practice: evaluation in a Java virtual machine. In: Proceedings of MSP’02, pp. 25–36. ACM Press, New York (2002)Google Scholar
  16. 16.
    Andreasson, E., Hoffmann, F., Lindholm, O.: Memory management through machine learning: to collect or not to collect? In: Proceedings of JVM’02, USENIX (2002)Google Scholar
  17. 17.
    Printezis, T.: Hot-swapping between a mark&sweep and a mark&compact garbage collector in a generational environment. In: Proceedings of JVM’01, USENIX (2001)Google Scholar
  18. 18.
    Soman, S., Krintz, C., Bacon, D.F.: Dynamic selection of application-specific garbage collectors. In: Proceedings of ISMM’04, pp. 49–60. ACM Press, New York (2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2007

Authors and Affiliations

  • Dries Buytaert
    • 1
  • Kris Venstermans
    • 1
  • Lieven Eeckhout
    • 1
  • Koen De Bosschere
    • 1
  1. 1.ELIS Department, Ghent University – HiPEAC member, St.-Pietersnieuwstraat 41, B-9000 GentBelgium

Personalised recommendations