Affiliation:
1. Seoul National University, Seoul, South Korea
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.
Funder
National Research Foundation of Korea
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software