Re: [h2] In-Memory H2 deleted rows not garbage collected.

2023-05-20 Thread Arjun Sahoo
I am using spring data jpa to delete the records.
@Modifying
@Transactional
@Query(value = "delete from table where start_time_ms <= :startTimeMs", 
nativeQuery = true)
Integer deleteInBulkByStartTime(@Param("startTimeMs") Long startTimeMs) throws 
SQLException;

 Spring takes care of  managing the transaction.


On Sunday, May 21, 2023 at 1:09:55 AM UTC+5:30 Noel Grandin wrote:

> check that all your transactions are being closed. Holding a transaction 
> open means that the storage cannot be freed.
>
>  
>
>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/7c3dc13a-1ccc-4333-932e-4ac29a4d15e9n%40googlegroups.com.


Re: [h2] In-Memory H2 deleted rows not garbage collected.

2023-05-20 Thread Noel Grandin
check that all your transactions are being closed. Holding a transaction
open means that the storage cannot be freed.



>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/CAFYHVnXhZosk3b1LEK-b_6%2BTFFePhQ1%3DbkWRnvb5Auhx4OoEZA%40mail.gmail.com.


[h2] In-Memory H2 deleted rows not garbage collected.

2023-05-20 Thread Arjun Sahoo
Hi,

 I am using Spring boot In-Memory H2DB. I am storing latest 100k records in 
the database, so keep on deleting old records and inserting new records. 
Application runs fine for 4-5 hours, after that it throws OOM Exception. 
The memory consumption keeps on increasing even after deleting old records. 
I took the thread dump and analysed in MAT, it shows one memory leak.

One instance of org.h2.mvstore.tx.TransactionStore$TxMapBuilder$TMVMap 
loaded by org.springframework.boot.loader.LaunchedURLClassLoader @ 
0x6c0737918 occupies 2,08,58,61,856 (77.95%) bytes. The memory is 
accumulated in one instance of org.h2.mvstore.Page$PageReference[], loaded 
by org.springframework.boot.loader.LaunchedURLClassLoader @ 0x6c0737918, 
which occupies 2,08,58,61,384 (77.95%) bytes.

When I restart the application with same number of records in H2db, it 
takes only 30% of memory.

*H2db Version*: 2.1.212

*Spring boot*: 2.7.1

*Spring data JPA*:2.7.1

*spring.datasource.url*
=jdbc:h2:mem:db;DB_CLOSE_ON_EXIT=FALSE;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE;

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/ff956fd3-e598-4895-9060-b6c925351cbfn%40googlegroups.com.