New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a memory leak in `PostgreSQLConnection` #31

Merged
merged 1 commit into from Mar 14, 2018

Conversation

2 participants
@MrMage
Copy link
Contributor

MrMage commented Mar 14, 2018

PostgreSQLTableNameCache holds a PostgreSQLConnection future. Once that future is fulfilled, it strongly holds a reference to PostgreSQLConnection. That connection in turn holds the table name cache, so we have a reference cycle. This causes the table name cache and its connection to never get released. This is relevant when testing, if the tests are set up such that each test creates a new Database.

Fix a memory leak in `PostgreSQLConnection`
`PostgreSQLTableNameCache` holds a `PostgreSQLConnection` future. Once that future is fulfilled, it strongly holds a reference to `PostgreSQLConnection`. That connection in turn holds the table name cache, so we have a reference cycle. This causes the table name cache and its connection to never get released. This is relevant when testing, if the tests are set up such that each test creates a new `Database`.

@tanner0101 tanner0101 added this to the 1.0.0-rc.2 milestone Mar 14, 2018

@tanner0101 tanner0101 added the bug label Mar 14, 2018

@tanner0101 tanner0101 self-assigned this Mar 14, 2018

@tanner0101

This comment has been minimized.

Copy link
Member

tanner0101 commented Mar 14, 2018

nice catch, thanks!

@tanner0101 tanner0101 merged commit a4e81ae into nio Mar 14, 2018

1 check passed

ci/circleci: linux Your tests passed on CircleCI!
Details

@tanner0101 tanner0101 deleted the nio-connection-leak-1 branch Mar 14, 2018

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