sbt 堆大小不够?

发布于 2024-11-09 23:51:52 字数 4440 浏览 5 评论 0原文

当我尝试编译 scalala 时,我得到一个 OutOfMemoryError:

> compile
[info] 
[info] == compile ==
[info]   Source analysis: 127 new/modified, 0 indirectly invalidated, 0 removed.
[info] Compiling main sources...
[info] == compile ==
java.lang.OutOfMemoryError: Java heap space
    at scala.Tuple2$Zipped.map(Tuple2.scala:63)
    at scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:3134)
    at scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:3024)
    at scala.tools.nsc.symtab.Types$SubstMap.apply(Types.scala:3455)
    at scala.tools.nsc.symtab.Types$Type.subst(Types.scala:580)
    at scala.tools.nsc.symtab.Types$Type.instantiateTypeParams(Types.scala:421)
    at scala.tools.nsc.typechecker.Infer$Inferencer.exprTypeArgs(Infer.scala:449)
    at scala.tools.nsc.typechecker.Infer$Inferencer.inferExprInstance(Infer.scala:1103)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:738)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:732)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit1(Implicits.scala:484)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:449)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$$typedImplicit(Implicits.scala:376)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.tryImplicitInfo$1(Implicits.scala:668)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.rankImplicits(Implicits.scala:671)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.findBest(Implicits.scala:695)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:753)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.implicitManifestOrOfExpectedType(Implicits.scala:1069)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1096)
    at scala.tools.nsc.typechecker.Implicits$class.inferImplicit(Implicits.scala:57)
    at scala.tools.nsc.Global$analyzer$.inferImplicit(Global.scala:347)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$applyImplicitArgs$1.apply(Typers.scala:120)
    at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$applyImplicitArgs$1.apply(Typers.scala:115)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at scala.tools.nsc.typechecker.Typers$Typer.applyImplicitArgs(Typers.scala:115)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:760)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:732)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit1(Implicits.scala:484)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:449)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$$typedImplicit(Implicits.scala:376)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.tryImplicitInfo$1(Implicits.scala:668)
Error during sbt execution: java.lang.OutOfMemoryError: Java heap space
Exception in thread "Poller SunPKCS11-Darwin" java.lang.OutOfMemoryError: Java heap space
    at sun.security.pkcs11.wrapper.PKCS11.C_GetSlotInfo(Native Method)
    at sun.security.pkcs11.SunPKCS11.initToken(SunPKCS11.java:767)
    at sun.security.pkcs11.SunPKCS11.access$100(SunPKCS11.java:42)
    at sun.security.pkcs11.SunPKCS11$TokenPoller.run(SunPKCS11.java:700)
    at java.lang.Thread.run(Thread.java:680)

{/Users/axaluss/LIBRARIES/scalala-Scalala-f2876c8/scalala-Scalala-f2876c8}
###[ axaluss ]: 

我对 SBT 不太了解,所以我不知道我做错了什么。 sbt文件我改为:

java $SBT_OPTS -Dfile.encoding=UTF-8 -Xss4M -Xmx1024M -XX:MaxPermSize=1024M -XX:NewSize=512M -XX:NewRatio=3 -jar `dirname $0`/project/sbt-launch-0.7.5.jar "$@"

Build.properties:

#Project properties
#Mon Apr 11 02:52:55 PDT 2011
project.organization=org.scalala
project.name=scalala
sbt.version=0.7.4
project.version=1.0.0.RC2-SNAPSHOT
def.scala.version=2.9.0
build.scala.versions=2.9.0
project.initialize=false

编译scala 2.8.1时出现同样的问题。

我怎样才能编译scala?

感谢您的帮助!

When i try to compile scalala i get a OutOfMemoryError:

