I tried that, but i had the bug anyway.
I tried your option again, using commandline, netbeans's VM options, ... anywhere i could and it failed each time. (see end of the mail for the stack trace so you can compare with yours, just in case...)
I added this line:
System.err.println("size:"+System.getProperty("derby.storage.pageCacheSize"));
right before the class.forName() of the source i provided. I see the right value printed, so it seems obvious that i am really setting that value correctly.

Side note about the end of your response. I expected your cache, just as any cache, to reference cached data using a java.lang.ref.SotfRererence. Is there something i do not see that did prevent their use? At least, it would have reduced the OOME to the inevitable case when everything referenced cannot be freed.

----------------------------------------------------------------------------------------
Exception in thread "main" java.sql.SQLException: Exception Java : 'Java heap space: java.lang.OutOfMemoryError'. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
       at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown Source)
       at org.apache.OomeTest.main(OomeTest.java:82)
Caused by: java.sql.SQLException: Exception Java : 'Java heap space: java.lang.OutOfMemoryError'. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
       ... 12 more
----------------------------------------------------------------------------------------



Anders Morken a écrit :
By reducing the size of the page cache (by adding
-Dderby.storage.pageCacheSize=100 to the java command line - 100 pages
in the cache, rather than the default 1000) I ran 1659 iterations of
that block, so maybe that'll work for you as well. The database ended up
about 9,4 gigabytes large.

I didn't put any particular thought into that page cache size, I just
picked a small number to see if it worked. You should size the page
cache yourself until it fits into your particular application and java
heap limit, and the out of memory errors will probably go away. =)

. o O ( auto-sizing the page cache based on the available heap size
might be useful - if we can find some way to do it that interacts sanely
with the application's memory requirements)


Reply via email to