We're updating the issue view to help you get more done. 

Reduce memory usage of PreparedStatementSpyConnectionProvider

Description

The memory usage has increased considerably after recent progress, to the point that the PostgreSQL specific suite is running in out of memory with the current heap settings.

Heap analysis shows that the main consumer is Mockito as we "spy" on many JDBC Connections, this is causing internal objects of Mockito to be allocated for each interaction with a Connection or any Statement. The testsuite performs a significant amount of invocations on these so the combination gets us above 4GB of memory usage.

I'm still investigating the Mockito internals to understand if this is by design or a leak, but in the meantime I've found some flags which we can apply to reduce this memory consumption, at the drawback of not being able to perform a "verification" on mock invocations.

It turns out that some tests need such verification, but to be safe I'm disabling this flag globally and allowing it to be enabled only explicitly. Not ideal as new tests will need to consider this limitation, but hopefully in the meantime I can figure out a proper fix for Mockito.

Environment

None

Status

Assignee

Sanne Grinovero

Reporter

Sanne Grinovero

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major