The code below dumps a heap with ~86mb cacheChunkRef. If you bump OUTER_LOOP_COUNT to 1,000,000, it dumps a heap with ~469mb cacheChunkRef.
public class MVStoreTest { private static final int OUTER_LOOP_COUNT = 100000; public static void main(String[] args) throws Exception { Connection connection = DriverManager.getConnection("jdbc:h2:~/test;compress=true", "sa", ""); Statement statement = connection.createStatement(); statement.execute("create table xyz (x varchar, y bigint)"); statement.execute("create index xyz_idx on xyz (x, y)"); PreparedStatement preparedStatement = connection.prepareStatement("insert into xyz (x, y) values (?, ?)"); long start = System.currentTimeMillis(); for (int i = 0; i < OUTER_LOOP_COUNT; i++) { for (int j = 0; j < 100; j++) { preparedStatement.setString(1, "x" + j); preparedStatement.setLong(2, i); preparedStatement.addBatch(); } preparedStatement.executeBatch(); if ((i + 1) % 1000 == 0) { long end = System.currentTimeMillis(); System.out.println((i + 1) + " " + (end - start)); start = end; } } ManagementFactory.getPlatformMBeanServer().invoke( ObjectName.getInstance("com.sun.management:type=HotSpotDiagnostic"), "dumpHeap", new Object[] {"heapdump.hprof", true}, new String[] {"java.lang.String", "boolean"}); connection.close(); } } On Wednesday, February 11, 2015 at 10:56:18 PM UTC-8, Thomas Mueller wrote: > > Hi, > > That means the LIRS cache keeps too many non-resident cold entries. I > wonder how to best reproduce this problem... Do you have a simple test case > (a description what you do would be enough in this case)? > > Regards, > Thomas > > On Thu, Feb 12, 2015 at 3:17 AM, Trask Stalnaker <trask.s...@gmail.com > <javascript:>> wrote: > >> Hi, >> >> I was looking over a heap dump and was surprised by MVStore.cacheChunkRef >> consuming 29mb memory. >> >> MVStore.cache is consuming 14mb which makes sense given the 16mb default >> cache limit. >> >> Eclipse MemoryAnalyzer OQL shows 100,000+ >> org.h2.mvstore.cache.CacheLongKeyLIRS$Entry objects with memory = 0 and >> value = null: >> >> select * from org.glowroot.shaded.h2.mvstore.cache.CacheLongKeyLIRS$Entry >> where value = null and memory = 0 >> >> >> Is this memory consumption expected? Is there a concern memory may grow >> unbounded given enough of these objects with memory = 0 since H2 won't >> count them against it's internal memory limit? >> >> Using latest 1.4.185. >> >> Thanks, >> Trask >> >> -- >> You received this message because you are subscribed to the Google Groups >> "H2 Database" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to h2-database...@googlegroups.com <javascript:>. >> To post to this group, send email to h2-da...@googlegroups.com >> <javascript:>. >> Visit this group at http://groups.google.com/group/h2-database. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.