[
https://issues.apache.org/jira/browse/OPENNLP-1216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16596961#comment-16596961
]
ASF GitHub Bot commented on OPENNLP-1216:
-----------------------------------------
kojisekig closed pull request #331: OPENNLP-1216: opennlp command should allow
users to set heap size
URL: https://github.com/apache/opennlp/pull/331
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/opennlp-distr/src/main/bin/opennlp
b/opennlp-distr/src/main/bin/opennlp
index d48c6227b..374c78596 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 703b60e2d..a978c34cd 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
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> opennlp command should allow users to set heap size
> ---------------------------------------------------
>
> Key: OPENNLP-1216
> URL: https://issues.apache.org/jira/browse/OPENNLP-1216
> Project: OpenNLP
> Issue Type: Documentation
> Components: Command Line Interface
> Affects Versions: 1.9.0
> Reporter: Koji Sekiguchi
> Priority: Minor
> Fix For: 1.9.1
>
>
> When I used ParserTrainer, I got OutOfMemoryError. I checked opennlp shell
> script, I found uses cannot change the heap size without editing the script.
> I think we should allow uses to set it by doing like this:
> {code}
> $ JAVA_HEAP=4096m opennlp ParserTrainer ...
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)