skip to main content
research-article

Lightweight and block-level concurrent sweeping for javascript garbage collection

Published:12 June 2014Publication History
Skip Abstract Section

Abstract

JavaScript is a dynamic-typed language originally developed for the purpose of giving dynamic client-side behaviors to web pages. It is mainly used in web application development and because of its popularity and rapid development style it is now also used in other types of applications. Increasing data processing requirements and growing usage in more resource-limited environments, such as mobile devices, has given demands for JavaScript implementations to handle memory more efficiently through garbage collection.

Since aggressive use of time consuming operations in garbage collection can slow down the JavaScript application, there is a trade-off relationship between the effectiveness and the execution time of garbage collection.

In this paper, we present a lightweight, block-level concurrent sweeping mechanism for a mark-and-sweep garbage collector. The sweeping process is detached to an additional thread to eagerly collect free memory blocks and recycle it. To minimize the overhead that comes from the synchronization between the mutator thread and the new sweeping thread, we have chosen a course grained block-level collecting scheme for sweeping. To avoid contention that comes from object destruction, we execute the object destruction phase concurrently with the foreground marking phase.

We have implemented our algorithm in JavaScript Core (JSC) engine embedded in the WebKit browser that uses a variant of mark-and-sweep algorithm to manage JavaScript objects. The original garbage collection implementation performs lazy sweeping that cannot reuse the free blocks. We evaluate our implementation on an ARM-based mobile system and show that memory utilization of the system is significantly improved without performance degradation.

