Hi,

> I am using 1.0.72 version of H2 and the database is in-memory.

In any case I suggest to use a newer version.

>> As a performance test, I loaded about 125K rows in the tables.  The
>> memory went up 1 GB.  After that I ran a TRUNCATE TABLE command on
>> each of the tables.  I wanted to see if the memory footprint of the
>> server process to come down.  However it still remained the same.

Java doesn't shrink the heap size as far as I know. I don't think this
can be solved in H2.

>> added about half the old data.  The memory increased by another
>> expected 500MB close to 1.5GB from the intial memory footprint.

That's strange, it would mean the original data is still referenced in
memory.  I can't reproduce this, see my test case below.

Regards,
Thomas

Class.forName("org.h2.Driver");
Connection conn;
Statement stat;
conn = DriverManager.getConnection("jdbc:h2:mem:test", "sa", "sa");
stat = conn.createStatement();
for(int j=0; j<10; j++) {
stat.execute("create table test"+j+"(name varchar) as select 'hello '
|| x from system_range(1, 200000)");
Runtime rt = Runtime.getRuntime();
for(int i=0; i<10; i++) rt.gc();
System.out.println("free: " + ((rt.maxMemory()-rt.freeMemory())/1024/1024));
stat.execute("truncate table test" + j);
for(int i=0; i<10; i++) rt.gc();
System.out.println("after drop: " +
((rt.maxMemory()-rt.freeMemory())/1024/1024));
}

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to