RFR: 8283411: InflaterInputStream holds on to a temporary byte array of 512 bytes [v2]

Jaikiran Pai jpai at openjdk.java.net
Sun Mar 20 14:05:59 UTC 2022


On Sun, 20 Mar 2022 13:53:34 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Use Alan's suggestion and allocate less than 512 bytes if possible. Plus copyright year fix.
>
> src/java.base/share/classes/java/util/zip/InflaterInputStream.java line 206:
> 
>> 204:         int max = (int)Math.min(n, Integer.MAX_VALUE);
>> 205:         int total = 0;
>> 206:         byte[] b = new byte[512];
> 
> n may be less than 512 so maybe the temporary array can be of length Math.min(max, 512).

That's a good idea. I just pushed a update to this PR with this suggested change. Plus updated the copyright year too.

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

PR: https://git.openjdk.java.net/jdk/pull/7875


More information about the core-libs-dev mailing list