MinHeapFreeRatio / MaxHeapFreeRatio
Damon Hart-Davis
dhd at exnet.com
Tue May 8 23:47:01 PDT 2012
Hi,
Note: I should have been clear that memory is not given back to the OS even when the heap is (say) 60%+ free and I force GCs.
Rgds
Damon
On 9 May 2012, at 06:46, Damon Hart-Davis wrote:
> Hi,
>
> First time on this list, so hello! I see a few familiar names from days of yore!
>
> I am running my favourite (Tomcat/Web) app in a very constrained memory environment (a SheevaPlug) along with all the usual Internet server junk (sendmail, ntp, sshd, etc) and I am aiming to squeeze it into the even tighter space of a Raspberry Pi in due course.
>
> As such, I want the JVM to give memory back to the OS whenever possible. In code I set a target to keep about 25% of the heap free, and so for example I stop cacheing some stuff when below that, and cache more vigorously above that.
>
> Here are some relevant options:
>
> CATALINA_OPTS="-Xmx100m -Xms64m"
> # Cap size of non-(main-)heap components.
> CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=48m"
> # Trim thread stack size.
> CATALINA_OPTS="$CATALINA_OPTS -Xss256k"
> # Keep the new generation well within the target 25% free...
> CATALINA_OPTS="$CATALINA_OPTS -XX:NewRatio=5"
> # Be aggressive about giving memory back to the system above target 25% free.
> CATALINA_OPTS="$CATALINA_OPTS -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=26"
> # Run in incremental GC mode to minimise pauses.
> CATALINA_OPTS="$CATALINA_OPTS -Xincgc"
>
> I see some evidence that the free ratios are being observed by when the heap is expanded, but I have never seen any variant of JDK 6 or 7, including the Oracle embedded 6, actually give memory back to the OS with this app.
>
> Am I still doing something wrong? B^>
>
> Rgds
>
> Damon
>
More information about the hotspot-gc-use
mailing list