Do diffence

java 메모리 사이즈 - 힙, 스택, 메쏘드 영역 본문

Tech Tips

java 메모리 사이즈 - 힙, 스택, 메쏘드 영역

고포릿 2006. 9. 22. 16:38
method area와 heap은 JVM 기동시 생성되고, JVM stack은 thread가 처음 만들어질때 thread별로 생성됩니다.



1. Heap

디플트 값은 다음과 같습니다.

- 초기 사이즈: 2MB

- 최대 사이즈: 64MB

입니다. (맨 아래 참고)



2. JVM stack

1.3에서는 설정할 수 있는 옵션이 없으며, 1.4에서 -Xss 옵션으로 지정이 가능하도록 되어 있지만, default 값에 대해서는 문서화가 되어 있지 않습니다.

그리고, jdk 1.3.1의 linux 버전에서는 stack size와 관련된 버그가 있으므로 참고 바랍니다.(initial stack size가 6MB를 넘어서는 경우 제대로 처리하지 못함)



3. Method area

JVM spec에서는 이 영역의 사이즈를 사용자가 조정할 수 있도록 해도 된다고 되어 있지만, SUN의 jdk에서는 이를 허용하고 있지 않습니다. default size에 대해서도 공식적인 언급이 없군요.



--



http://java.sun.com/j2se/1.3/docs/tooldocs/win32/java.html#options



-Xmsn

Specify the initial size, in bytes, of the memory allocation pool. Thisvalue must be a multiple of 1024 greater than 1MB. Append the letter kor K to indicate kilobytes, or m or M to indicate megabytes. Thedefault value is 2MB. Examples:

-Xms6291456

-Xms6144k

-Xms6m





-Xmxn

Specify the maximum size, in bytes, of the memory allocation pool. Thisvalue must a multiple of 1024 greater than 2MB. Append the letter k orK to indicate kilobytes, or m or M to indicate megabytes. The defaultvalue is 64MB. Examples:

-Xmx83886080

-Xmx81920k

-Xmx80m