Abstract
Embedding a modern language runtime as a component in a larger software system is popular these days. Communication between these systems often requires keeping references to each others' objects. In this paper we present and discuss the problem of cross-component memory management where reference cycles across component boundaries may lead to memory leaks and premature reclamation of objects may lead to dangling cross-component references. We provide a generic algorithm for effective, efficient, and safe garbage collection over component boundaries, which we call cross-component tracing. We designed and implemented cross-component tracing in the Chrome web browser where the JavaScript virtual machine V8 is embedded into the rendering engine Blink. Cross-component tracing from V8's JavaScript heap to Blink's C++ heap improves garbage collection latency and eliminates long-standing memory leaks for real websites in Chrome. We show how cross-component tracing can help web developers to reason about reachability and retainment of objects spanning both V8 and Blink components based on Chrome's heap snapshot memory tool. Cross-component tracing was enabled by default for all websites in Chrome version 57 and is also deployed in other widely used software systems such as Opera, Cobalt, and Electron.
Supplemental Material
- M. Ager, E. Corry, V. Egorov, K. Hara, G. Wibling, and I. Zerny. 2013. Oilpan: Tracing Garbage Collection for Blink. (2013). Retrieved September 6, 2018 from https://docs.google.com/document/d/1y7_0ni0E_kxvrahQtnreMlzCDKN3QP4BN1Aw7eSLf YGoogle Scholar
- D. F. Bacon and V. T. Rajan. 2001. Concurrent Cycle Collection in Reference Counted Systems. In Proceedings of the 15th European Conference on Object-Oriented Programming (ECOOP ’01). Springer-Verlag, London, UK, 207–235. Google Scholar
Digital Library
- J. F. Bartlett. 1989. Mostly-Copying Garbage Collection picks up Generations and C++. Technical Note TN–12. http: //www.hpl.hp.com/techreports/Compaq-DEC/WRL-TN-12.pdfGoogle Scholar
- H.-J. Boehm, E. Moss, J. Bartlett, and D. R. Chase. 1991. Panel Discussion: Conservative vs. Accurate Garbage Collection. Summary appears in Wilson and Hayes’ OOPSLA’91 GC workshop report.Google Scholar
- H.-J. Boehm and M. Weiser. 1988. Garbage Collection in an Uncooperative Environment. Softw. Pract. Exper. 18, 9 (Sept. 1988), 807–820. Google Scholar
Digital Library
- J. Brichau and C. De Roover. 2009. Language-shifting Objects from Java to Smalltalk: An Exploration Using JavaConnect. In Proceedings of the International Workshop on Smalltalk Technologies (IWST ’09). ACM, New York, NY, USA, 120–125. Google Scholar
Digital Library
- F. Brown, S. Narayan, R. S. Wahby, D. R. Engler, R. Jhala, and D. Stefan. 2017. Finding and Preventing Bugs in JavaScript Bindings. In 2017 IEEE Symposium on Security and Privacy, SP 2017, San Jose, CA, USA, May 22-26, 2017. 559–578.Google Scholar
- C. Chambers, D. Ungar, and E. Lee. 1989. An Efficient Implementation of SELF a Dynamically-typed Object-oriented Language Based on Prototypes. In Conference Proceedings on Object-oriented Programming Systems, Languages and Applications (OOPSLA ’89). ACM, New York, NY, USA, 49–70. Google Scholar
Digital Library
- C. J. Cheney. 1970. A Nonrecursive List Compacting Algorithm. Commun. ACM 13, 11 (Nov. 1970), 677–678. Google Scholar
Digital Library
- P. Cheng and G. E. Blelloch. 2001. A Parallel, Real-time Garbage Collector. In Proceedings of the ACM SIGPLAN 2001 Conference on Programming Language Design and Implementation (PLDI ’01). ACM, New York, NY, USA, 125–136. Google Scholar
Digital Library
- Y. Chicha and S. M. Watt. 2006. A Localized Tracing Scheme Applied to Garbage Collection. In Proceedings of the 4th Asian Conference on Programming Languages and Systems (APLAS’06), N. Kobayashi (Ed.). Springer-Verlag, Berlin, Heidelberg, 323–339. Google Scholar
Digital Library
- T. W. Christopher. 1984. Reference count garbage collection. Software: Practice and Experience 14, 6 (1984), 503–507.Google Scholar
Cross Ref
- D. Clifford, H. Payer, M. Stanton, and B. L. Titzer. 2015. Memento Mori: Dynamic Allocation-site-based Optimizations. In Proceedings of the 2015 International Symposium on Memory Management (ISMM ’15). ACM, New York, NY, USA, 105–117. Google Scholar
Digital Library
- D. Clifford, H. Payer, M. Starzinger, and B. L. Titzer. 2014. Allocation Folding Based on Dominance. In Proceedings of the 2014 International Symposium on Memory Management (ISMM ’14). ACM, New York, NY, USA, 15–24. Google Scholar
Digital Library
- Cobalt Project Authors. 2018. Cobalt. Retrieved September 6, 2018 from https://cobalt.foo/Google Scholar
- S. S. Craciunas, C.M. Kirsch, H. Payer, A. Sokolova, H. Stadler, and R. Staudinger. 2008. A Compacting Real-time Memory Management System. In USENIX 2008 Annual Technical Conference (ATC’08). USENIX Association, Berkeley, CA, USA, 349–362. Google Scholar
Digital Library
- U. Degenbaev, J. Eisinger, M. Ernst, R. McIlroy, and H. Payer. 2016. Idle time garbage collection scheduling. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’16). ACM, New York, NY, USA, 570–583. Google Scholar
Digital Library
- D. Detlefs. 1990. Concurrent Garbage Collection for C++. Technical Report CMU-CS-90-119. Pittsburgh, PA.Google Scholar
- D. Detlefs. 1992. Garbage Collection and Run-time Typing as a C++ Library. In In Proceedings of the 1992 Usenix C++ Conference. USENIX Association, 37–56.Google Scholar
- E. W. Dijkstra, L. Lamport, A. Martin, C. Scholten, and E. Steffens. 1978. On-the-fly Garbage Collection: An Exercise in Cooperation. Commun. ACM 21, 11 (Nov. 1978), 966–975. Google Scholar
Digital Library
- D. R. Edelson. 1992. A Mark-and-sweep Collector C++. In Proceedings of the 19th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’92). ACM, New York, NY, USA, 51–58. Google Scholar
Digital Library
- S. Finne. 2016. Blink heap compaction. (2016). Retrieved September 6, 2018 from https://docs.google.com/document/d/1kvivOinomDXnScw8Ew5zpsYCXiYqj76OCOYZSvHkaUGoogle Scholar
- J. Geidel. 2018. JNIPort. Retrieved April 11, 2018 from https://sites.google.com/site/jniport/homeGoogle Scholar
- Google. 2018. Telemetry. Retrieved September 6, 2018 from https://github.com/catapult-project/catapultGoogle Scholar
- M. Hablich and H. Payer. 2018. Lessons Learned from the Memory Roadshow. Retrieved September 6, 2018 from https://drive.google.com/file/d/1HyRDBgt6wvftC-_cne_3zuYbVtp1RoJDGoogle Scholar
- R. H. Halstead. 1984. Implementation of Multilisp: Lisp on a Multiprocessor. In Proceedings of the 1984 ACM Symposium on LISP and Functional Programming (LFP ’84). ACM, New York, NY, USA, 9–17. Google Scholar
Digital Library
- M. Hollander, D. A. Wolfe, and E. Chicken. 2013. Nonparametric statistical methods. John Wiley & Sons.Google Scholar
- R. L. Hudson, R. Morrison, J. Eliot B. Moss, and D. S. Munro. 1997. Garbage Collecting the World: One Car at a Time. In Proceedings of the 12th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (OOPSLA ’97). ACM, New York, NY, USA, 162–175. Google Scholar
Digital Library
- J. Hughes. 1985. A Distributed Garbage Collection Algorithm. In Proc. Of a Conference on Functional Programming Languages and Computer Architecture. Springer-Verlag New York, Inc., New York, NY, USA, 256–272. http://dl.acm.org/ citation.cfm?id =5280.5296 Google Scholar
Digital Library
- R. Jones, A. Hosking, and E. Moss. 2012. The Garbage Collection Handbook: The Art of Automatic Memory Management. Chapman & Hall. Google Scholar
Digital Library
- T. Kalibera and R. Jones. 2011. Handles Revisited: Optimising Performance and Memory Costs in a Real-time Collector. In Proceedings of the International Symposium on Memory Management (ISMM ’11). ACM, New York, NY, USA, 89–98. Google Scholar
Digital Library
- R. Ladin and B. Liskov. 1992. Garbage collection of a distributed heap. In Proceedings of the 12th International Conference on Distributed Computing Systems. 708–715.Google Scholar
- Mozilla Contributors. 2011. MMgc. Retrieved September 6, 2018 from https://developer.mozilla.org/en-US/docs/Archive/ MMgcGoogle Scholar
- Mozilla Contributors. 2017. The XPCOM cycle collector. Retrieved September 6, 2018 from https://developer.mozilla.org/ en-US/docs/Mozilla/Tech/XPCOM/Interfacing_with_the_XPCOM_cycle_collectorGoogle Scholar
- NativeScript. 2018. Nativescript. Retrieved September 6, 2018 from https://www.nativescript.orgGoogle Scholar
- C. E. Oancea, A. Mycroft, and S. M. Watt. 2009. A New Approach to Parallelising Tracing Algorithms. In Proceedings of the 2009 International Symposium on Memory Management (ISMM ’09). ACM, New York, NY, USA, 10–19. Google Scholar
Digital Library
- Oracle Corporation. 2018. JNI Functions. Retrieved April 11, 2018 from http://docs.oracle.com/javase/7/docs/technotes/ guides/jni/spec/functions.htmlGoogle Scholar
- F. Pizlo. 2017. Introducing Riptide: WebKit’s Retreating Wavefront Concurrent Garbage Collector. Retrieved September 6, 2018 from https://webkit.org/blog/7122/introducing-riptide-webkits-retreating-wavefront-concurrent-garbagecollector/Google Scholar
- D. Plainfossé and M. Shapiro. 1995. A Survey of Distributed Garbage Collection Techniques. In Proceedings of the International Workshop on Memory Management (IWMM ’95). Springer-Verlag, London, UK, UK, 211–249. Google Scholar
Digital Library
- Y. Shuf, M. Gupta, H. Franke, A. Appel, and J. P. Singh. 2002. Creating and Preserving Locality of Java Applications at Allocation and Garbage Collection Times. In Proceedings of the 17th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (OOPSLA ’02). ACM, New York, NY, USA, 13–25. Google Scholar
Digital Library
- M. Slavchev. 2014. Synchronizing GC in Java and V8. Retrieved September 6, 2018 from https://iobservable.net/blog/2014/ 06/07/synchronizing-gc-in-java-and-v8Google Scholar
- M. Slavchev. 2017. Memory management in NativeScript for Android. Retrieved September 6, 2018 from https:// iobservable.net/blog/2017/11/04/memory-management-in-nativescript-for-androidGoogle Scholar
- S. Tilkov and S. Vinoski. 2010. Node.Js: Using JavaScript to Build High-Performance Network Programs. IEEE Internet Computing 14, 6 (Nov. 2010), 80–83. Google Scholar
Digital Library
- D. Ungar. 1984. Generation Scavenging: A Non-disruptive High Performance Storage Reclamation Algorithm. In Proceedings of the First ACM SIGSOFT/SIGPLAN Software Engineering Symposium on Practical Software Development Environments (SDE 1). ACM, New York, NY, USA, 157–167. Google Scholar
Digital Library
- V8 Project Authors. 2017. Fall cleaning: Optimizing V8 memory consumption. Retrieved September 6, 2018 from https://v8.dev/blog/optimizing-v8-memoryGoogle Scholar
- J. Vilk and E. D. Berger. 2018. BLeak: Automatically Debugging Memory Leaks in Web Applications. In Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’18). ACM, New York, NY, USA. Google Scholar
Digital Library
- D. R. White, J. Singer, J. M. Aitken, and R. E. Jones. 2013. Control Theory for Principled Heap Sizing. In Proceedings of the 2013 International Symposium on Memory Management (ISMM ’13). ACM, New York, NY, USA, 27–38. Google Scholar
Digital Library
Index Terms
Cross-component garbage collection
Recommendations
Idle time garbage collection scheduling
PLDI '16: Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and ImplementationEfficient garbage collection is increasingly important in today's managed language runtime systems that demand low latency, low memory consumption, and high throughput. Garbage collection may pause the application for many milliseconds to identify live ...
Controlling garbage collection and heap growth to reduce the execution time of Java applications
In systems that support garbage collection, a tension exists between collecting garbage too frequently and not collecting it frequently enough. Garbage collection that occurs too frequently may introduce unnecessary overheads at the risk of not ...
A generational on-the-fly garbage collector for Java
PLDI '00: Proceedings of the ACM SIGPLAN 2000 conference on Programming language design and implementationAn on-the-fly garbage collector does not stop the program threads to perform the collection. Instead, the collector executes in a separate thread (or process) in parallel to the program. On-the-fly collectors are useful for multi-threaded applications ...






Comments