<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi Sergejs --<br>
    <br>
    You are right. This seems to have been changed in hs16/6u18 via:-<br>
    <br>
    <b>6887571 <a
        href="http://monaco.sfbay.sun.com/detail.jsf?cr=6887571">Increase
        default heap config sizes</a><br>
      <br>
      Changeset:     </b><a class="moz-txt-link-freetext" href="http://hg.openjdk.java.net/hsx/hsx16/baseline/rev/0799687b7385">http://hg.openjdk.java.net/hsx/hsx16/baseline/rev/0799687b7385</a><br>
    <br>
    The documentation you pointed to probably dates back to 6.0 FCS and
    is<br>
    likely obsolete in places. Unfortunately, I do not have a more up to
    date<br>
    counterpart of the document to point you to for the one place for
    consolidates<br>
    and more up to date information.<br>
    <br>
    The release notes for 6u18 however did list this change here:-<br>
    <br>
    <a class="moz-txt-link-freetext" href="http://www.oracle.com/technetwork/java/javase/6u18-142093.html">http://www.oracle.com/technetwork/java/javase/6u18-142093.html</a><br>
    <br>
    Search for "Server JVM heap configuration ergonomics".<br>
    <br>
    -- ramki<br>
    <br>
    On 8/29/2011 10:34 AM, Sergejs Melderis wrote:
    <blockquote
cite="mid:CAAU=Jf58YO=cyNhG5n6of_DCSWXPhdcD5VdKLiNFuva441+qwA@mail.gmail.com"
      type="cite">
      <pre wrap="">Hello.
I am trying to figure out how the hotspot chooses the default maximum heap size.
I posted this  question to stackoverflow, but got no answers.
I don't want to repeat it here, so here is the question
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/7194526/hotspot-default-max-heap-size">http://stackoverflow.com/questions/7194526/hotspot-default-max-heap-size</a>

I searched the jdk source code, for the place where it is calculated.
I found function set_heap_size defined here
<a class="moz-txt-link-freetext" href="http://hg.openjdk.java.net/jdk6/jdk6/hotspot/file/dc40301aed45/src/share/vm/runtime/arguments.cpp">http://hg.openjdk.java.net/jdk6/jdk6/hotspot/file/dc40301aed45/src/share/vm/runtime/arguments.cpp</a>

If am not wrong, the calculation happens in the following lines

if (FLAG_IS_DEFAULT(MaxHeapSize)) {
   julong reasonable_max = phys_mem / MaxRAMFraction;

   if (phys_mem <= MaxHeapSize * MinRAMFraction) {
     // Small physical memory, so use a minimum fraction of it for the heap
     reasonable_max = phys_mem / MinRAMFraction;
   } else {
     // Not-small physical memory, so require a heap at least
     // as large as MaxHeapSize
     reasonable_max = MAX2(reasonable_max, (julong)MaxHeapSize);
   }


MaxRAMFraction is 4, so reasonable_max is phys_mem / 4. So, unless
physical memory is very small,
the reasonable_max will be MAX2(reasonable_max, (julong)MaxHeapSize);

MAX2 is defined as
#define MAX2(a, b) (((a) < (b)) ? (b) : (a))

At the end reasonable_max is set as MaxHeapSize
FLAG_SET_ERGO(uintx, MaxHeapSize, (uintx)reasonable_max);

If I plug in the memory size on my test machine, the reasonable_max
will be very close to what I get from jmap -heap.
With RAM of 8, 16 GB, or more, the MaxHeapSize will be greater than 1
GB, which contradicts the documentation
<a class="moz-txt-link-freetext" href="http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html#par_gc.ergonomics.default_size">http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html#par_gc.ergonomics.default_size</a>

Thanks,

Sergey.
_______________________________________________
hotspot-gc-use mailing list
<a class="moz-txt-link-abbreviated" href="mailto:hotspot-gc-use@openjdk.java.net">hotspot-gc-use@openjdk.java.net</a>
<a class="moz-txt-link-freetext" href="http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use">http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use</a>
</pre>
    </blockquote>
  </body>
</html>