skip to main content
article

Free-Me: a static analysis for automatic individual object reclamation

Published:11 June 2006Publication History
Skip Abstract Section

Abstract

Garbage collection has proven benefits, including fewer memory related errors and reduced programmer effort. Garbage collection, however, trades space for time. It reclaims memory only when it is invoked: invoking it more frequently reclaims memory quickly, but incurs a significant cost; invoking it less frequently fills memory with dead objects. In contrast, explicit memory management provides prompt low cost reclamation, but at the expense of programmer effort.This work comes closer to the best of both worlds by adding novel compiler and runtime support for compiler inserted frees to a garbage-collected system. The compiler's free-me analysis identifies when objects become unreachable and inserts calls to free. It combines a lightweight pointer analysis with liveness information that detects when short-lived objects die. Our approach differs from stack and region allocation in two crucial ways. First, it frees objects incrementally exactly when they become unreachable, instead of based on program scope. Second, our system does not require allocation-site lifetime homogeneity, and thus frees objects on some paths and not on others. It also handles common patterns: it can free objects in loops and objects created by factory methods.We evaluate free() variations for free-list and bump-pointer allocators. Explicit freeing improves performance by promptly reclaiming objects and reducing collection load. Compared to marksweep alone, free-me cuts total time by 22% on average, collector time by 50% to 70%, and allows programs to run in 17% less memory. This combination retains the software engineering benefits of garbage collection while increasing space efficiency and improving performance, and thus is especially appealing for real-time and space constrained systems.

