JPA / HSQLDB still has all my memory

I am working on a program that analyzes data from a file and saves it in the HSQLDB database. When the parser encounters data, it creates objects that map to the database using JPA / Hibernate. My problem is that while analyzing the running application it uses more and more memory. I have successfully used cached tables so that after the parsing is complete everything will be released, but during the parsing it uses the path more than I'm comfortable with.

I tried to fix this by calling flushand clearmy the EntityManager, but it has not affected. I also tried to make sure that Entity with references to all other objects is stored in memory.

The biggest objects in memory seem to be hsqldb.Sessions. Maybe HSQlDb caches a lot of data for each transaction? Excessive seems to need 1 GB of RAM to only get a database that is 120 MB on disk, right?

Please advise that I could try further.

+3
source share
3 answers

After a two-day conversation with HSQLDB, I followed the advice of two friends and changed the database to H2. The amount of memory during the transaction is about a third, and also 20% faster.

Really surprised me

+2
source

Eclipse MAT, , . JPA , , , .

+2

. : 1) process_id ;

2), :

jmap -dump:live,format=b,file=<filename> <process_id>

3), : a) JHAT:

jhat <file>

b) ( ) Eclipse Memory Analyzer

http://download.eclipse.org/mat/1.3/update-site/

(Eclipse: help- > → )

. , .

HSQLDB: MemoryAnalizer , ,

CompiledStatementManager.csidmap

- ,

statement.close()
0

Source: https://habr.com/ru/post/1768782/


All Articles