JVM 메모리 히스토그램 덤프

Jung-taek Lim
1 min readNov 26, 2015

--

Imported from Agit

특별히 메모리가 새어나갈 프로세스가 없었는데 Scala Stream 특성을 모르고 썼더니 지나간 Stream 의 element 가 해제가 안되어서 메모리가 꽉 차더라구요…;;
이건 http://blog.dmitryleskov.com/programming/scala/stream-hygiene-i-avoiding-memory-leaks 여기 문서 보고 적당히 해결했고…

찾는데 도움이 많이 되었던 게 메모리 히스토그램이었습니다. Oracle JDK 에서 기본 제공해 주는 툴로 확인이 가능합니다. 기본 툴들이 굉장히 유용하네요.
실행 중인 프로세스에 대한 메모리 히스토그램을 파일로 덤프 뜨는 명령입니다.

jmap -histo:live <pid> > dump.out

다행히도 처리한 수 만큼의 객체가 살아 있어서 메모리 릭 발생 지점을 쉽게 확인할 수 있었습니다.

참고하세요~

- ref: http://stackoverflow.com/a/2511709/3480122

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response