JVM Memory Defaults

13,231

Solution 1

As documented:

  • Xmx: default 64M
  • Xms: default 2M

That's for Linux, but I've checked and the values are the same for Windows and Solaris too. Don't rely on that being the case for other versions or options though. In particular, the choice of server or client VM depends on operating system, at least in later versions.

Another piece of documentation

Solution 2

From Sun's tooldocs:

-Xmsn Specify the initial size, in bytes, of the memory allocation pool. This value must be a multiple of 1024 greater than 1MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 2MB. Examples:

           -Xms6291456
           -Xms6144k
           -Xms6m

-Xmxn Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. Examples:

           -Xmx83886080
           -Xmx81920k
           -Xmx80m

So 2MB and 64MB.

(The link above is for the 1.5 docs, but you can download the 1.4 docs, and they say the same thing.)

Share:
13,231
amanagg1204
Author by

amanagg1204

Updated on October 30, 2022

Comments

  • amanagg1204
    amanagg1204 over 1 year

    What is the default Xms and Xmx settings for the Sun JVM (v 1.4*) if those values are not specified at startup?

  • palantus
    palantus almost 15 years
    Is it the same in 1.4, though?
  • Jon Skeet
    Jon Skeet almost 15 years
    As it happens, yes... but I've linked the 1.4 docs in my answer.
  • Laurence Gonsalves
    Laurence Gonsalves almost 15 years
    Interesting. I'd linked to the 1.5 docs because when I tried to get the 1.4 docs it redirected me to a download page. Apparently 1.4.2 doesn't do this yet, though.
  • Daisuke Shimamoto
    Daisuke Shimamoto almost 12 years
    I know the question was for 1.4 but you can find one for Java 6 at docs.oracle.com/javase/6/docs/technotes/guides/vm/…