On Wed, 22 May 2024 07:27:14 GMT, Claes Redestad <redes...@openjdk.org> wrote:

>> test/micro/org/openjdk/bench/java/util/zip/InflaterInputStreams.java line 
>> 113:
>> 
>>> 111:         try (InflaterInputStream iis = new 
>>> InflaterInputStream(deflated)) {
>>> 112:             while (iis.read(inflated, 0, inflated.length) != -1);
>>> 113:         }
>> 
>> Presumably this only works because closing the underlying stream (a BAIS in 
>> this case) is a no-op.
>
> Yes, the underlying BAIS can be repeatedly closed without affecting the 
> benchmark.

Hello Alan, before this change, the memory gets occupied by too many of these:


   1:      10871820      521847360  
jdk.internal.ref.CleanerImpl$PhantomCleanableRef (java.base@23-internal)
   2:      10871758      260922192  java.util.zip.Inflater$InflaterZStreamRef 
(java.base@23-internal)



Closing the `InflaterInputStream` releases those underlying 
`InflaterZStreamRef`s.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19340#discussion_r1609461029

Reply via email to