skip to main content

Cross-component garbage collection

Published:24 October 2018Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

a151-degenbaev.webm

References

  1. 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 ScholarGoogle Scholar
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle Scholar
  4. 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 ScholarGoogle Scholar
  5. H.-J. Boehm and M. Weiser. 1988. Garbage Collection in an Uncooperative Environment. Softw. Pract. Exper. 18, 9 (Sept. 1988), 807–820. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle Scholar
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. C. J. Cheney. 1970. A Nonrecursive List Compacting Algorithm. Commun. ACM 13, 11 (Nov. 1970), 677–678. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. T. W. Christopher. 1984. Reference count garbage collection. Software: Practice and Experience 14, 6 (1984), 503–507.Google ScholarGoogle ScholarCross RefCross Ref
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. Cobalt Project Authors. 2018. Cobalt. Retrieved September 6, 2018 from https://cobalt.foo/Google ScholarGoogle Scholar
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. D. Detlefs. 1990. Concurrent Garbage Collection for C++. Technical Report CMU-CS-90-119. Pittsburgh, PA.Google ScholarGoogle Scholar
  19. 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 ScholarGoogle Scholar
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. S. Finne. 2016. Blink heap compaction. (2016). Retrieved September 6, 2018 from https://docs.google.com/document/d/1kvivOinomDXnScw8Ew5zpsYCXiYqj76OCOYZSvHkaUGoogle ScholarGoogle Scholar
  23. J. Geidel. 2018. JNIPort. Retrieved April 11, 2018 from https://sites.google.com/site/jniport/homeGoogle ScholarGoogle Scholar
  24. Google. 2018. Telemetry. Retrieved September 6, 2018 from https://github.com/catapult-project/catapultGoogle ScholarGoogle Scholar
  25. 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 ScholarGoogle Scholar
  26. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  27. M. Hollander, D. A. Wolfe, and E. Chicken. 2013. Nonparametric statistical methods. John Wiley & Sons.Google ScholarGoogle Scholar
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. R. Jones, A. Hosking, and E. Moss. 2012. The Garbage Collection Handbook: The Art of Automatic Memory Management. Chapman & Hall. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. 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 ScholarGoogle Scholar
  33. Mozilla Contributors. 2011. MMgc. Retrieved September 6, 2018 from https://developer.mozilla.org/en-US/docs/Archive/ MMgcGoogle ScholarGoogle Scholar
  34. 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 ScholarGoogle Scholar
  35. NativeScript. 2018. Nativescript. Retrieved September 6, 2018 from https://www.nativescript.orgGoogle ScholarGoogle Scholar
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  37. Oracle Corporation. 2018. JNI Functions. Retrieved April 11, 2018 from http://docs.oracle.com/javase/7/docs/technotes/ guides/jni/spec/functions.htmlGoogle ScholarGoogle Scholar
  38. 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 ScholarGoogle Scholar
  39. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  40. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  41. 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 ScholarGoogle Scholar
  42. 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 ScholarGoogle Scholar
  43. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  44. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  45. V8 Project Authors. 2017. Fall cleaning: Optimizing V8 memory consumption. Retrieved September 6, 2018 from https://v8.dev/blog/optimizing-v8-memoryGoogle ScholarGoogle Scholar
  46. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  47. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Cross-component garbage collection

    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!