0

We have 64-bit Oracle JRE 8 and our application start as:

java -jar C:\path\to\app.jar

How JVM does uses memory in that case (when you do not set -Xmx and other options)?

gavenkoa
  • 45,285
  • 19
  • 251
  • 303
  • `java -XX:+PrintFlagsFinal -version | grep MaxHeapSize` – assylias May 05 '17 at 11:03
  • 1
    http://stackoverflow.com/questions/28272923/default-xmxsize-in-java-8 – assylias May 05 '17 at 11:05
  • @assylias ~2.1 GiB. Interesting... So the max memory consumption limited even in 64-bit machine by default... But this number differs for same JVM but different hosts. – gavenkoa May 05 '17 at 11:05
  • it depends on the JVM (client or server) and on the available memory – P.J.Meisch May 05 '17 at 12:47
  • @P.J.Meisch 64-bit Oracle HotSpot JVM always run as `-server`. – gavenkoa May 05 '17 at 15:54
  • 1
    Note: the maximum heap size doesn't apply to memory usage outside the heap. These JVMs memory includes the jars, thread stacks, direct memory, native memory, the JVM itself, the metaspace (including code) GUI components, socket buffers etc. Needless to say, the heap might be smaller than the rest of the memory usage. – Peter Lawrey May 05 '17 at 20:41

2 Answers2

2

So the max memory consumption limited even in 64-bit machine by default... But this number differs for same JVM but different hosts.

For openjdk and oracle jvms this is governed by the MaxRAMFraction option, which under 64bit defaults to 4, i.e. 25% of physical memory.

the8472
  • 40,999
  • 5
  • 70
  • 122
0

I don't remember correct, but as i know jvm will not use more than 25% of RAM if you will not specify -Xmx or -Xms