Note that there are some explanatory texts on larger screens.

plurals
  1. POMemory leaks when recreating Squeryl in-memory database
    text
    copied!<p>I'm writing a simple Scala &amp; Squeryl application. For test purposes, each time I run 'test' in sbt, an in-memory H2 db is created and populated with test data. After each run I can see that memory usage of java.exe (inside which sbt is running) in the Task Manager increases until after 4 or 5 runs it crashes with OutOfMemoryError. Am I missing something that explicitly releases memory used by H2 or Squeryl? By now, I use only <code>Session.create</code> and then <code>Persistence.create</code>. Here is an excerpt from my code:</p> <pre><code>object Persistence extends Schema { val documents = table[IncomeEntity] val positions = table[Position] val documentToPositions = oneToManyRelation(documents, positions).via(_.id === _.id_income) } class PersistenceTests extends FunSuite with BeforeAndAfterAll { override protected def beforeAll() { Class.forName("org.h2.Driver") SessionFactory.concreteFactory = Some( () =&gt; Session.create(DriverManager.getConnection("jdbc:h2:mem:test"), new H2Adapter) ) } test("DDL") { transaction { Persistence.create assert(Persistence.documents.size == 0) assert(Persistence.positions.size == 0) } } test("Insert") { transaction { Persistence.create (1 to 100) map { _ =&gt; IncomeMapper.save(new Income) } assert(Persistence.documents.size == 100) } } } </code></pre> <p>The messages I get are simply the following:</p> <pre><code>[info] PersistenceTests: sbt appears to be exiting abnormally. The log file for this session is at C:\Users\Oleg\AppData\Local\Temp\sbt7320472784033855835.log java.lang.OutOfMemoryError: PermGen space Error during sbt execution: java.lang.OutOfMemoryError: PermGen space </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload