6

Based on the documentation : https://docs.oracle.com/javase/7/docs/api/java/lang/management/MemoryUsage.html

committed - represents the amount of memory (in bytes) that is guaranteed to be available for use by the Java virtual machine. The amount of committed memory may change over time (increase or decrease). The Java virtual machine may release memory to the system and committed could be less than init. committed will always be greater than or equal to used.

but the question is how JVM calculate the committed memory?

Sofo Gial
  • 697
  • 1
  • 9
  • 20
Andoy Abarquez
  • 1,119
  • 4
  • 17
  • 30
  • Closely related to https://stackoverflow.com/questions/41468670/difference-in-used-committed-and-max-heap-memory – Raedwald Nov 14 '18 at 09:40
  • The strategy heavily relies on the JVM and the GC versions. Different versions give different strategies. – Sofo Gial Nov 14 '18 at 09:41
  • Do you want to know how the JVM calculates the amount of memory that it requests from the OS or the amount that is currently comitted? – dpr Nov 14 '18 at 09:42
  • @dpr, i am aware that amount of committed memory may change over time (increase or decrease). I want to know the basis of increase/decrease of committed memory. – Andoy Abarquez Nov 14 '18 at 10:27
  • @Andrew You can find some relevant info here: https://docs.oracle.com/javase/9/gctuning/factors-affecting-garbage-collection-performance.htm#JSGCT-GUID-6635C481-AE78-485A-A184-A1709712961A – Sofo Gial Nov 14 '18 at 11:54
  • I don't understand your question to be honest. A JVM starting point of committed memory is `-Xms` value , if your application wants more memory - this value will grow, up to `-Xmx`. – Eugene Jul 09 '20 at 02:16

1 Answers1

1

Here you can find a little bit more detail, but it does not explain the exact way how committed heap space is increased:

There is also a committed heap size which acts as a "high water mark", moving up once the JVM cannot free up space even on old collection / young collection to make room. In this case, the committed heap size is increased. This cycle repeats until the committed heap size matches the maximum heap size, the maximum space allocatable.

https://support.mulesoft.com/s/article/Java-JVM-memory-allocation-pattern-explained

josmaf
  • 148
  • 1
  • 9