Subject Re: [Firebird-Java] Memory leak in repetitive createStatement when autoCommit is set to true
Author Roman Rokytskyy
> When i try to test repetitive createStatement when autoCommit for
> connection is set to false i found memory leak. Piece of code example
> is below. May be, i'm doing smth wrong, or this is a bug in driver or
> smth else? I test this with Jaybird 1.5, Jaybird 2.0 and Jaybird 2.1.
> When autoCommit is set to true all ok.

Confirmed and thanks for the entry in the tracker.

From the tracker:

"The issue is related to a feature in Jaybird that tracks the open
statements till the end of the transaction. It was added in order to ensure
that all result sets are closed before the transaction is either committed
or rolled back. Not doing so prevents the commit or rollback from

This feature is only needed to the applications that simply forget to close
result sets and statements before calling Connection.commit(). In such case
driver first closes all result sets and only after than ends the
transaction. At this point all references to the statement objects will be

In those applications that ensure to close statements before the transaction
end, it is already possible to specify the "no_result_set_tracking"
property, e.g.:


This will switch the feature off and no "leak" will happen.

Note, this won't affect the holdable result sets, because they are
completely cached in memory, while the statement object is released back to
the server."

I have already fixed it and committed the fix to the HEAD. Currently no
plans for Jaybird 2.1.1 exist, but when we create one, this fix can be
backported. Till then please use that property.