openlink/virtuoso-opensource — pull request #74 by captain-protect (2013-08-01 11:22:24+00:00)
Title: Fixing memory leak in virtuoso.jdbc4.VirtuosoStatement.close()

Fix for https://github.com/openlink/virtuoso-opensource/issues/73
Memory leak in virtuoso.jdbc4.VirtuosoStatement.close()

Because VirtuosoStatement.finalizer() calls this.close() which accquire monitor on connection(which one of few from connection pool) the finalizer queue grows very fast(thousands of objects) even if Statement are closed programmatic by program(or VirtGraph).
On loaded apps this tend to OOM.

=== STACK TRACE ===
"Finalizer" daemon prio=10 tid=0x00007f04880b2000 nid=0x3b3a waiting for monitor entry [0x00007f04842d0000]
java.lang.Thread.State: BLOCKED (on object monitor)
at virtuoso.jdbc4.VirtuosoPreparedStatement.close(Unknown Source)
(waiting to lock (a virtuoso.jdbc4.VirtuosoConnection))
at virtuoso.jdbc4.VirtuosoStatement.finalize(Unknown Source)
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)
at java.lang.ref.Finalizer.access$100(Finalizer.java:32)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:190)
=== STACK TRACE ===