java.lang.OutOfMemoryError:Scala超出了GC开销限制 [英] java.lang.OutOfMemoryError: GC overhead limit exceeded on Scala

查看:431
本文介绍了java.lang.OutOfMemoryError:Scala超出了GC开销限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Scala开发人员,我在 Routes 文件中收到此错误,如果我添加了在错误下方给出的另一行,则该文件包含 1008行.

I'M Scala developer,I am getting this error in a Routes file it contains 1008 lines if I add another Line that's throw given below error..

Uncaught error from thread [sbt-web-scheduler-1] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[sbt-web]
java.lang.OutOfMemoryError: GC overhead limit exceeded
        at java.util.jar.Manifest$FastInputStream.<init>(Unknown Source)
        at java.util.jar.Manifest$FastInputStream.<init>(Unknown Source)
        at java.util.jar.Manifest.read(Unknown Source)
        at java.util.jar.Manifest.<init>(Unknown Source)
        at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
        at java.util.jar.JarFile.getManifest(Unknown Source)
        at sun.misc.URLClassPath$JarLoader$2.getManifest(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
[ERROR] [04/12/2016 15:17:32.883] [sbt-web-scheduler-1] [ActorSystem(sbt-web)] exception on LARSÆ timer thread
        at java.net.URLClassLoader.access$100(Unknown Source)
java.lang.OutOfMemoryError: GC overhead limit exceeded
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at akka.actor.LightArrayRevolverScheduler$$anon$8.nextTick(Scheduler.scala:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at akka.actor.LightArrayRevolverScheduler$$anon$8.run(Scheduler.scala:375)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)

        at akka.event.Logging$Info$.apply(Logging.scala:665)
        at akka.event.BusLogging.notifyInfo(Logging.scala:1140)
        at akka.event.LoggingAdapter$class.info(Logging.scala:950)
        at akka.event.BusLogging.info(Logging.scala:1128)
        at akka.actor.LightArrayRevolverScheduler$$anon$8.run(Scheduler.scala:382)
[ERROR] [04/12/2016 15:18:33.808] [sbt-web-scheduler-1] [ActorSystem(sbt-web)] Uncaught error from thread [sbt-web-scheduler-1]         at java.lang.Thread.run(Unknown Source)
shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled
java.lang.OutOfMemoryError: GC overhead limit exceeded
        at java.util.jar.Manifest$FastInputStream.<init>(Unknown Source)
        at java.util.jar.Manifest$FastInputStream.<init>(Unknown Source)
        at java.util.jar.Manifest.read(Unknown Source)
        at java.util.jar.Manifest.<init>(Unknown Source)
        at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
        at java.util.jar.JarFile.getManifest(Unknown Source)
        at sun.misc.URLClassPath$JarLoader$2.getManifest(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)

路线中接受多少行?我该如何解决?

How Many lines accepted in Routes? How can I solve this?

编辑器:Eclipse

Editor: Eclipse

谢谢, 乌达亚·库玛(B.UdayaKumar)

Thanks By, B.UdayaKumar

推荐答案

通常,当没有足够的空间在Java堆中分配对象时,将引发此错误.在这种情况下,垃圾收集器无法提供空间来容纳新对象,并且堆无法进一步扩展.另外,当本机内存不足以支持Java类的加载时,可能会引发此错误.在极少数情况下,如果花费大量时间进行垃圾回收并且释放了很少的内存,则可能抛出java.lang.OutOfMemoryError.

Usually, this error is thrown when there is insufficient space to allocate an object in the Java heap. In this case, The garbage collector cannot make space available to accommodate a new object, and the heap cannot be expanded further. Also, this error may be thrown when there is insufficient native memory to support the loading of a Java class. In a rare instance, a java.lang.OutOfMemoryError may be thrown when an excessive amount of time is being spent doing garbage collection and little memory is being freed.

实际上,您的内存不足以平稳地运行该过程.想到的选项是:

You're essentially running out of memory to run the process smoothly. Options that come to mind are:

  • 使用JAVA_OPTS环境变量指定更多内存,并尝试在-Xmx1G之间进行尝试.
  • 您还可以通过启用-XX:+UseConcMarkSweepGC
  • 手动调整GC.
  • Specify more memory using the JAVA_OPTS enviroment variable, try something in between like -Xmx1G.
  • You can also tune your GC manually by enabling -XX:+UseConcMarkSweepGC

有关GC调整的更多选项,请参考并发标记扫描

For more options on GC tuning refer Concurrent Mark Sweep

增大HEAP大小应该可以解决路由限制问题.

Increasing the HEAP size should fix your routes limit problem.

这篇关于java.lang.OutOfMemoryError:Scala超出了GC开销限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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