27 lines
1.3 KiB
Markdown
27 lines
1.3 KiB
Markdown
- 자바 옵션에 `-verbosegc` 라는 옵션을 주면 되고, `>` 리다이렉션 명령어를 통해서 파일로 저장하고 분석할 수 있다.
|
||
|
||
```bash
|
||
java -jar -verbosegc app.jar
|
||
```
|
||
|
||
Eclipse에서 찍는 방법
|
||
```ruby
|
||
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:D:\log\gclog\gclog.log
|
||
```
|
||
|
||
|
||
"할당 실패"는 GC 주기가 시작되는 원인입니다.
|
||
|
||
"할당 실패"는 Eden에 객체를 할당할 공간이 더 이상 남아 있지 않음을 의미합니다. 따라서 이는 ***Young GC의 정상적인 원인***입니다.
|
||
|
||
이전 JVM은 사소한 GC 주기에 대한 GC 원인을 인쇄하지 않았습니다.
|
||
|
||
"할당 실패"는 마이너 GC의 원인일 수 있는 거의 유일한 원인입니다. 마이너 GC가 발생하는 또 다른 이유는 CMS 설명 단계(+XX:+ScavengeBeforeRemark가 활성화된 경우) 때문일 수 있습니다.
|
||
|
||
"Allocation Failure" is a cause of GC cycle to kick in.
|
||
|
||
"Allocation Failure" means that no more space left in Eden to allocate object. So, it is normal cause of young GC.
|
||
|
||
Older JVM were not printing GC cause for minor GC cycles.
|
||
|
||
"Allocation Failure" is almost only possible cause for minor GC. Another reason for minor GC to kick could be CMS remark phase (if `+XX:+ScavengeBeforeRemark` is enabled). |