Can I just ignore do close for Connection/PreparedStatement/ResultSet) when I use h2 in-memory mode?

29 views
Skip to first unread message

Isaac Zeng

unread,
Jul 12, 2020, 8:51:24 AM7/12/20
to H2 Database
Can I just ignore do close for Connection/PreparedStatement/ResultSet) when I use h2 in-memory mode?

Evgenij Ryazanov

unread,
Jul 12, 2020, 9:34:49 AM7/12/20
to H2 Database
Hello.

If you don't use DB_CLOSE_DELAY setting all these objects can be garbage collected, but it's a bad practice anyway.

If you use it, it may prevent deletion of database when all connections were closed or garbage collected, so it can create a memory leak.
Reply all
Reply to author
Forward
0 new messages