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.
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- ECMA. ECMA-262: ECMAScript Language Specification. ECMA (European Association for Standardizing Information and Communication Systems), third edition, Dec. 1999.Google Scholar
- 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 Scholar
Digital Library
- Google Inc. Chrome os. http://www.chromium.org/chromium-os.Google Scholar
- Google Inc. V8 benchmark suite. http://v8.googlecode.com/svn/data/benchmarks/current/run.html, 2008.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- R. Jones and R. D. Lins. Garbage Collection: Algorithms for Automatic Dynamic Memory Management. Wiley, August 1996. Google Scholar
Digital Library
- 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 Scholar
- Linux Foundation. Tizen. http://www.tizen.org.Google Scholar
- 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 Scholar
Digital Library
- Mozilla Foundation. Dromaeo javascript testing. http://dromaeo.com/.Google Scholar
- Mozilla Foundation. Firefox OS. https://developer.mozilla.org/en/docs/Mozilla/Firefox\_OS.Google Scholar
- Mozilla Foundation. Kraken javascript benchmark. http://krakenbenchmark.mozilla.org/.Google Scholar
- Oracle/BEA. Bea jrockit: Java for the enterprise, 2003.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- G. L. Steele, Jr. Multiprocessing compactifying garbage collection. Commun. ACM, 18(9):495--508, Sept. 1975. Google Scholar
Digital Library
- Sun Microsystems Inc. Memory management in the java hotspot virtual machine, 2006.Google Scholar
- 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 Scholar
Digital Library
- WebKit Project. Sunspder javascript benchmark. http://www.webkit.org/perf/sunspider/sunspider.html, 2008.Google Scholar
- T. Yuasa. Real-time garbage collection on general-purpose machines. J. Syst. Softw., 11(3):181--198, Mar. 1990. Google Scholar
Digital Library
Index Terms
Lightweight and block-level concurrent sweeping for javascript garbage collection
Recommendations
Lightweight and block-level concurrent sweeping for javascript garbage collection
LCTES '14: Proceedings of the 2014 SIGPLAN/SIGBED conference on Languages, compilers and tools for embedded systemsJavaScript 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 ...
An on-the-fly mark and sweep garbage collector based on sliding views
Special Issue: Proceedings of the OOPSLA '03 conferenceWith concurrent and garbage collected languages like Java and C# becoming popular, the need for a suitable non-intrusive, efficient, and concurrent multiprocessor garbage collector has become acute. We propose a novel mark and sweep on-the-fly algorithm ...
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 ...







Comments