Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As <a href="https://stackoverflow.com/a/3428424/42473">Matt Solnit</a> answered, the specifics for java 1.5 were 1GB or ¼ of physical memory, whichever is lower, for a <em>server class</em> machine and 64MB for other machines (from <a href="http://www.oracle.com/technetwork/java/ergo5-140223.html" rel="nofollow noreferrer">Java 5.0 Ergonomics documentation</a>).</p> <p>Unfortunately JVMs change over time and the most appropriate documentation gets more difficult to identify, so to find out the default heap (and PermGen heap) size for your specific JVM, the best way to find out is to get your JVM to tell you.</p> <hr> <p>Somewhere between "1.6.0_06" and "1.6.0_21", the <code>-XX:+PrintFlagsFinal</code> option was added, and it appears to have first come to <a href="http://q-redux.blogspot.com/2011/01/inspecting-hotspot-jvm-options.html" rel="nofollow noreferrer">peoples attention</a> at around "1.6.0_23". It provides a wealth of information about how the JVM is configured, but we will concentrate on heap and permgen sizes and limits.</p> <h3>Linux</h3> <p>On Linux you can use the command:</p> <pre><code>java -XX:+PrintFlagsFinal -version 2&gt;&amp;1 | grep -i -E 'heapsize|permsize|version' </code></pre> <h3>Windows</h3> <p>Similarly on windows, you can use the command:</p> <pre><code>java -XX:+PrintFlagsFinal -version 2&gt;&amp;1 | findstr /I "heapsize permsize version" </code></pre> <h3>Notes</h3> <ul> <li>Depending on your system, <code>java</code> may default to either <code>-client</code> or <code>-server</code>, so if you force your application to start with either of these, you can also do the same when you start these commands.</li> </ul> <h3>Examples</h3> <p>On my Linux system, I get:</p> <pre><code>$ java -XX:+PrintFlagsFinal -version 2&gt;&amp;1 | grep -i -E 'heapsize|permsize|version' uintx AdaptivePermSizeWeight = 20 {product} uintx ErgoHeapSizeLimit = 0 {product} uintx InitialHeapSize := 66328448 {product} uintx LargePageHeapSizeThreshold = 134217728 {product} uintx MaxHeapSize := 1063256064 {product} uintx MaxPermSize = 67108864 {pd product} uintx PermSize = 16777216 {pd product} java version "1.6.0_24" </code></pre> <p>and it defaults to <code>-server</code>, so with <code>-client</code> I get:</p> <pre><code>$ java -client -XX:+PrintFlagsFinal -version 2&gt;&amp;1 | grep -i -E 'heapsize|permsize|version' uintx AdaptivePermSizeWeight = 20 {product} uintx ErgoHeapSizeLimit = 0 {product} uintx InitialHeapSize := 16777216 {product} uintx LargePageHeapSizeThreshold = 134217728 {product} uintx MaxHeapSize := 268435456 {product} uintx MaxPermSize = 67108864 {pd product} uintx PermSize = 12582912 {pd product} java version "1.6.0_24" </code></pre> <p>On my Windows system, I get:</p> <pre><code>C:\&gt;java -XX:+PrintFlagsFinal -version 2&gt;&amp;1 | findstr /I "heapsize permsize version" uintx AdaptivePermSizeWeight = 20 {product} uintx ErgoHeapSizeLimit = 0 {product} uintx InitialHeapSize := 16777216 {product} uintx LargePageHeapSizeThreshold = 134217728 {product} uintx MaxHeapSize := 268435456 {product} uintx MaxPermSize = 67108864 {pd product} uintx PermSize = 12582912 {pd product} java version "1.6.0_21" </code></pre> <p>which are the <code>-client</code> settings and there appears to be no <code>-server</code> option:</p> <pre><code>C:\&gt;java -server -XX:+PrintFlagsFinal -version 2&gt;&amp;1 | findstr /I "heapsize permsize version" C:\&gt;java -server -XX:+PrintFlagsFinal -version Error: no `server' JVM at `C:\jdk\jre\bin\server\jvm.dll'. </code></pre> <p>To summarise:</p> <pre><code>Parameter \ JVM 1.6.0_24 Lin/svr Lin/cli Windows InitialHeapSize 63MB 16MB 16MB LargePageHeapSizeThreshold 128MB 128MB 128MB MaxHeapSize 1014MB 256MB 256MB MaxPermSize 64MB 64MB 64MB PermSize 16MB 12MB 12MB </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload