Question

I am using H2 DB in in-memory mode to process some data. My java application needs to keep the JVM on while dropping and re-creating or truncating or dropping all objects in H2 DB in each run. Therefore I need to use the option 'DB_CLOSE_DELAY=-1' in the DB URL.

To clean the memory after an iteration I tried using 'DROP ALL OBJECTS', 'DROP ALL OBJECTS DELETE FILES' and Truncated each table one by one. All of these achieved what I wanted by didn't delete the memory that was currently occupied by it. My database size varies from about 300MB to 2GB. Therefore after a single iteration my RAM is about 1GB occupied and did not find any solution as to what the cause of this or the resolution.

Somewhat similar to this Clear the in memory database after every testcase. But without the dbUnit and need to clear the RAM too.

Is it possible to do this without stopping the JVM.

Thanks.

Était-ce utile?

La solution

You could execute the statement shutdown. This will close the connection and the database.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top