Automatic Dynamic Memory Management Techniques for Memory Scarce Java system

메모리가 적은 자바 시스템을 위한 자동 동적 메모리 관리 기법

  • 최형규 (서울대학교 전기컴퓨터공학부) ;
  • 문수묵 (서울대학교 전기컴퓨터공학부)
  • Published : 2008.08.15

Abstract

Many embedded systems are supporting Java as their software platform via Java virtual machine. Java virtual machine manages memory automatically by providing automatic memory management, i.e. garbage collector. Because only scarce memory is available to embedded system, Java virtual machine should use small memory and manage it efficiently. This paper introduces two memory management techniques to exploit small memory in Java virtual machine which can execute multiple Java applications concurrently. First, compaction based garbage collection is introduced to overcome external fragmentation problem in presence of immovable memory area. Then garbage collector driven class unloading is introduced to reduce memory use of unnecessary loaded classes. We implemented these techniques in working embedded system and observed that they are very efficient, since more Java applications are able to be executed concurrently and memory use is also reduced with these techniques.

많은 내장형 시스템들이 자바(Java)를 널리 채택하고 있다. 내장형 시스템은 자바 가상 머신을 통해 자바를 지원하며, 자바 가상 머신은 쓰레기 수집기(Garbage Collector)를 통해서 동적 메모리를 자동으로 관리한다. 내장형 시스템은 적은 메모리를 가지고 있기 때문에 자바 가상 머신은 이를 효율적으로 관리해야 한다. 본 논문에서는 여러 자바 프로그램을 동시에 실행할 수 있는 자바 가상 머신에서 적은 메모리를 사용하면서도 효과적으로 메모리를 관리할 수 있는 메모리 관리 기법을 제안한다. 우선 개선된 압축(compaction)기법 기반의 쓰레기 수집 기법을 소개하여 움직일 수 없는 메모리 영역이 존재하더라도 외부 단편화(external fragmentation) 문제를 극복한다. 다음으로 수행 중 메모리 사용을 줄이기 위해서 쓰레기 수집기가 메모리에서 필요 없는 클래스(class)들을 선택적으로 수거하는 class unloading 기법을 소개한다. 소개한 기법들을 실제 동작하는 내장형 시스템에서 실험한 결과, 메모리가 부족하여 동시에 수행할 수 없었던 프로그램들이 같이 수행되는 등 매우 효과적이었다.

Keywords

References

  1. Jones, R. and Lins, R., Garbage Collection: Algorithms for Automatic Dynamic Memory Management, Wiley, 1996
  2. Czajkowski, G. and Daynes, L., "Multitasking without compromise: a virtual machine evolution," In Proceedings of the 16th conference on Object oriented programming, systems, languages, and applications, pp. 125-138, 2001
  3. Connected, Limited Device Configuration Specification, version 1.0, Java Community Process, Sun Microsystems, Inc. http://jcp.org/jsr/detail/30.jsp
  4. KVM Porting Guide, Sun Microsystems, Inc., available as part of the CLDC download package at http://www.sun.com/software/communitysource/ j2me/cldc/downlaod.htm
  5. Haddon, B.K. and Waite, W.M., "A compaction procedure for variable length storage elements," the Computer Journal, Vol.10, pp. 162-165, 1967 https://doi.org/10.1093/comjnl/10.2.162
  6. Cheney, C.J., "A non-recursive list compacting algorithm," Communications of the ACM, Vol.13, No.11, pp. 677-678, 1970 https://doi.org/10.1145/362790.362798
  7. Fitch, J.P. and Norman, A.C., "A note on compacting garbage collection," the Computer Journal, Vol.21, No.1, pp. 31-34, 1978 https://doi.org/10.1093/comjnl/21.1.31
  8. Lockwood Morris, F., "A time- and space-efficient garbage compaction algorithm," Communications of the ACM, Vol.21, No.8, pp. 662-665, 1978 https://doi.org/10.1145/359576.359583
  9. Jonkers, H.B.M., "A fast garbage compaction algorithm," Inf. Process. Lett., Vol.9, No.1, pp. 26-30, 1979 https://doi.org/10.1016/0020-0190(79)90103-0
  10. Cohen, J. and Nicolau, A., "Comparison of compacting algorithms for garbage collection," ACM Transactions on Programming Languages and Systems, Vol.5, No.4, pp. 532-553, 1983 https://doi.org/10.1145/69575.357226
  11. Lindholm, T. and Yellin, F., The Java Virtual Machine Specification, 2nd Ed., Addison Wesley, 1999
  12. McDowell, C.E. and Baldwin, E.A., "Unloading Java classes that contain static fields," Technical report, University of Calif. Santa Cruz, UCSC- CRL-97-18, 1997
  13. Chung, Y. C., Moon, S.-M., Ebcioglu K. and Sahlin, D., "Reducing Sweep Time for a Nearly Empty Heap," In Proceedings of the 27th symposium on Principles of programming languages, pp. 378-389, 2000
  14. Chen, G., Kandemir, M., Vijaykrishnan, N., Irwin, J., Mathiske, B., Wolczko, M., "Heap Compression for Memory-Constrained Java Environments," In Proceedings of the 18th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pp.282-301, 2003
  15. Sachindran, N., Moss, J.E.B. and Berger, E.D., "MC2: High-Performance Garbage Collection for Memory-Constrained Environments," In Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pp. 81-98, 2004