Skip to content

Reclaim native memory quicker when using ZlibCompressor - #1285

Merged
jyemin merged 2 commits into
mongodb:masterfrom
raelg:native_memory_leak_end_deflater
Jan 10, 2024
Merged

jyemin merged 2 commits into
mongodb:masterfrom
raelg:native_memory_leak_end_deflater

Conversation

@raelg

@raelg raelg commented Dec 28, 2023 •

Copy link
Copy Markdown
Contributor

Reclaim native memory quicker by overriding close() to invoke end() on the deflater, since by supplying a deflater to the constructor of DeflaterOutputStream usesDefaultDeflater is set to false and therefore end() is not invoked in DeflaterOutputStream#close.

This is related to JDK-4797189 bug/feature (marked as Won't Fix)

See the following blog post for more information: https://medium.com/swlh/native-memory-the-silent-jvm-killer-595913cba8e7

JAVA-5280

…n the deflater, since by supplying a deflater to the constructor of DeflaterOutputStream usesDefaultDeflater is set to false and therefore end() is not invoked in DeflaterOutputStream#close.
@jyemin

jyemin commented Jan 5, 2024

Copy link
Copy Markdown
Collaborator

Hi @raelg , I opened JAVA-5280 and linked this PR to it. We'll take a look soon.

@jyemin jyemin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. Just one whitespace issue to fix.

@jyemin
jyemin merged commit d80e9c1 into mongodb:master Jan 10, 2024
jyemin pushed a commit that referenced this pull request Jan 10, 2024
Reclaim native memory quicker by overriding close() on DeflaterOutputStream to invoke end() on the Deflater, since by supplying a deflater to the constructor of DeflaterOutputStream usesDefaultDeflater is set to false and therefore end() is not invoked in DeflaterOutputStream#close.

JAVA-5280
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