java.lang.OutOfMemoryError: unable to create new native thread

Scala JIRA | eugene | 2 years ago
  1. 0

    [SI-8937] java.lang.OutOfMemoryError: unable to create new native thread when use actor - Scala

    scala-lang.org | 1 year ago
    java.lang.OutOfMemoryError: unable to create new native thread
  2. 0

    {noformat} java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) at java.lang.Thread.start(Thread.java:597) at scala.concurrent.forkjoin.ForkJoinPool.createAndStartAddedWorkers(ForkJoinPool.java:524) at scala.concurrent.forkjoin.ForkJoinPool.setParallelism(ForkJoinPool.java:749) at scala.actors.scheduler.ForkJoinScheduler.makeNewPool(ForkJoinScheduler.scala:44) at scala.actors.scheduler.ForkJoinScheduler.<init>(ForkJoinScheduler.scala:15) at scala.actors.scheduler.ForkJoinScheduler.<init>(ForkJoinScheduler.scala:29) at scala.actors.scheduler.ForkJoinScheduler.<init>(ForkJoinScheduler.scala:33) at scala.actors.scheduler.ForkJoinScheduler.<init>(ForkJoinScheduler.scala:37) at scala.actors.Scheduler$.makeNewScheduler(Scheduler.scala:33) at scala.actors.scheduler.DelegatingScheduler$class.newActor(DelegatingScheduler.scala:63) at scala.actors.Scheduler$.newActor(Scheduler.scala:21) at scala.actors.Reactor$class.dostart(Reactor.scala:221) at scala.actors.Actor$$anon$1.scala$actors$Actor$$super$dostart(Actor.scala:132) at scala.actors.Actor$class.dostart(Actor.scala:709) at scala.actors.Actor$$anon$1.dostart(Actor.scala:132) at scala.actors.Reactor$class.start(Reactor.scala:230) at scala.actors.Actor$$anon$1.scala$actors$Actor$$super$start(Actor.scala:132) at scala.actors.Actor$class.start(Actor.scala:713) at scala.actors.Actor$$anon$1.start(Actor.scala:132) at scala.actors.Actor$.actor(Actor.scala:136) at Main$$anon$1$$anonfun$isPerfectConcurrent$1.apply(testActor.scala:18) at Main$$anon$1$$anonfun$isPerfectConcurrent$1.apply(testActor.scala:14) at scala.collection.immutable.Range.foreach(Range.scala:81) at Main$$anon$1.isPerfectConcurrent(testActor.scala:14) at Main$$anon$1.<init>(testActor.scala:32) at Main$.main(testActor.scala:1) at Main.main(testActor.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:78) at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:24) at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:88) at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:78) at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:101) at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:33) at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:40) at scala.tools.nsc.ScriptRunner.scala$tools$nsc$ScriptRunner$$runCompiled(ScriptRunner.scala:171) at scala.tools.nsc.ScriptRunner$$anonfun$runScript$1.apply(ScriptRunner.scala:188) at scala.tools.nsc.ScriptRunner$$anonfun$runScript$1.apply(ScriptRunner.scala:188) at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply$mcZ$sp(ScriptRunner.scala:157) at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply(ScriptRunner.scala:131) at scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply(ScriptRunner.scala:131) at scala.tools.nsc.util.package$.waitingForThreads(package.scala:26) at scala.tools.nsc.ScriptRunner.withCompiledScript(ScriptRunner.scala:130) at scala.tools.nsc.ScriptRunner.runScript(ScriptRunner.scala:188) at scala.tools.nsc.ScriptRunner.runScriptAndCatch(ScriptRunner.scala:201) at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:58) at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:80) at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89) at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala) {noformat} and my codes´╝Ü {code} def sumOfFactorsInRange(lower: Int, upper: Int, number: Int) = { (0 /: (lower to upper)) { (sum, i) => if (number % i == 0) sum + i else sum } } def isPerfectConcurrent(candidate: Int) = { val RANGE = 100000 val numberOfPartitions = (candidate.toDouble / RANGE).ceil.toInt val caller = self for (i <- 0 until numberOfPartitions) { val lower = i * RANGE + 1 val upper = candidate min (i + 1) * RANGE actor { caller ! sumOfFactorsInRange(lower, upper, candidate) } } val sum = (0 /: (0 until numberOfPartitions)) { (partialSum, i) => receive { case sumInRange: Int => partialSum + sumInRange } } 2 * candidate == sum } println("6 is perfect? " + isPerfectConcurrent(6)) {code}

    Scala JIRA | 2 years ago | eugene
    java.lang.OutOfMemoryError: unable to create new native thread
  3. 0

    How many threads can a Java VM support in Linux?

    Stack Overflow | 6 years ago | user500796
    java.lang.OutOfMemoryError: unable to create new native thread
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hibernate+Ehcache update breaks test suite

    Stack Overflow | 6 years ago | seminolas
    java.lang.OutOfMemoryError: unable to create new native thread
  6. 0

    How to set native memory in JAVA

    Stack Overflow | 4 years ago | Jabir
    java.lang.OutOfMemoryError: unable to create new native thread

  1. Reich 4 times, last 2 weeks ago
  2. Ajeet 46 times, last 4 months ago
  3. Diogo Jaym 1 times, last 5 months ago
  4. brunosatriani 2 times, last 6 months ago
  5. Bardh 4 times, last 7 months ago
