-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 All,
Here's an updated script to check for maximum heap. I'm also including the (simple) code for the MemoryInfo class referenced in the script (the lack of this class being available was why the script failed for me earlier). Enjoy, - -chris maxheap.sh - ---------- #!/bin/sh # # Set JAVA_OPTS to "-server" if you want to use the server JVM. # Please don't set JAVA_OPTS to include either -Xms or -Xmx. # initial_max=${1:-4096} max=${initial_max} return_value=1 echo -n Working... while [ "1" = "$return_value" -a "0" -lt "$max" ] ; do if [ "0" == `expr ${max} % 100` ] ; then echo echo -n "Still working (currently checking ${max}M)..." fi output=`java -showversion $JAVA_OPTS -Xms${max}M -Xmx${max}M MemoryInfo 2>&1` return_value=$? if [ "1" = "$return_value" ] ; then max=`expr ${max} - 1` fi done echo if [ "0" = "$max" ] ; then echo "No maximum heap size found. :(" else echo Stopped with max=${max} echo Return value was ${return_value} echo Memory Info is: echo "$output" fi MemoryInfo.java - --------------- public class MemoryInfo { public static void main(String[] args) { Runtime rt = Runtime.getRuntime(); System.out.printf("total=%10db (%4dMiB)", rt.totalMemory(), (rt.totalMemory() / (1024*1024))); System.out.println(); System.out.printf(" max=%10db (%4dMiB)", rt.maxMemory(), (rt.maxMemory() / (1024*1024))); System.out.println(); System.out.printf(" free=%10db (%4dMiB)", rt.freeMemory(), (rt.freeMemory() / (1024*1024))); System.out.println(); } } -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAktHlKgACgkQ9CaO5/Lv0PBdyQCgoHFQ+PyvOKBLtHaEC7mi712G poQAn1rfxwUfJBEn4D69zivzsZCHrG4h =2oyq -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org