[pkg-java] r12307 - trunk/java-wrappers

Vincent Fourmond fourmond at alioth.debian.org
Tue May 4 21:40:13 UTC 2010


Author: fourmond
Date: 2010-05-04 21:40:12 +0000 (Tue, 04 May 2010)
New Revision: 12307

Modified:
   trunk/java-wrappers/java-wrappers.sh
Log:
[java-wrappers] Beginnings of a small function for determining the reasonable value for a -Xmx argument

Modified: trunk/java-wrappers/java-wrappers.sh
===================================================================
--- trunk/java-wrappers/java-wrappers.sh	2010-05-04 21:28:16 UTC (rev 12306)
+++ trunk/java-wrappers/java-wrappers.sh	2010-05-04 21:40:12 UTC (rev 12307)
@@ -37,6 +37,16 @@
     exit 1;
 }
 
+# Try to get the amount of memory available on the machine to come up
+# with a decent -Xmx argument, returned as the value of the
+# determined_xmx_arg (defaults in kilobytes, so you should add k
+# afterwards)
+determine_xmx_arg() {
+    # Yes, that's ugly, so what ??
+    mem=`free -k 2>/dev/null | head -n2 | tail -n1 | sed -r s/'[^0-9]+//' | cut -d' ' -f1`
+
+}
+
 # Try to find a Java runtime and set JAVA_HOME and JAVA_CMD accordingly.
 # If JAVA_CMD exists, nothing is done. If JAVA_HOME exists, only that
 # is searched.




More information about the pkg-java-commits mailing list