java.lang.OutOfMemoryError: Java heap space

JIRA | Haakon Nilsen | 4 years ago
  1. 0

    Hi, It appears that I'm seeing the same problem as this guy from 2011: https://groups.google.com/forum/?fromgroups=#!topic/mongodb-casbah-users/NQB9TvKVScA scala> val col = MongoClient()("dbname")("large_collection") java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2367) at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130) at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114) at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:415) at java.lang.StringBuilder.append(StringBuilder.java:132) at scala.collection.mutable.StringBuilder.append(StringBuilder.scala:197) at scala.collection.TraversableOnce$$anonfun$addString$1.apply(TraversableOnce.scala:327) at scala.collection.Iterator$class.foreach(Iterator.scala:727) at com.mongodb.casbah.MongoCursor.foreach(MongoCursor.scala:494) at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) at com.mongodb.casbah.MongoCollection.foreach(MongoCollection.scala:847) at scala.collection.TraversableOnce$class.addString(TraversableOnce.scala:320) at com.mongodb.casbah.MongoCollection.addString(MongoCollection.scala:847) at scala.collection.TraversableOnce$class.mkString(TraversableOnce.scala:286) at com.mongodb.casbah.MongoCollection.mkString(MongoCollection.scala:847) at scala.collection.TraversableLike$class.toString(TraversableLike.scala:639) at com.mongodb.casbah.MongoCollection.toString(MongoCollection.scala:847) at scala.runtime.ScalaRunTime$.scala$runtime$ScalaRunTime$$inner$1(ScalaRunTime.scala:321) at scala.runtime.ScalaRunTime$.stringOf(ScalaRunTime.scala:333) at scala.runtime.ScalaRunTime$.replStringOf(ScalaRunTime.scala:341) at .<init>(<console>:10) at .<clinit>(<console>) at $print(<console>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:734) at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:983) at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:573) at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:604) at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:568) (My "large" collection has around 20 million entries) This means that you must be careful to never invoke toString on MongoCollection, which makes things very hard in the Scala REPL.

    JIRA | 4 years ago | Haakon Nilsen
    java.lang.OutOfMemoryError: Java heap space
  2. 0

    Hi, It appears that I'm seeing the same problem as this guy from 2011: https://groups.google.com/forum/?fromgroups=#!topic/mongodb-casbah-users/NQB9TvKVScA scala> val col = MongoClient()("dbname")("large_collection") java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2367) at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130) at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114) at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:415) at java.lang.StringBuilder.append(StringBuilder.java:132) at scala.collection.mutable.StringBuilder.append(StringBuilder.scala:197) at scala.collection.TraversableOnce$$anonfun$addString$1.apply(TraversableOnce.scala:327) at scala.collection.Iterator$class.foreach(Iterator.scala:727) at com.mongodb.casbah.MongoCursor.foreach(MongoCursor.scala:494) at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) at com.mongodb.casbah.MongoCollection.foreach(MongoCollection.scala:847) at scala.collection.TraversableOnce$class.addString(TraversableOnce.scala:320) at com.mongodb.casbah.MongoCollection.addString(MongoCollection.scala:847) at scala.collection.TraversableOnce$class.mkString(TraversableOnce.scala:286) at com.mongodb.casbah.MongoCollection.mkString(MongoCollection.scala:847) at scala.collection.TraversableLike$class.toString(TraversableLike.scala:639) at com.mongodb.casbah.MongoCollection.toString(MongoCollection.scala:847) at scala.runtime.ScalaRunTime$.scala$runtime$ScalaRunTime$$inner$1(ScalaRunTime.scala:321) at scala.runtime.ScalaRunTime$.stringOf(ScalaRunTime.scala:333) at scala.runtime.ScalaRunTime$.replStringOf(ScalaRunTime.scala:341) at .<init>(<console>:10) at .<clinit>(<console>) at $print(<console>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:734) at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:983) at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:573) at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:604) at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:568) (My "large" collection has around 20 million entries) This means that you must be careful to never invoke toString on MongoCollection, which makes things very hard in the Scala REPL.

    JIRA | 4 years ago | Haakon Nilsen
    java.lang.OutOfMemoryError: Java heap space
  3. 0

    Report generation OOME

    GitHub | 2 years ago | isavin
    java.lang.OutOfMemoryError: Java heap space
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Infinite loop after hard shutdown

    GitHub | 3 years ago | carsonfenimore
    java.lang.OutOfMemoryError: Java heap space
  6. 0

    How to deal with reading and processing huge text files without getting OutofMemoryError

    Stack Overflow | 4 years ago | myX.
    java.lang.OutOfMemoryError: Java heap space

  1. Handemelindo 2 times, last 1 month ago
  2. Tahir 2 times, last 2 months ago
  3. Tahir 2 times, last 2 months ago
  4. harshg 2 times, last 3 months ago
  5. sunils 1 times, last 5 months ago
3 more registered users
16 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

    Java heap space

    at java.util.Arrays.copyOf()
  2. Java RT
    StringBuilder.append
    1. java.util.Arrays.copyOf(Arrays.java:2367)
    2. java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
    3. java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
    4. java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:415)
    5. java.lang.StringBuilder.append(StringBuilder.java:132)
    5 frames
  3. Scala
    Iterator$class.foreach
    1. scala.collection.mutable.StringBuilder.append(StringBuilder.scala:197)
    2. scala.collection.TraversableOnce$$anonfun$addString$1.apply(TraversableOnce.scala:327)
    3. scala.collection.Iterator$class.foreach(Iterator.scala:727)
    3 frames
  4. casbah-core
    MongoCursor.foreach
    1. com.mongodb.casbah.MongoCursor.foreach(MongoCursor.scala:494)
    1 frame
  5. Scala
    IterableLike$class.foreach
    1. scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
    1 frame
  6. casbah-core
    MongoCollection.foreach
    1. com.mongodb.casbah.MongoCollection.foreach(MongoCollection.scala:847)
    1 frame
  7. Scala
    TraversableOnce$class.addString
    1. scala.collection.TraversableOnce$class.addString(TraversableOnce.scala:320)
    1 frame
  8. casbah-core
    MongoCollection.addString
    1. com.mongodb.casbah.MongoCollection.addString(MongoCollection.scala:847)
    1 frame
  9. Scala
    TraversableOnce$class.mkString
    1. scala.collection.TraversableOnce$class.mkString(TraversableOnce.scala:286)
    1 frame
  10. casbah-core
    MongoCollection.mkString
    1. com.mongodb.casbah.MongoCollection.mkString(MongoCollection.scala:847)
    1 frame
  11. Scala
    TraversableLike$class.toString
    1. scala.collection.TraversableLike$class.toString(TraversableLike.scala:639)
    1 frame
  12. casbah-core
    MongoCollection.toString
    1. com.mongodb.casbah.MongoCollection.toString(MongoCollection.scala:847)
    1 frame
  13. Scala
    ScalaRunTime$.replStringOf
    1. scala.runtime.ScalaRunTime$.scala$runtime$ScalaRunTime$$inner$1(ScalaRunTime.scala:321)
    2. scala.runtime.ScalaRunTime$.stringOf(ScalaRunTime.scala:333)
    3. scala.runtime.ScalaRunTime$.replStringOf(ScalaRunTime.scala:341)
    3 frames