Hi,
I had a closer look and it has saved the cache size I set when last
accessing the database to the script (not what I used to for the SCRIPT
TO command, but what I use for the application which usually connects to
the database)... this would account for the large amount of memory on
runscript. Would this also be the case for SCRIPT TO, that it is picking
up the cache size from the last time I connected? maybe I should
explicitly set the cache size to something lower on the connection for
SCRIPT TO?
If that isn't the issue I'll send the script along.
Cheers,
Ryan
Thomas Mueller wrote:
Hi,
It looks like H2 now needs more heap space than it used to, specially
when creating tables. I will have to fix the memory usage methods.
Could you send me the backup_script.ZIP?
Regards,
Thomas
On Fri, Feb 5, 2010 at 4:17 AM, Ryan How <[email protected]> wrote:
Hi,
I've switched over to the new page store, version 1.2.128. I haven't done
tests, but a lot of things appear to be faster than before which is nice
(and database size is much smaller!!)
Anyway, my issue is related to the SCRIPT TO command. I am running out of
heap space and it seems to use a lot of memory.
This is my code.
Class.forName("org.h2.Driver");
Connection conn =
DriverManager.getConnection("jdbc:h2:file:db/db", "sa", "sa");
Statement s = conn.createStatement();
s.execute("SCRIPT DROP TO 'backup/backup_script.ZIP' COMPRESSION
ZIP");
conn.close();
I'm executing it with
java -Xmx256m -classpath "h2.jar;" utils.ScriptDb
and this is the stack trace
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
at java.lang.AbstractStringBuilder.append(Unknown Source)
at java.lang.StringBuilder.append(Unknown Source)
at org.h2.command.dml.ScriptCommand.add(ScriptCommand.java:532)
at org.h2.command.dml.ScriptCommand.query(ScriptCommand.java:270)
at org.h2.command.CommandContainer.query(CommandContainer.java:81)
at org.h2.command.Command.executeQuery(Command.java:132)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:172)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:151)
at utils.ScriptDb.main(ScriptDb.java:31)
And my database is 208MB in size, containing 2 tables.
I can just increase the heap size, but it seems like a LOT just to dump the
database. I expected it would have taken a few MB if that...
And when this database grows to a few GB, I don't think the heap will go
that big :)
Am I missing anything?
Cheers,
Ryan
--
You received this message because you are subscribed to the Google Groups
"H2 Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.