References

  1. B. Alpern et al. Implementing Jalapeño in Java. In ACM Conference on Object-Oriented Programming Systems, Languages,and Applications, pages 314--324, Denver, CO, Nov. 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. B. Alpern et al. The Jalapeño virtual machine. IBM Systems Journal, 39(1):211--238, February 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen, May 1994.]]Google ScholarGoogle Scholar
  4. D. F. Bacon, P. Cheng, D. Grove, and M. T. Vechev. Syncopation: Generational real-time garbage collector in the metronome. In ACM Languages, Compilers, and Tools for Embedded Systems, pages 183--192, Chicago, IL, June 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. J. M. Barth. Shifting garbage collection overhead to compile time. Communications of the ACM, 20(7):513--518, July 1977.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. E. D. Berger, B. G. Zorn, and K. S. McKinley. Reconsidering custom memory allocation. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 1--12, Seattle, WA, Nov. 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. S. M. Blackburn, P. Cheng, and K. S. McKinley. Myths and realities: The performance impact of garbage collection. In ACMSIGMETRICS Conference on Measurement & Modeling Computer Systems, pages 25--36, NY, NY, June 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. S. M. Blackburn, P. Cheng, and K. S. McKinley. Oil and water? High performance garbage collection in Java with JMTk. In International Conference on Software Engineering, pages 137--146, Scotland, UK, May 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. S. M. Blackburn, R. Garner, C. Hoffmann, A. M. Khan, K. S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, S. Z. Guyer, A. Hosking, M. Jump, J. E. B. Moss, D. Stefanović, T. VanDrunen, D. von Dincklage, and B. Wiedermann. The DaCapo Benchmarks: Java benchmarking development and analysis. Technical Report TRCS-06-01, Deptartment of Computer Science, Austrailian National University, Mar. 2006. http://ali-www.cs.umass.edu/DaCapo/-Benchmarks.]]Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. B. Blanchet. Escape analysis for Java: Theory and practice. ACM Transactions on Programming Languages and Systems, 25(6):713--775, Nov. 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. S. Cherem and R. Rugina. Region analysis and transformation for Java programs. In ACM International Symposium on Memory Management, pages 85--96, Vancouver, BC, 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. W. Chin, F. Craciun, S. Qin, and M. Rinard. Region inference for object-oriented language. In ACM Conference on Programming Languages Design and Implementation, pages 243--354, Washington, DC, June 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. J. Choi, M. Gupta, M. J. Serrano, V. C. Sreedhar, and S. P. Midkiff. Stack allocation and synchronization optimizations for Java using escape analysis. ACM Transactions on Programming Languages and Systems, 25(6):876--910, Nov. 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. C. Click. Stack allocation, Jan. 2005. Personal Communication.]]Google ScholarGoogle Scholar
  15. R. Cytron, J. Ferrante, B. Rosen, M. Wegman, and K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems, 13(4):451--490, Oct. 1991.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. L. Eeckhout, A. Georges, and K. D. Bosschere. How Java programs interact with virtual machines at the microarchitectural level. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 244--358, Anaheim, CA, Oct. 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Y. Feng and E. D. Berger. A locality-improving dynamic memory allocator. In ACM Conference on Memory System Performance, pages 1--12, Chicago, IL, June 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. R. P. Fitzgerald, T. B. Knoblock, E. Ruf, B. Steensgaard, and D. Tarditi. Marmot: An optimizing compiler for Java. Software-Practice and Experience, 30(3):199--232, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. D. Gay and A. Aiken. Language support for regions. In ACM Conference on Programming Languages Design and Implementation, pages 70--80, Snowbird, UT, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. D. Gay and B. Steensgaard. Fast escape analysis and stack allocation for object-based programs. In International Conference on Compiler Construction, pages 82--93, Berlin, Germany, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. O. Gheorghioiu, A. Salcianu, and M. Rinard. Interprocedural compatibility analysis for static object preallocation. In ACM Symposium on the Principles of Programming Languages, pages 273--284, New Orleans, LA, Jan. 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. N. Hallenberg, M. Elsman, and M. Tofte. Combining region inference and garbage collection. In ACM Conference on Programming Languages Design and Implementation, pages 141--152, Berlin, Germany, June 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. M. Hertz and E. Berger. Quantifying the performance of garbage collection vs. explicit memory mananagement. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, San Diego, CA, Oct. 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. M. Hicks, G. Morrisett, D. Grossman, and T. Jim. Experience with safe manual memory-management in Cyclone. In ACM International Symposium on Memory Management, pages 73--84, Vancouver, BC, 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. M. Hirzel, A. Diwan, and J. Henkel. 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, Nov. 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. H. Inoue, D. Stefanović, and S. Forrest. Object lifetime prediction in Java. Technical Report TR-CS-2003-28, University of New Mexico, May 2003.]]Google ScholarGoogle Scholar
  27. Jikes RVM. IBM, 2005. http://jikesrvm.sourceforge.net.]]Google ScholarGoogle Scholar
  28. S. B. Jones and D. Le Métayer. Compile-time garbage collection by sharing analysis. In ACM Inteornational Conference on Functional Programming Languages and Computer Architecture, pages 54--74, Nov. 1989.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. D. Lea. A memory allocator. http://gee.cs.oswego.edu/dl/html/malloc.html, 1997.]]Google ScholarGoogle Scholar
  30. O. Lee and K. Yi. Experiments on the effectiveness of an automatic insertion of memory reuses into XSML-like programs. In ACM International Symposium on Memory Management, pages 97--108, Vancouver, BC, 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. D. Marinov and R. O'Callahan. Object equality profiling. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 313--325, Anahiem, CA, Oct. 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. F. Qian and L. Hendren. An adaptive, region-based allocator for Java. In ACM International Symposium on Memory Management, Berlin, Germany, June 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. R. Shaham, E. K. Kolodner, and M. Sagiv. Heap profiling for spaceefficient Java. In ACM Conference on Programming Languages Design and Implementation, pages 104--133, Snowbird, UT, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. R. Shaham, E. Yahav, E. K. Kolodner, and M. Sagiv. Establishing local temporal heap safety properties with application to compiletime memory management. In Static Analysis Symposium, pages 483--503, San Diego, CA, June 2003.]]Google ScholarGoogle ScholarCross RefCross Ref
  35. Standard Performance Evaluation Corporation. SPECjvm98 Documentation, release 1.03 edition, March 1999.]]Google ScholarGoogle Scholar
  36. Standard Performance Evaluation Corporation. SPECjbb2000 (Java Business Benchmark) Documentation, release 1.01 edition, 2001.]]Google ScholarGoogle Scholar
  37. M. Tofte and J. Talpin. Region-based memory management. Information and Computation, 1997.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. D. M. Ungar. Generation scavenging: A non-disruptive high performance storage reclamation algorithm. In ACM Software Engineering Symposium on Practical Software Development Environments, pages 157--167, April 1984.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. J. Whaley and M. Rinard. Compositional pointer and escape analysis for Java programs. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 187--206, Nov. 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Free-Me: a static analysis for automatic individual object reclamation

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!