> compile
[info] 
[info] == compile ==
[info]   Source analysis: 127 new/modified, 0 indirectly invalidated, 0 removed.
[info] Compiling main sources...
[info] == compile ==
java.lang.OutOfMemoryError: Java heap space
    at scala.Tuple2$Zipped.map(Tuple2.scala:63)
    at scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:3134)
    at scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:3024)
    at scala.tools.nsc.symtab.Types$SubstMap.apply(Types.scala:3455)
    at scala.tools.nsc.symtab.Types$Type.subst(Types.scala:580)
    at scala.tools.nsc.symtab.Types$Type.instantiateTypeParams(Types.scala:421)
    at scala.tools.nsc.typechecker.Infer$Inferencer.exprTypeArgs(Infer.scala:449)
    at scala.tools.nsc.typechecker.Infer$Inferencer.inferExprInstance(Infer.scala:1103)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:738)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:732)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit1(Implicits.scala:484)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:449)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$typedImplicit(Implicits.scala:376)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.tryImplicitInfo$1(Implicits.scala:668)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.rankImplicits(Implicits.scala:671)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.findBest(Implicits.scala:695)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:753)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.implicitManifestOrOfExpectedType(Implicits.scala:1069)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1096)
    at scala.tools.nsc.typechecker.Implicits$class.inferImplicit(Implicits.scala:57)
    at scala.tools.nsc.Global$analyzer$.inferImplicit(Global.scala:347)
    at scala.tools.nsc.typechecker.Typers$Typer$anonfun$applyImplicitArgs$1.apply(Typers.scala:120)
    at scala.tools.nsc.typechecker.Typers$Typer$anonfun$applyImplicitArgs$1.apply(Typers.scala:115)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at scala.tools.nsc.typechecker.Typers$Typer.applyImplicitArgs(Typers.scala:115)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:760)
    at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:732)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit1(Implicits.scala:484)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:449)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$typedImplicit(Implicits.scala:376)
    at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.tryImplicitInfo$1(Implicits.scala:668)
Error during sbt execution: java.lang.OutOfMemoryError: Java heap space
Exception in thread "Poller SunPKCS11-Darwin" java.lang.OutOfMemoryError: Java heap space
    at sun.security.pkcs11.wrapper.PKCS11.C_GetSlotInfo(Native Method)
    at sun.security.pkcs11.SunPKCS11.initToken(SunPKCS11.java:767)
    at sun.security.pkcs11.SunPKCS11.access$100(SunPKCS11.java:42)
    at sun.security.pkcs11.SunPKCS11$TokenPoller.run(SunPKCS11.java:700)
    at java.lang.Thread.run(Thread.java:680)

{/Users/axaluss/LIBRARIES/scalala-Scalala-f2876c8/scalala-Scalala-f2876c8}
###[ axaluss ]: 

I dont know much about SBT so I dont know what I am doing wrong.
The sbt file I changed to:

java $SBT_OPTS -Dfile.encoding=UTF-8 -Xss4M -Xmx1024M -XX:MaxPermSize=1024M -XX:NewSize=512M -XX:NewRatio=3 -jar `dirname $0`/project/sbt-launch-0.7.5.jar "$@"

Build.properties:

#Project properties
#Mon Apr 11 02:52:55 PDT 2011
project.organization=org.scalala
project.name=scalala
sbt.version=0.7.4
project.version=1.0.0.RC2-SNAPSHOT
def.scala.version=2.9.0
build.scala.versions=2.9.0
project.initialize=false

The same problem occured when compiling for scala 2.8.1.

How can I manage to compile scalala?

Thanks for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

弃爱 2024-11-16 23:51:52

尝试稍微增加堆大小,在 sbt put 中:

-Xmx1524M

Try to increase heap size a bit, in sbt put:

-Xmx1524M
阳光的暖冬 2024-11-16 23:51:52

sbt命令可以读取JAVA_OPTS或SBT_OPTS环境变量。您可以尝试:

$ JAVA_OPTS=-Xmx1524M

如果这不起作用,并且您在基于 Linux 的操作系统上使用 OpenJDK,那么您也可以尝试以下操作:

# echo 1 > /proc/sys/vm/overcommit_memory

sbt command can read JAVA_OPTS or SBT_OPTS environment variable. Co you can try:

$ JAVA_OPTS=-Xmx1524M

If that doesn't work and you are using OpenJDK on a Linux based OS, then you can also try this:

# echo 1 > /proc/sys/vm/overcommit_memory
笑,眼淚并存 2024-11-16 23:51:52

仅设置 SBT_OPTS 可能不起作用,因为 JAVA_OPTS 出现在这些之后,并且至少我的 java 版本“1.7.0_80” 使用最后一个标志来设置堆大小。

Just setting SBT_OPTS may not work as the JAVA_OPTS appear after those and at least my java version "1.7.0_80" uses the last flag to set the heapsize.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文