본문 바로가기
카테고리 없음

리눅스 - 쓰레드 덤프, 힙 덤프( thread dump, heap dump )

by 애플 로그 2021. 7. 13.
반응형

시스템의 장애나 무제 발생시 원인파악이 쉽게 되지 않고 심도있는 디버깅 하려면,

쓰레드 덤프, 힙덤프를 떠서 확인해봐야할때가 있다.  

내가보려고 명령어만 정리 해놓는다.

 

 

쓰레드 덤프 명령어 ( PID 확인  - EX : PID가 17141 일 경우 )

jstack -l 17141 > 20210713124600.threaddump

20210713124600.threaddump 부분은 파일명

 

 

힙 덤프 ( PID 확인  - EX : PID가 17141 일 경우 )

jmap -dump:format=b,file=heapdump.log.20210713124800 17141

 

heapdump.log.20210713124800 부분이 파일명 

 

 

이렇게 떨어진 덤프파일을 사실 맨눈으로 보는것은 상당히 어렵다. 

분석 도구들을 이용 하는것이 좋다.

 

 

 

쓰레드 덤프의 경우는 Java VisualVM 을 이용하는 것이 좋다.

 

https://visualvm.github.io/download.html

 

VisualVM: Download

First Steps Unzip the downloaded archive. The archive already contains the top-level visualvm directory. Start VisualVM by invoking the binary appropriate for your OS:visualvm\bin\visualvm.exe or visualvm/bin/visualvm You may provide additional options to

visualvm.github.io

 

힙덤프의 경우는 Eclipse 에서 제공하는 mat 를 이용하는것이 좋다.

 

http://www.eclipse.org/mat/

 

Eclipse Memory Analyzer Open Source Project | The Eclipse Foundation

The Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 375 open source projects, including runtimes, tools and frameworks.

www.eclipse.org

 

댓글