Skip to content
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 test. #588

Merged
merged 2 commits into from
Aug 19, 2024
Merged

Fix a memory leak in test. #588

merged 2 commits into from
Aug 19, 2024

Conversation

leerho
Copy link
Contributor

@leerho leerho commented Aug 17, 2024

This was a memory leak in the tests. It only shows up when the tests run long enough and generate enough garbage for the garbage collector to activate and call finalize. It only showed up when running all the tests for the java library. Running individual tests it will not show up. I would see the warning after all the tests have run, but, of course, the warning message doesn't provide any clues about where the culprit is, it can't! It was kind of a cat-and-mouse game to find it, but I finally figured out a way to track it down.

This leak has been there a while, but it was only in the test code. So no real harm done. Release 6.1.0 is coming soon, I think it is safe to release it then.

wmem.close();
//note wmem2 has already been closed by the DefaultMemoryRequestServer
wmem.close(); //empty, but we must close it anyway.
//note wmem2 has already been closed by the DefaultMemoryRequestServer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could do assertFalse(wmem2.isAlive()) here rather than just a comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@leerho leerho requested a review from jmalkin August 18, 2024 23:20
@leerho leerho merged commit 8bf32c5 into master Aug 19, 2024
4 checks passed
@leerho leerho deleted the fix_memory_leak branch December 15, 2024 00:29
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.

2 participants