0

Below picture shows result of htop on my server (sorry was not able to upload it here due to technical issues on SO, pasting imgur link).

My observations:

  1. We have enough ram (8/15GB memory is used)
  2. Xmx for my java app allows up to 4G heap
  3. Still the java app's RES column is only ~400MB
  4. However, app's VIRT is 9.6GB!

Question: Why doesn't JVM use the entire 4GB heap space it is allowed to use? and uses virtual memory instead?

https://i.stack.imgur.com/AE90P.jpg

Mahdi
  • 1,871
  • 2
  • 24
  • 41
  • Regarding the meaning of virtual memory, check https://serverfault.com/questions/138427/what-does-virtual-memory-size-in-top-mean. – dunni Oct 13 '22 at 10:18

1 Answers1

1

If your application doesn't use the allowed heap memory, it just means that it doesn't need it.

Regarding the meaning of virtual memory, check the following question and the most upvoted answer: https://serverfault.com/questions/138427/what-does-virtual-memory-size-in-top-mean
In short: The value doesn't mean, that your application uses that memory.

dunni
  • 43,386
  • 10
  • 104
  • 99