You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by ko...@apache.org on 2018/08/30 00:49:10 UTC

[opennlp] branch master updated: OPENNLP-1216: opennlp command should allow users to set heap size (#331)

This is an automated email from the ASF dual-hosted git repository.

koji pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/opennlp.git


The following commit(s) were added to refs/heads/master by this push:
     new bfab17c  OPENNLP-1216: opennlp command should allow users to set heap size (#331)
bfab17c is described below

commit bfab17c200b0e7ed4eea916e1cb9a3c41294f8ea
Author: Koji Sekiguchi <ko...@rondhuit.com>
AuthorDate: Thu Aug 30 09:49:08 2018 +0900

    OPENNLP-1216: opennlp command should allow users to set heap size (#331)
---
 opennlp-distr/src/main/bin/opennlp     | 7 ++++++-
 opennlp-distr/src/main/bin/opennlp.bat | 8 +++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/opennlp-distr/src/main/bin/opennlp b/opennlp-distr/src/main/bin/opennlp
index d48c622..374c785 100755
--- a/opennlp-distr/src/main/bin/opennlp
+++ b/opennlp-distr/src/main/bin/opennlp
@@ -29,7 +29,12 @@ if [ -z "$JAVACMD" ] ; then
   fi
 fi
 
+unset HEAP
+if [ -n "$JAVA_HEAP" ] ; then
+  HEAP="-Xmx$JAVA_HEAP"
+fi
+
 # Might fail if $0 is a link
 OPENNLP_HOME=`dirname "$0"`/..
 
-$JAVACMD -Xmx1024m -cp $(echo $OPENNLP_HOME/lib/*.jar | tr ' ' ':') opennlp.tools.cmdline.CLI $@
+$JAVACMD $HEAP -cp $(echo $OPENNLP_HOME/lib/*.jar | tr ' ' ':') opennlp.tools.cmdline.CLI $@
diff --git a/opennlp-distr/src/main/bin/opennlp.bat b/opennlp-distr/src/main/bin/opennlp.bat
index 703b60e..a978c34 100644
--- a/opennlp-distr/src/main/bin/opennlp.bat
+++ b/opennlp-distr/src/main/bin/opennlp.bat
@@ -31,6 +31,12 @@ IF "%JAVA_CMD%" == "" (
 	)
 )
 
+REM remove HEAP variable
+SET HEAP=
+IF not "%JAVA_HEAP%" == "" (
+	SET HEAP="-Xmx%JAVA_HEAP%"
+)
+
 REM #  Should work with Windows XP and greater.  If not, specify the path to where it is installed.
 IF "%OPENNLP_HOME%" == "" (
 	SET OPENNLP_HOME=%~sp0..
@@ -42,6 +48,6 @@ IF "%OPENNLP_HOME%" == "" (
 REM #  Get the library JAR file name (JIRA OPENNLP-554)
 FOR %%A IN ("%OPENNLP_HOME%\lib\opennlp-tools-*.jar") DO SET JAR_FILE=%%A
 
-%JAVA_CMD% -Xmx1024m -jar %JAR_FILE% %*
+%JAVA_CMD% %HEAP% -jar %JAR_FILE% %*
 
 ENDLOCAL
\ No newline at end of file