[JAVA-5280] Reclaim native memory quicker when using ZlibCompressor Created: 02/Jan/24  Updated: 10/Jan/24  Resolved: 10/Jan/24

Status: Closed
Project: Java Driver
Component/s: Internal
Affects Version/s: None
Fix Version/s: 4.11.2

Type: Bug Priority: Minor - P4
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

Originally reported via PR: https://github.com/mongodb/mongo-java-driver/pull/1285

Since the driver creates the java.util.zip.Deflater instance, it's responsible for calling Deflater#end



 Comments   
Comment by Githook User [ 10/Jan/24 ]

Author:

{'name': 'raelg', 'email': '344980+raelg@users.noreply.github.com', 'username': 'raelg'}

Message: Reclaim native memory quicker when using ZlibCompressor (#1285)

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
Branch: 4.11.x
https://github.com/mongodb/mongo-java-driver/commit/aa5f77b0b7055b38a8734bf4478c8e2297a6894d

Comment by Githook User [ 10/Jan/24 ]

Author:

{'name': 'raelg', 'email': '344980+raelg@users.noreply.github.com', 'username': 'raelg'}

Message: Reclaim native memory quicker when using ZlibCompressor (#1285)

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
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/d80e9c1de594113001a47ce0e8f9db5baca37249

Generated at Thu Feb 08 09:04:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.