<html>
    <head>
      <base href="http://icedtea.classpath.org/bugzilla/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - CACAO has a fixed default max heap, unlike HotSpot which adapts to physical memory"
   href="http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2612">2612</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>CACAO has a fixed default max heap, unlike HotSpot which adapts to physical memory
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>IcedTea
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>2.6.1
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>all
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P5
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>CACAO
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>gnu.andrew@redhat.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chewi@gentoo.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>unassigned@icedtea.classpath.org, xerxes@zafena.se
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=1415&action=diff" name="attach_1415" title="dynmaxheap.patch">attachment 1415</a> <a href="attachment.cgi?id=1415&action=edit" title="dynmaxheap.patch">[details]</a></span>
dynmaxheap.patch

We have long had problems with CACAO failing to build Gentoo packages due to
OutOfMemory errors where HotSpot would otherwise succeed. gnu_andrew told me
that this is because CACAO uses more memory, though perhaps I misunderstood.
When I looked closer, I found this assertion didn't stack up because on Linux,
Java normally sets the maximum heap size to a 1/4 of physical RAM or 2GB,
whichever is smaller. CACAO was failing to build bcprov on a system with 16GB
RAM and yet it worked when I specified -Xmx256m. java -XshowSettings:vm told me
more.

VM settings:
    Max. Heap Size (Estimated): 128.00M
    Ergonomics Machine Class: server
    Using VM: CACAO

Ah. :) Digging into the CACAO code, I found that it sets the maximum heap size
to 128MB unconditionally. I suppose this is reasonable for standalone CACAO but
for IcedTea, which is supposed to be a general purpose VM, this seems woefully
insufficient.

Attached is a patch that can be placed in patches/cacao to make it calculate
1/4 of the physical RAM on Linux in more or less the same way that HotSpot does
and use that if it's greater than 128MB and -Xmx hasn't been given. I've been
careful to avoid overflows as for some reason, the variable used here is a
signed 32-bit int.

This applies against the CACAO version used in 7.2.6.1 (c182f119eaad) although
CACAO is broken in this IcedTea version anyway.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>