Comment 15 for bug 565101

Revision history for this message
Thierry Carrez (ttx) wrote : Re: walrus reports java.lang.OutOfMemoryError: Java heap space

Important note: when not specified, max heap size is set to:
***
Smaller of 1/4th of the physical memory or 1GB. Before J2SE 5.0, the default maximum heap size was 64MB. You can override this default using the -Xmx command-line option.
***

So it sounds like moving from no value to to -Xmx384m would actually reduce the maximum heap size on most server systems, and that the default value is sanely calculated from available memory. It also makes a case for *not* specifying the value by default, something like:

XMX=""
[ -n ${MAXHEAPSIZE} ] && XMX="-Xmx ${MAXHEAPSIZE}m"
opts="-h $EUCALYPTUS -u $EUCA_USER --pidfile /var/run/eucalyptus/eucalyptus.pid -l $LOGLEVEL -L console-log $XMX"

Or even

# Extra options passed to JVM call. For exemple you can set a 1Gb maximum heap size by setting
# EXTRAOPTS="-Xmx1024m"
EXTRAOPTS=""
opts="-h $EUCALYPTUS -u $EUCA_USER --pidfile /var/run/eucalyptus/eucalyptus.pid -l $LOGLEVEL -L console-log $EXTRAOPTS"

In all cases, confirming that the observed memory profile usage is judged sane by upstream (and setting max heap size is their recommended way of handling load) needs to happen before the fix.