Skip to content

Conversation

@Fisherman110
Copy link

The original proposal Bug 62432

The StatementFinalizer keeps a list of statements which he closes
if they're still open when the connection is closed. The list keeps
weak references to the statements, so when the statement is closed
by client code, it can be garbage collected and will not be closed
by the StatementFinalizer.

However, the StatementFinalizer keeps the references to the Statements
indirectly through instances of StatementFinalizer$StatementEntry.
These instances are not cleaned up even when the statements they refer
to have long been closed. Mostly this does not seem to be a problem when
connections are closed quickly.

But we have had long running jobs that created many Statements with
the same connection where the instances of (empty)
StatementFinalizer$StatementEntry finally brought the VM to its knees.

The useless instances of StatementFinalizer$StatementEntry kept
around in the statement list constitute a memory leak in my opinion.

What's new?

A new feature to address the memory leak for StatementFinalizer$statements.
When a new Statement is created, it invokes the function called clearEntry().
The clearEntry function will clean those invalid (null or have been closed)
StatementEntry instances in the list every ten times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant