Increase JVM heap size for Scala?

前端 未结 5 1069
醉酒成梦
醉酒成梦 2020-11-27 12:37

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

相关标签:
5条回答
  • 2020-11-27 13:14

    Based on Joe's suggestion, I looked at the scala program, which is a Bash script that calls java with various Scala specific arguments. It allows extra command line arguments to be passed to Java through the JAVA_OPTS environment variable. So you can increase the heap size like this:

    JAVA_OPTS="-Xmx2g" scala classname arguments...
    
    0 讨论(0)
  • 2020-11-27 13:22

    You can pass options to the JVM via -J. E.g.,

    scala -J-Xmx2g ...
    
    0 讨论(0)
  • 2020-11-27 13:24

    As a hack you can edit the scala/bin/scala file to edit the parameters for the java command. Not pretty.

    0 讨论(0)
  • 2020-11-27 13:28

    The JAVA_OPTS environment variable is used to specify the options passed to the java command. See the Scala manpage for details.

    0 讨论(0)
  • 2020-11-27 13:37

    Edit JAVA_OPTS.

    0 讨论(0)
提交回复
热议问题