增加 Scala 的 JVM 堆大小? [英] Increase JVM heap size for Scala?
问题描述
我有一个 Scala 数据处理工具,它因 java.lang.OutOfMemoryError
异常而失败.该工具需要对一个大数据文件(我正在处理的文件超过 700MB)进行几次传递,因此如果可以将整个文件存储在内存中会很方便.
I have a Scala data processing tool which is failing with a java.lang.OutOfMemoryError
exception. The tool needs to make a couple passes over a large data file (the one I'm working on is over 700MB), so it would be convenient if the entire thing could be stored in memory.
我从命令行或使用scala"运行程序从 Bash 脚本运行该工具.如何为此增加 JVM 堆大小?我试过传递 -Xmx1024m
,但它不能识别这个参数.我正在使用 Scala 2.8.0 (r18678) 的夜间版本.
I run the tool from the command line or from a Bash script using the "scala" runner. How do I increase the JVM heap size for this? I've tried passing -Xmx1024m
, but it does not recognize this argument. I'm using a nightly build of Scala 2.8.0 (r18678).
推荐答案
JAVA_OPTS 环境变量用于指定传递给 java 命令的选项.有关详细信息,请参阅 Scala 手册页.
The JAVA_OPTS environment variable is used to specify the options passed to the java command. See the Scala manpage for details.
这篇关于增加 Scala 的 JVM 堆大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!