RFR: 8374308: ImageBufferCache does not work as intended [v2]

David Beaumont duke at openjdk.org
Tue Jan 6 10:32:40 UTC 2026


On Mon, 5 Jan 2026 17:51:56 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> David Beaumont has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   actually remove the class ...
>
> src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java line 394:
> 
>> 392:             throw new IndexOutOfBoundsException("size");
>> 393:         }
>> 394:         ByteBuffer result = ByteBuffer.allocateDirect((int) ((size + 0xFFF) & ~0xFFF));
> 
> Can you remind me why it allocates multiples of 4k?  
> 
> Also, would be useful to know if using ByteByte.allocate (to allocate a heap buffer) would be okay here.

I can't, I've never seen this code before. No comments, no tests for why 4k is a good size. Probably just a "page size" heuristic. I'm just removing dead code and moving what's not dead out of the class to be deleted.

Changing details beyond that should probably be a different PR.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29043#discussion_r2664442989


More information about the core-libs-dev mailing list