1 more registered users
29 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.OutOfMemoryError

    unable to create new native thread

    at java.lang.Thread.start0()
  2. Java RT
    Thread.start
    1. java.lang.Thread.start0(Native Method)
    2. java.lang.Thread.start(Thread.java:597)
    2 frames
  3. Scala
    ForkJoinPool.setParallelism
    1. scala.concurrent.forkjoin.ForkJoinPool.createAndStartAddedWorkers(ForkJoinPool.java:524)
    2. scala.concurrent.forkjoin.ForkJoinPool.setParallelism(ForkJoinPool.java:749)
    2 frames
  4. Scala Actors library
    Actor$.actor
    1. scala.actors.scheduler.ForkJoinScheduler.makeNewPool(ForkJoinScheduler.scala:44)
    2. scala.actors.scheduler.ForkJoinScheduler.<init>(ForkJoinScheduler.scala:15)
    3. scala.actors.scheduler.ForkJoinScheduler.<init>(ForkJoinScheduler.scala:29)
    4. scala.actors.scheduler.ForkJoinScheduler.<init>(ForkJoinScheduler.scala:33)
    5. scala.actors.scheduler.ForkJoinScheduler.<init>(ForkJoinScheduler.scala:37)
    6. scala.actors.Scheduler$.makeNewScheduler(Scheduler.scala:33)
    7. scala.actors.scheduler.DelegatingScheduler$class.newActor(DelegatingScheduler.scala:63)
    8. scala.actors.Scheduler$.newActor(Scheduler.scala:21)
    9. scala.actors.Reactor$class.dostart(Reactor.scala:221)
    10. scala.actors.Actor$$anon$1.scala$actors$Actor$$super$dostart(Actor.scala:132)
    11. scala.actors.Actor$class.dostart(Actor.scala:709)
    12. scala.actors.Actor$$anon$1.dostart(Actor.scala:132)
    13. scala.actors.Reactor$class.start(Reactor.scala:230)
    14. scala.actors.Actor$$anon$1.scala$actors$Actor$$super$start(Actor.scala:132)
    15. scala.actors.Actor$class.start(Actor.scala:713)
    16. scala.actors.Actor$$anon$1.start(Actor.scala:132)
    17. scala.actors.Actor$.actor(Actor.scala:136)
    17 frames
  5. Unknown
    Main$$anon$1$$anonfun$isPerfectConcurrent$1.apply
    1. Main$$anon$1$$anonfun$isPerfectConcurrent$1.apply(testActor.scala:18)
    2. Main$$anon$1$$anonfun$isPerfectConcurrent$1.apply(testActor.scala:14)
    2 frames
  6. Scala
    Range.foreach
    1. scala.collection.immutable.Range.foreach(Range.scala:81)
    1 frame
  7. Unknown
    Main.main
    1. Main$$anon$1.isPerfectConcurrent(testActor.scala:14)
    2. Main$$anon$1.<init>(testActor.scala:32)
    3. Main$.main(testActor.scala:1)
    4. Main.main(testActor.scala)
    4 frames
  8. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    4. java.lang.reflect.Method.invoke(Method.java:597)
    4 frames
  9. Scala Compiler
    MainGenericRunner.main
    1. scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:78)
    2. scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:24)
    3. scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:88)
    4. scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:78)
    5. scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:101)
    6. scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:33)
    7. scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:40)
    8. scala.tools.nsc.ScriptRunner.scala$tools$nsc$ScriptRunner$$runCompiled(ScriptRunner.scala:171)
    9. scala.tools.nsc.ScriptRunner$$anonfun$runScript$1.apply(ScriptRunner.scala:188)
    10. scala.tools.nsc.ScriptRunner$$anonfun$runScript$1.apply(ScriptRunner.scala:188)
    11. scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply$mcZ$sp(ScriptRunner.scala:157)
    12. scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply(ScriptRunner.scala:131)
    13. scala.tools.nsc.ScriptRunner$$anonfun$withCompiledScript$1.apply(ScriptRunner.scala:131)
    14. scala.tools.nsc.util.package$.waitingForThreads(package.scala:26)
    15. scala.tools.nsc.ScriptRunner.withCompiledScript(ScriptRunner.scala:130)
    16. scala.tools.nsc.ScriptRunner.runScript(ScriptRunner.scala:188)
    17. scala.tools.nsc.ScriptRunner.runScriptAndCatch(ScriptRunner.scala:201)
    18. scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:58)
    19. scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:80)
    20. scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89)
    21. scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
    21 frames