java 메모리 누수 확인 톰캣

# 힙덤프 및 히스토그램 확인
$ jmap -histo:live 8468

 num     #instances         #bytes  class name
----------------------------------------------
   1:        100579       45888592  [I
   2:         33355       36298488  [B
   3:        265926       33307432  [C
   4:        102544       16799208  <constMethodKlass>
   5:        102544       13957488  <methodKlass>
   6:          8659       11358872  <constantPoolKlass>
   7:        162014        9190704  <symbolKlass>
   8:        281104        8995328  java.lang.String
   9:          8659        6908872  <instanceKlassKlass>
  10:          6912        6586976  <constantPoolCacheKlass>

# Heap사용량 확인
$ jmap -heap [PID]
Attaching to process ID 8468, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 20.45-b01

using thread-local object allocation.
Parallel GC with 8 thread(s)

Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 16838033408 (16058.0MB)
   NewSize          = 1310720 (1.25MB)
   MaxNewSize       = 17592186044415 MB
   OldSize          = 5439488 (5.1875MB)
   NewRatio         = 2
   SurvivorRatio    = 8
   PermSize         = 21757952 (20.75MB)
   MaxPermSize      = 85983232 (82.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 162988032 (155.4375MB)
   used     = 13271416 (12.656608581542969MB)
   free     = 149716616 (142.78089141845703MB)
   8.142570860662948% used
From Space:
   capacity = 393216 (0.375MB)
   used     = 0 (0.0MB)
   free     = 393216 (0.375MB)
   0.0% used
To Space:
   capacity = 8192000 (7.8125MB)
   used     = 0 (0.0MB)
   free     = 8192000 (7.8125MB)
   0.0% used
PS Old Generation
   capacity = 418054144 (398.6875MB)
   used     = 158671088 (151.32054138183594MB)
   free     = 259383056 (247.36695861816406MB)
   37.954674119914955% used
PS Perm Generation
   capacity = 85983232 (82.0MB)
   used     = 79165296 (75.49790954589844MB)
   free     = 6817936 (6.5020904541015625MB)
   92.07062139743712% used


# 덤프파일 만들기(jmap버전이 낮으면 dump옵션이 없다.)
$jmap -dump:file=/home/groupware/domain.bin [PID]



# 덤프파일 분석하기
$ jhat domain.bin
Reading from domain.bin...
Dump file created Tue Jun 09 10:28:24 KST 2015
Snapshot read, resolving...
Resolving 3154443 objects...
Chasing references, expect 630 dots..................................
.....................................................................
.....................................................................
.....................................................................
.................................................................
Eliminating duplicate references.....................................
.....................................................................
.....................................................................
.....................................................................
.......................
Snapshot resolved.
Started HTTP server on port 7000
Server is ready.

# 사이트로 접속 후 확인
# http://localhost:7000

덧글

댓글 입력 영역