pgjdbc-ng
pgjdbc-ng copied to clipboard
Out of memory while running pgjdbc test suite
It looks like pgjdbc-ng does not release memory on connection.close or something like that.
pgjdbc's test suite with -Xmx512m fails with OOM.
See https://github.com/pgjdbc/pgjdbc/pull/501 (the idea is to use mvn -P pgjdbc-ng to use pgjdbc-ng driver for pgjdbc test suite)
Thanks for your report !
Unless things have changed, the pgjdbc test suite relies upon the fact that the connection's finalize closes the connection; which in turn closes all the statements, result sets, etc.
Many, if not most, of the "ng" unit tests were taken directly from pgjbdc with the only major changes being that I tried to ensure that all the Connection, Statement & ResultSet objects were explicitly closed. There are still some lingering ones because we get the odd warning as we run the unit tests sometimes.
The JDBC standard requires a close and thus "ng" doesn't have a finalize that closes the connection. It instead has a "Housekeeper" that works to try and close things you forgot (it also yells at you when you it finds something). It is implemented using a daemon thread and PhantomReferences.
I would guess the large number of opened objects is piling up as it works its way through the unit tests and the daemon thread isn't able to keep up.
+1