Migration from a problem with HSQL DB 1.8 to 2.x

I recently migrated HQLDB from 1.8 to 2.x, and after that my integration test (in memory) started using too much memory. Increasing memory to 6 GB makes the test faster, but at some point it can be frozen.

I have properties shutdown = true; when adding url parameters hsqldb.write_delay = false will not make any difference.

Before the update, it worked without problems. I cannot find any clues in the migration guide http://hsqldb.org/web/hsqlFAQ.html

+6
source share
2 answers

There is currently no memory leak in HSQLDB. When you use the memory database, you need to get rid of the data that you inserted into the database during the tests. It seems that the data is not published in your application.

The easiest way to ensure that all tables and their data are output in a schema:

DROP SCHEMA schemaname CASCADE 

or alternatively SHUTDOWN databases after a series of tests:

 SHUTDOWN 

Follow the instructions above with your schema name after completing some tests to release all the data.

The main thing that has changed since version 1.8.0 is transaction support. Hibernate treats new versions differently. So you need to check if any connection remains open or not, so SHUTDOWN is executed when the last connection is closed.

+2
source

If you just changed the HSQLDB version and it started to give memory problems, then this is a memory leak error.

Switch to HSQLDB version 2.3.1 , because after 2.0 errors were fixed regarding memory leaks, see the list of changes from 2.0 here , one of the error fixes says:

fixed issue causing slow speed and memory leak with disk result sets

Reduce memory consumption with HSQLDB:

Creating tables using this syntax will accurately reduce memory consumption, since such tables exist on disk, and only part of them are loaded into memory:

 CREATE CACHED TABLE YOUR_TABLE_NAME 

Confirm HSQLDB problem:

You can always use a memory profile to confirm the cause of high memory consumption using Visual VM . This is a tool that is already installed with the JDK and can be run through the command line using the jvisualvm .

Check out the 6-minute instructional video to find out how it can help fix memory problems.

+3
source

All Articles