无法设置"sbt start"的内存设置 [英] Can't set memory settings for `sbt start`

查看:214
本文介绍了无法设置"sbt start"的内存设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在用Scala编写的Play Framework应用程序中的AWS上的 ec2 t2.micro 实例的计算机上运行sbt start.但是我不能,因为内存不足,Java Runtime Environment无法继续.

I'm trying to run sbt start in a Play Framework application written in Scala, on a machine that is an ec2 t2.micro instance on AWS. But i can't because There is insufficient memory for the Java Runtime Environment to continue.

该机器具有1GB的内存,但实际上在运行其余OS进程时可以使用930MB的可用内存.它是Ubuntu Server 14.04 LTS.该应用程序小巧可爱.

The machine has 1GB of memory, but in practice 930MB of free memory to use while running the remaining of OS processes. It is Ubuntu Server 14.04 LTS. The app is small, cute.

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000d5550000, 715849728, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 715849728 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /app/incoming/hs_err_pid9709.log

这是指向日志文件的链接信息.

尽管我以多种方式将JVM args设置为其他方式,但在内部却看不到jvm_args: -Xms1024m -Xmx1024m -XX:ReservedCodeCacheSize=128m ....

Inside i see jvm_args: -Xms1024m -Xmx1024m -XX:ReservedCodeCacheSize=128m ... despite i set my JVM args in so many different ways to something else but no effect.

使用这些参数-Xss1m -Xms256m -Xmx512m -XX:+CMSClassUnloadingEnabled我尝试了所有操作:

With these arguments -Xss1m -Xms256m -Xmx512m -XX:+CMSClassUnloadingEnabled I tried everything:

  • 在/usr/share/sbt-launcher-packaging/conf/sbtopts中设置JVM args
  • 与/usr/share/sbt-launcher-packaging/conf/sbtconfig.txt相同
  • 运行时直接提供args:sbt -J-Xss1m -J-Xms256m -J-Xmx512m -J-XX:+CMSClassUnloadingEnabled start
  • 已在build.sbt中设置fork in run := true
  • javaOptions in run += "-Xmx512m -XX:+CMSClassUnloadingEnabled"在build.sbt中
  • setting JVM args in /usr/share/sbt-launcher-packaging/conf/sbtopts
  • same in /usr/share/sbt-launcher-packaging/conf/sbtconfig.txt
  • supplying the args directly when running: sbt -J-Xss1m -J-Xms256m -J-Xmx512m -J-XX:+CMSClassUnloadingEnabled start
  • already set fork in run := true in build.sbt
  • javaOptions in run += "-Xmx512m -XX:+CMSClassUnloadingEnabled" in build.sbt

它们都不起作用.每次我运行该应用程序时,日志中都会出现同样la脚的1024件事.请帮忙.

Neither of them helps. The same lame 1024 things appear in the logs every time i run the app. Please help.

推荐答案

过去,在Linux上也很难为sbt设置jvm内存args(在Windows上,您可以调整sbtconfig.txt,但是在此位置以及所有其他位置可以指定SBT_OPTS,由于某种原因,我发现它无法在Linux上运行.

Also struggled with setting jvm memory args for sbt on Linux in the past (on Windows you can tweak sbtconfig.txt but this and all other places where you can specify SBT_OPTS I could find doesn't work on Linux for some reason).

上次我已经使用sbt本身的-mem <amount>选项解决了这个问题.

Last time I've solved this by using -mem <amount> option of sbt itself.

因此,在您的情况下,您应该尝试执行以下操作:

So, in your case you should try something like this:

$ sbt -mem 512 start

这篇关于无法设置"sbt start"的内存设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