0

I am running a java server program to which i have assigned 4096M RAM but it shows memory as below in top command .

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1512384 root 20 0 12.8g 5.3g 38912 S 3.6 11.2 245:33.64 /usr/java/jre/bin/java

it is showing residential memory as 5.3g and virtual as 12.8 , why this is so. these are higher than assigned memory of 4G

1 Answers1

0

You likely used java -Xmx which limits the maximum heap space for the java process. However heap is not the only memory region a JVM manages.

There is a good explanation on https://medium.com/platform-engineer/understanding-java-memory-model-1d0863f6d973

Queeg
  • 7,748
  • 1
  • 16
  • 42
  • Thanks Hiran for you answer .that is quite helpful . i also want to know what is residential memory . its heap+ which memory? – Reeta Aggarwal Jul 27 '22 at 12:58
  • The virtual memory is all memory a process occupies, parts of which may get swapped to disk. The resident set is the non-swapped part. See https://en.wikipedia.org/wiki/Resident_set_size – Queeg Jul 27 '22 at 22:08