Hi, What database URL do you use? How many tables and other database objects (triggers, sequences, columns,...) do you use? From the memory dump the following line is interesting: org.h2.index.TreeNode 107,219,552 bytes. The class TreeNode is used for in-memory indexes. The in-memory index is used for in-memory databases (jdbc:h2:mem: or jdbc:h2:.) as well as for database objects in persistent databases.
If you use an in-memory database, then the memory usage should be linear to the size of the database. To find out if this is the case, run the statement SCRIPT TO 'test.sql'. The size of this script file reflects the database size. Regards, Thomas On Fri, Sep 5, 2008 at 4:23 PM, chandra <[EMAIL PROTECTED]> wrote: > > We have application which uses in memory H2 database. We sync the data > from other database periodically (once in 30 min) and maintain the > state in memory. The problem was memory was ballooning for every sync > operation. I profiled with JProbe and 8 out of top 10 objects belong > to H2 only > > ------------------------------------------------------------------------------------------------------------- > Operation: Object count > Heap(MB) H2 db growth > --------------------------------------------------------------------------------------------------------------- > First sync 2684561 > 122 78% > Second sync 5417943 > 229 88% > Third sync 7750458 > 346 87% > --------------------------------------------------------------------------------------------------------------- > > The run time object counts are. > > > --------------------------------------------------------------------------------------------------- > Name Heap Count Heap Memory (Bytes) > -------------------------------------------------------------------------------------------------- > org.h2.index.TreeNode 3,350,611 107,219,552 > org.h2.result.Row 1,298,462 83,101,568 > org.h2.value.Value [ ] 1,126,162 70,576,392 > org.h2.value.ValueInt 850,294 13,604,704 > char [ ] 237,093 26,776,296 > java.lang.String 236,211 5,669,064 > java.util.HashMap$Entry 168,079 4,033,896 > org.h2.value.ValueString 104,935 1,678,960 > org.h2.value.ValueLong 70,135 1,122,160 > org.h2.log.UndoLogRecord 69,795 1,675,080 > java.lang.ref.WeakReference 54,223 1,301,352 > java.lang.ref.SoftReference 41,688 1,334,016 > org.h2.index.TreeCursor 37,198 1,190,336 > > I also used the H2 Function MEMORY_USED which calls collectGarbage() > internally. That didn't help either. Any ideas will be appreciated to > reduce the memory footprint. > > Thanks, > Chandra. > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