References

  1. H. Azatchi, Y. Levanoni, H. Paz, and E. Petrank. An on-the-fly mark and sweep garbage collector based on sliding views. In Proceedings of the 18th Annual ACM SIGPLAN Conference on Object-oriented Programing, Systems, Languages, and Applications, OOPSLA'03, pages 269--281, New York, NY, USA, 2003. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. D. F. Bacon, C. R. Attanasio, H. B. Lee, V. T. Rajan, and S. Smith. Java without the coffee breaks: A nonintrusive multiprocessor garbage collector. In Proceedings of the ACM SIGPLAN 2001 Conference on Programming Language Design and Implementation, PLDI'01, pages 92--103, New York, NY, USA, 2001. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. D. F. Bacon, P. Cheng, and V. T. Rajan. A real-time garbage collector with low overhead and consistent utilization. In Proceedings of the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL'03, pages 285--298, New York, NY, USA, 2003. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. K. Barabash, Y. Ossia, and E. Petrank. Mostly concurrent garbage collection revisited. In Proceedings of the 18th annual ACM SIGPLAN conference on Object-oriented programing, systems, languages, and applications, OOPSLA'03, pages 255--268, New York, NY, USA, 2003. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. S. M. Blackburn, R. L. Hudson, R. Morrison, J. E. B. Moss, D. S. Munro, and J. Zigman. Starting with termination: A methodology for building distributed garbage collection algorithms. In Proceedings of the 24th Australasian Conference on Computer Science, ACSC '01, pages 20--28, Washington, DC, USA, 2001. IEEE Computer Society. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. H.-J. Boehm, A. J. Demers, and S. Shenker. Mostly parallel garbage collection. In Proceedings of the ACM SIGPLAN 1991 conference on Programming language design and implementation, PLDI'91, pages 157--164, New York, NY, USA, 1991. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. C. Click, G. Tene, and M. Wolf. The pauseless gc algorithm. InProceedings of the 1st ACM/USENIX International Conference on Virtual Execution Environments, VEE'05, pages 46--56, New York, NY, USA, 2005. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. E. W. Dijkstra, L. Lamport, A. J. Martin, C. S. Scholten, and E. F. M. Steffens. On-the-fly garbage collection: an exercise in cooperation. Commun. ACM, 21(11):966--975, Nov. 1978. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. ECMA. ECMA-262: ECMAScript Language Specification. ECMA (European Association for Standardizing Information and Communication Systems), third edition, Dec. 1999.Google ScholarGoogle Scholar
  10. C. Flood, D. Detlefs, N. Shavit, and C. Zhang. Parallel garbage collection for shared memory multiprocessors. In Usenix Java Virtual Machine Research and Technology Symposium (JVM01), Monterey, CA, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Google Inc. Chrome os. http://www.chromium.org/chromium-os.Google ScholarGoogle Scholar
  12. Google Inc. V8 benchmark suite. http://v8.googlecode.com/svn/data/benchmarks/current/run.html, 2008.Google ScholarGoogle Scholar
  13. R. L. Hudson and J. E. B. Moss. Sapphire: Copying gc without stopping the world. In Proceedings of the 2001 Joint ACM-ISCOPE Conference on Java Grande, JGI'01, pages 48--57, New York, NY, USA, 2001. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. L. Huelsbergen and P. Winterbottom. Very concurrent mark-&-sweep garbage collection without fine-grain synchronization. In Proceedings of the 1st international symposium on Memory management, ISMM '98, pages 166--175, New York, NY, USA, 1998. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. R. Jones and R. D. Lins. Garbage Collection: Algorithms for Automatic Dynamic Memory Management. Wiley, August 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. L. Lamport. Garbage collection with multiple processes: an exercise in parallelism. In Proceedings of the 1976 International Conference on Parallel Processing, pages 50--54.Google ScholarGoogle Scholar
  17. Linux Foundation. Tizen. http://www.tizen.org.Google ScholarGoogle Scholar
  18. P. McGachey, A.-R. Adl-Tabatabai, R. L. Hudson, V. Menon, B. Saha, and T. Shpeisman. Concurrent gc leveraging transactional memory. In Proceedings of the 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPoPP'08, pages 217--226, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Mozilla Foundation. Dromaeo javascript testing. http://dromaeo.com/.Google ScholarGoogle Scholar
  20. Mozilla Foundation. Firefox OS. https://developer.mozilla.org/en/docs/Mozilla/Firefox\_OS.Google ScholarGoogle Scholar
  21. Mozilla Foundation. Kraken javascript benchmark. http://krakenbenchmark.mozilla.org/.Google ScholarGoogle Scholar
  22. Oracle/BEA. Bea jrockit: Java for the enterprise, 2003.Google ScholarGoogle Scholar
  23. G. Richards, S. Lebresne, B. Burg, and J. Vitek. An analysis of the dynamic behavior of javascript programs. In Proceedings of the 2010 ACM SIGPLAN conference on Programming language design and implementation, PLDI'10, pages 1--12, New York, NY, USA, 2010. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. F. Siebert. Concurrent, parallel, real-time garbage-collection. In Proceedings of the 2010 international symposium on Memory management, ISMM'10, pages 11--20, New York, NY, USA, 2010. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. G. L. Steele, Jr. Multiprocessing compactifying garbage collection. Commun. ACM, 18(9):495--508, Sept. 1975. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Sun Microsystems Inc. Memory management in the java hotspot virtual machine, 2006.Google ScholarGoogle Scholar
  27. M. T. Vechev, E. Yahav, and D. F. Bacon. Correctness-preserving derivation of concurrent garbage collection algorithms. In Proceedings of the 2006 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI'06, pages 341--353, New York, NY, USA, 2006. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. WebKit Project. Sunspder javascript benchmark. http://www.webkit.org/perf/sunspider/sunspider.html, 2008.Google ScholarGoogle Scholar
  29. T. Yuasa. Real-time garbage collection on general-purpose machines. J. Syst. Softw., 11(3):181--198, Mar. 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Lightweight and block-level concurrent sweeping for javascript 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

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 49, Issue 5
      LCTES '14
      May 2014
      162 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2666357
      Issue’s Table of Contents
      • cover image ACM Conferences
        LCTES '14: Proceedings of the 2014 SIGPLAN/SIGBED conference on Languages, compilers and tools for embedded systems
        June 2014
        174 pages
        ISBN:9781450328777
        DOI:10.1145/2597809

      Copyright © 2014 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 12 June 2014

      Check for updates

      Qualifiers

      • research-article
    • Article Metrics

      • Downloads (Last 12 months)7
      • Downloads (Last 6 weeks)1

      Other Metrics

    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!