14

I get a "java.lang.OutOfMemoryError: Java heap space" when running activator. I would like to set the heap to unlimited size. I read somewhere else that I need to change SBT_OPTS or _JAVA_OPTION somehow like this:

export SBT_OPTS="-Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=2G -Xss2M  -Duser.timezone=GMT"

I could not find any documentation on this anywhere.

Marek J
  • 1,253
  • 7
  • 19
  • 29
eaglefreeman
  • 755
  • 1
  • 6
  • 18
  • 2
    I don't know if you can set unlimited memory but you can easily set memorie usage with `activator -mem 2048 ...` – crak Jan 22 '15 at 14:26

1 Answers1

17

tl;dr activator -help

You can use JAVA_OPTS (may affect other java programs), SBT_OPTS (also affects sbt), ACTIVATOR_OPTS (only affects activator) and there's also a -mem flag you can use.

I think -J-Xmx512M would also work.

➜  ~ activator -help
Usage: activator <command> [options]

  Command:
  ui                 Start the Activator UI
  new [name] [template-id]  Create a new project with [name] using template [template-id]
  list-templates     Print all available template names
  -h | -help         Print this message

  Options:
  -v | -verbose      Make this runner chattier
  -d | -debug        Set sbt log level to debug
  -mem <integer>     Set memory options (default: , which is -Xms1024m -Xmx1024m -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=256m)
  -jvm-debug <port>  Turn on JVM debugging, open at the given port.

  # java version (default: java from PATH, currently java version "1.8.0_25")
  -java-home <path>  Alternate JAVA_HOME

  # jvm options and output control
  -Dkey=val          Pass -Dkey=val directly to the java runtime
  -J-X               Pass option -X directly to the java runtime
                     (-J is stripped)

  # environment variables (read from context)
  JAVA_OPTS          Environment variable, if unset uses ""
  SBT_OPTS           Environment variable, if unset uses ""
  ACTIVATOR_OPTS     Environment variable, if unset uses ""

In the case of duplicated or conflicting options, the order above
shows precedence: environment variables lowest, command line options highest.
Jacek Laskowski
  • 64,943
  • 20
  • 207
  • 364
Havoc P
  • 8,101
  • 1
  • 28
  • 45
  • 2
    Version 1.3.2 of activator on windows is ignoring `-help` and `-J` options (`help` without dash works), even `JAVA_OPTS` are silently ignored :(. – monnef Apr 24 '15 at 18:08