학술논문

Heap Memory Allocation Techinque of Lightweight JavaScript Engine for the IoT Devices / 사물인터넷 장치내 경량 자바스크립트 엔진의 힙 메모리 할당 방식 최적화 연구
Document Type
Dissertation/ Thesis
Source
Subject
JavaScript Engine
JerryScript
IoT
Heap Management
Language
English
Abstract
We propose the lightweight JavaScript engine for the IoT device, dynamic segment allocation. As the usability of the JavaScript engine in IoT devices increases, the needs of lightweight JavaScript engine have arisen. JerryScript, which has the least memory usage among lightweight JavaScript engines, reserves heap memory at engine initialization stage. This makes the compressed pointer in use to reduce the object size. The memory waste, however, increases since not allocated memory is even reserved. We propose a novel solution, dynamic segment allocation to address and solve the problems. Dynamic segment allocation is a heap memory allocation technique on demand, but also a technique which can maintain the compressed pointer without static heap reservation. The problem of dynamic segment allocation is the fragmentation. Memory compaction in previous studies reduce the performance dramatically. Thus, we analyze the IoT workload and solve the fragmentation problem without using memory compaction in GC process. As a result, we reduce the 70% of peak memory usage compared to JerryScript original in IoT sensor workload, and optimize the segment allocation by eliminating internal fragmentation of the segment.
본 논문에서는 기존 경량 자바스크립트 엔진들에서 사용하는 힙 메모리 관리 기법의 문제점에 대해 지적하고 동적 세그먼트 할당 방식을 제안하였다. 세그먼트 할당 방식은 커널이나 라입브러리 의존성 없이 동적 메모리 할당과 동적 메모리 해지를 지원하는 동시에 정적 할당 방식에서 사용하던 압축 포인터 방식의 사용을 가능케 하였다. 이를 통해 동적 메모리 할당 방식에서 발생하던 라이브러리에 따른 메모리 사용량 부작용을 배제하였고, 정적 메모리 할당 방식에서 발생하던 메모리 낭비 문제를 해결하였다. 본 기법을 구현하기 위하여 경량 자바스크립트 엔진 중, 정적 메모리 할당 방식을 사용하여 가장 적은 메모리를 사용하는 제리스크립트 엔진을 수정하여 구현하고. 실제 아마존 에코를 모방한 애플리케이션을 통해 성능 및 메모리 사용량을 검증하였다. 각 실험으로부터 8KB 세그먼트 크기가 IoT 워크로드에 적합한 세그먼트 크기라는 사실을 도출해냈으며 First-fit 할당 방식을 사용해 세그먼트 내 단편화 현상을 경감시킨 것을 확인하였다. 또한 2단계 가비지 컬렉션 이 후 세그먼트를 할당할 때, 메모리 사용량을 가장 적게 쓰는 것을 확인하였다. 결과적으로, 에코 애플리케이션에서 70%의 최대 메모리 사용량을 경감시켰으며 20%의 성능하락을 확인하였다. 계산 오버헤드가 작은 IoT 제품의 특성상 메모리 사용량의 이점이 성능하락을 우선하지만, 향후 연구에서 본 성능하락을 감소시킬 기법으로써 경량 자바스크립트 엔진에서 사용가능한 부분 가비지 컬렉션 기법을 연구하려 한다.