Abstract
Programmers routinely trade space for time to increase performance, often in the form of caching or memoization. In managed languages like Java or JavaScript, however, this space-time tradeoff is complex. Using more space translates into higher garbage collection costs, especially at the limit of available memory. Existing runtime systems provide limited support for space-sensitive algorithms, forcing programmers into difficult and often brittle choices about provisioning.
This paper presents prioritized garbage collection, a cooperative programming language and runtime solution to this problem. Prioritized GC provides an interface similar to soft references, called priority references, which identify objects that the collector can reclaim eagerly if necessary. The key difference is an API for defining the policy that governs when priority references are cleared and in what order. Application code specifies a priority value for each reference and a target memory bound. The collector reclaims references, lowest priority first, until the total memory footprint of the cache fits within the bound. We use this API to implement a space-aware least-recently-used (LRU) cache, called a Sache, that is a drop-in replacement for existing caches, such as Google's Guava library. The garbage collector automatically grows and shrinks the Sache in response to available memory and workload with minimal provisioning information from the programmer. Using a Sache, it is almost impossible for an application to experience a memory leak, memory pressure, or an out-of-memory crash caused by software caching.
- Edward E. Aftandilian and Samuel Z. Guyer. GC assertions: Using the garbage collector to check heap properties. In Proceedings of the 2009 ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 235–244. ACM, 2009. Google Scholar
Digital Library
- Berk Atikoglu, Yuehai Xu, Eitan Frachtenberg, Song Jiang, and Mike Paleczny. Workload analysis of a large-scale keyvalue store. In Proceedings of the 12th ACM SIGMETRICS/PERFORMANCE Joint International Conference on Measurement and Modeling of Computer Systems, SIGMETRICS ’12, pages 53–64, 2012. Google Scholar
Digital Library
- Jonathan Bellis. Jamm. https://github.com/jbellis/jamm.Google Scholar
- Stephen M. Blackburn, Perry Cheng, and Kathryn S. McKinley. Myths and realities: the performance impact of garbage collection. In Proceedings of the International Conference on Measurements and Modeling of Computer Systems, pages 25– 36, 2004. Google Scholar
Digital Library
- Pei Cao and Sandy Irani. Cost-aware www proxy caching algorithms. In Proceedings of the USENIX Symposium on Internet Technologies and Systems on USENIX Symposium on Internet Technologies and Systems, pages 18–18, 1997. Google Scholar
Digital Library
- Nachshon Cohen and Erez Petrank. Data structure aware garbage collector. In Proceedings of the 2015 ACM SIGPLAN International Symposium on Memory Management, ISMM 2015, pages 28–40, New York, NY, USA, 2015. ACM. Google Scholar
Digital Library
- Carlos Cunha, Azer Bestavros, and Mark Crovella. Characteristics of WWW client-based traces. Technical Report BUCS-95-010, Computer Science Department, Boston University, Boston, MA, USA, 1995. Google Scholar
- Grzegorz Czajkowski and Thorsten von Eicken. JRes: A resource accounting interface for Java. In Proceedings of the 13th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications, OOPSLA ’98, pages 21–35, 1998. Google Scholar
Digital Library
- Barry Hayes. Ephemerons: A new finalization mechanism. SIGPLAN Not., 32(10):176–183, October 1997. Google Scholar
Digital Library
- Matthew Hertz and Emery D. Berger. Quantifying the performance of garbage collection vs. explicit memory management. In OOPSLA ’05: Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications, pages 313–326, New York, NY, USA, 2005. ACM. Google Scholar
Digital Library
- Google Inc. SoftReference — Android Developers, 2016 (Accessed March 23, 2016).Google Scholar
- Jikes RVM. IBM, 2005. http://jikesrvm.sourceforge.net.Google Scholar
- Mark S. Johnstone and Paul R. Wilson. The memory fragmentation problem: Solved? In Proceedings of the 1st International Symposium on Memory Management, pages 26–36, 1998. Google Scholar
Digital Library
- Nick Mitchell and Gary Sevitsky. Leakbot: An automated and lightweight tool for diagnosing memory leaks in large Java applications. In ECOOP 2003 - Object-Oriented Programming, 17th European Conference, Darmstadt, Germany, July 21-25, 2003, Proceedings, pages 351–377, 2003.Google Scholar
Cross Ref
- M. E. J. Newman. Power laws, Pareto distributions and Zipf’s law. Contemporary Physics, 2005.Google Scholar
- Melissa E. O’Neill and F. Warren Burton. Smarter garbage collection with simplifiers. In Proceedings of the 2006 Workshop on Memory System Performance and Correctness, MSPC ’06, pages 19–30, New York, NY, USA, 2006. ACM. Google Scholar
Digital Library
- Oracle. SoftReference (Java Platform SE 6), 2015.Google Scholar
- David W. Price, Algis Rudys, and Dan S. Wallach. Garbage collector memory accounting in language-based systems. In Proceedings of the 2003 IEEE Symposium on Security and Privacy, SP ’03, pages 263–, Washington, DC, USA, 2003. IEEE Computer Society. Google Scholar
Digital Library
- Paul R. Wilson, Mark S. Johnstone, Michael Neely, and David Boles. Dynamic storage allocation: A survey and critical review. In International Workshop on Memory Management, pages 1–116, September 1995. Google Scholar
Digital Library
- Guoqing Xu, Michael D. Bond, Feng Qin, and Atanas Rountev. LeakChaser: Helping programmers narrow down causes of memory leaks. In Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’11, pages 270–282, 2011. Google Scholar
Digital Library
- Edward Z. Yang and David Mazières. Dynamic space limits for Haskell. In Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’14, pages 588–598, New York, NY, USA, 2014. ACM. Google Scholar
Digital Library
Index Terms
Prioritized garbage collection: explicit GC support for software caches
Recommendations
Prioritized garbage collection: explicit GC support for software caches
OOPSLA 2016: Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and ApplicationsProgrammers routinely trade space for time to increase performance, often in the form of caching or memoization. In managed languages like Java or JavaScript, however, this space-time tradeoff is complex. Using more space translates into higher garbage ...
Age-based garbage collection
Modern generational garbage collectors look for garbage among the young objects, because they have high mortality; however, these objects include the very youngest objects, which clearly are still live. We introduce new garbage collection algorithms, ...
Age-based garbage collection
OOPSLA '99: Proceedings of the 14th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applicationsModern generational garbage collectors look for garbage among the young objects, because they have high mortality; however, these objects include the very youngest objects, which clearly are still live. We introduce new garbage collection algorithms, ...







Comments