0

i have run a springboot example project to observe the jvm memory ,but it Makes me confused is that in the result of jstat:

OGC(Current old generation capacity . kB) 19848
NGC(Current new generation capacity kB) 9984
MC (Metaspace capacity kB) 35456

but the result of top the RES(A task's currently used share of available physical memory) is 127M so its my question :

why OGC+MNC+MC= 63.7578125‬M != RES 127M

NGCMN    NGCMX     NGC     S0C   S1C       EC      OGCMN      OGCMX       OGC         OC       MCMN     MCMX      MC     CCSMN    CCSMX     CCSC    YGC    FGC 
5440.0  83968.0   9984.0  960.0  960.0   8064.0    10944.0   167936.0    19848.0    19848.0      0.0 1081344.0  35456.0      0.0 1048576.0   4480.0     80     2

top:
PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                                                              
18267 wks       20   0 2242.5m 127.8m  13.0m S  0.0 13.1   0:54.99 java    

王ks
  • 35
  • 4

1 Answers1

0

The memory used by the process includes;

  • the JVM's code. e.g. .so libraries
  • the JVM's workspace.
  • any native memory you use for IO.
  • any graphics components.
  • thread stack spaces.
  • memory mapped files.

You can see a more detailed breakdown by inspecting /proc/{pid}/smap which shows you all the memory regions and how much is resident. Unfortunately it doesn't understand Java memory layout but it can give you an idea of where memory is used.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130