java.lang.OutOfMemoryError: GC overhead limit exceeded on Scala

青春壹個敷衍的年華 提交于 2020-01-02 07:42:11

问题


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?

Editor: Eclipse

Thanks By, B.UdayaKumar


回答1:


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:

  • 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

For more options on GC tuning refer Concurrent Mark Sweep

Increasing the HEAP size should fix your routes limit problem.



来源:https://stackoverflow.com/questions/36570239/java-lang-outofmemoryerror-gc-overhead-limit-exceeded-on-scala

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!