skip to main content
research-article

Safe and efficient hybrid memory management for Java

Published:14 June 2015Publication History
Skip Abstract Section

Abstract

Java uses automatic memory management, usually implemented as a garbage-collected heap. That lifts the burden of manually allocating and deallocating memory, but it can incur significant runtime overhead and increase the memory footprint of applications. We propose a hybrid memory management scheme that utilizes region-based memory management to deallocate objects automatically on region exits. Static program analysis detects allocation sites that are safe for region allocation, i.e., the static analysis proves that the objects allocated at such a site are not reachable after the region exit. A regular garbage-collected heap is used for objects that are not region allocatable. The region allocation exploits the temporal locality of object allocation. Our analysis uses coarse-grain source code annotations to disambiguate objects with non-overlapping lifetimes, and maps them to different memory scopes. Region-allocated memory does not require garbage collection as the regions are simply deallocated when they go out of scope. The region allocation technique is backed by a garbage collector that manages memory that is not region allocated. We provide a detailed description of the analysis, provide experimental results showing that as much as 78% of the memory is region allocatable and discuss how our hybrid memory management system can be implemented efficiently with respect to both space and time.

References

  1. G. Bollella. The Real-time Specification for Java. Addison-Wesley Java Series. Addison-Wesley, 2000. ISBN 9780201703238. URL https://jcp.org/aboutJava/ communityprocess/first/jsr001/rtj.pdf.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. C. Boyapati, A. Salcianu, W. Beebee, Jr., and M. Rinard. Ownership types for safe region-based memory management in Real-Time Java. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 324–337. ACM Press, 2003.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. Bravenboer and Y. Smaragdakis. Strictly declarative specification of sophisticated points-to analyses. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 243–262. ACM Press, 2009.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. S. Cherem and R. Rugina. Region analysis and transformation for Java programs. In Proceedings of the ACM International Symposium on Memory Management, pages 85–96. ACM Press, 2004.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. M. V. Christiansen and P. Velschow. Region-based memory management in Java. Master’s thesis, DIKU, University of Copenhagen, May 1998.Google ScholarGoogle Scholar
  6. D. Gay and A. Aiken. Memory management with explicit regions. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 313–323. ACM Press, 1998.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. D. Gay and A. Aiken. Language support for regions. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 70–80. ACM Press, 2001.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. D. Grossman, G. Morrisett, T. Jim, M. Hicks, Y. Wang, and J. Cheney. Region-based memory management in Cyclone. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 282–293. ACM Press, 2002.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. N. Hallenberg, M. Elsman, and M. Tofte. Combining region inference and garbage collection. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 141–152. ACM Press, 2002.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Hirzel, D. V. Dincklage, A. Diwan, and M. Hind. Fast online pointer analysis. ACM Transactions on Programming Languages and Systems, 29(2), 2007.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. G. Kastrinis and Y. Smaragdakis. Hybrid context-sensitivity for points-to analysis. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 423–434. ACM Press, 2013.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. O. Lhoták. Program Analysis using Binary Decision Diagrams. PhD thesis, McGill University, 2006.Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. O. Lhoták and L. Hendren. Evaluating the benefits of contextsensitive points-to analysis using a BDD-based implementation. ACM Transactions on Software Engineering and Methodology, 18(1):1–53, 2008.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. Liang, M. Pennings, and M. J. Harrold. Evaluating the impact of context-sensitivity on Andersen’s algorithm for Java programs. In Proceedings of the ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engineering, pages 6–12. ACM Press, 2005.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. P. Liang, O. Tripp, M. Naik, and M. Sagiv. A dynamic evaluation of the precision of static heap abstractions. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 411–427. ACM Press, 2010.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. A. Milanova, A. Rountev, and B. G. Ryder. Parameterized object sensitivity for points-to analysis for Java. ACM Transactions on Software Engineering and Methodology, 14(1):1–41, 2005.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. Naik, A. Aiken, and J. Whaley. Effective static race detection for Java. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 308–319. ACM Press, 2006.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. OpenJDK. Graal Project. URL http://openjdk.java.net/ projects/graal.Google ScholarGoogle Scholar
  19. F. Qian and L. Hendren. An adaptive, region-based allocator for java. In Proceedings of the ACM International Symposium on Memory Management, pages 127–138. ACM Press, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. .Google ScholarGoogle Scholar
  21. G. Salagnac, C. Rippert, and S. Yovine. Semi-automatic region-based memory management for real-time java embedded systems. In Embedded and Real-Time Computing Systems and Applications, pages 73–80. IEEE Computer Society, 2007.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. M. Sharir and M. Pnueli. Two approaches to interprocedural data flow analysis. Program Flow Analysis: Theory and Applications, pages 189–234, 1981.Google ScholarGoogle Scholar
  23. O. G. Shivers. Control-flow Analysis of Higher-order Languages of Taming Lambda. PhD thesis, Carnegie Mellon University, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Y. Smaragdakis and G. Balatsouras. Pointer analysis. Foundations and Trends in Programming Languages, 2(1):1–69, 2015..Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Y. Smaragdakis, M. Bravenboer, and O. Lhoták. Pick your contexts well: Understanding object-sensitivity. In Proceedings of the ACM SIGPLAN Symposium on Principles of Programming Languages, pages 17–30. ACM Press, 2011.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. SPEC. SPECjbb2005, 2005. URL http://www.spec.org/ jbb2005.Google ScholarGoogle Scholar
  27. B. Steensgaard. Thread-specific heaps for multi-threaded programs. In Proceedings of the ACM International Symposium on Memory Management, pages 18–24. ACM Press, 2000.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. M. Tofte, L. Birkedal, M. Elsman, and N. Hallenberg. A retrospective on region-based memory management. Higher-Order and Symbolic Computation, 17(3):245–265, Sept. 2004.. Introduction Background Region-Based Memory Management Points-to Analysis Memory Region Aware Points-to Analysis Analysis Definition Analysis Results Example Region Analysis Invariant Hybrid Memory Management Efficient Allocation Efficient Garbage Collection Implementation Evaluation Related Work Conclusions Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Safe and efficient hybrid memory management for Java

      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!