2

I am running an application with the following JVM paramaters,

-J-Xms2048m -J-Xmx2048m -J-XX:MaxMetaspaceSize=1024m -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled -J-Djava.net.preferIPv4Stack=true"

When i launched the application ,

The heap memory is 120MB/2048MB and the memory shown for the particular process in Task manager(In Memory column - processes tab) is 680MB,

Now i run an intensive task,

My heap looks like this,

enter image description here

As seen, after launching application an intensive task is ran and after finishing it came back to previous state.

But, in Task manager (Physical memory) for the process has became around 2300MB from 680MB and its not coming down,

enter image description here

I am not able to understand what's the relation here..

Why When heap memory is released , the Physical memory is not going down ? - Is it because, allocating memory is costly and it is not relieving immediately?

user3164187
  • 1,382
  • 3
  • 19
  • 50
  • 1
    JVM do not release the memory once it has acquired. Operating system can take extra memory from JVM when it requires. – RDK Jun 27 '19 at 12:51
  • 1
    Because Java simply does not return memory back to the operating system. I think this is going to change with Java 13, but currently this is not the case –  Jun 27 '19 at 12:51
  • 2
    I think JDK 11 can already do this https://stackoverflow.com/q/55194152/14955 – Thilo Jun 27 '19 at 12:55

0 Answers0