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

Alan Bateman alanb at openjdk.org
Tue Jan 6 10:49:43 UTC 2026


On Tue, 6 Jan 2026 10:34:27 GMT, David Beaumont <duke at openjdk.org> wrote:

>> 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.
>
> Actually, thinking about this more, it would have the benefit (in the situation where caching happens) of making buckets more likely to be reususeable, so if we're willing to assume that, and since the cache is going away, we could justify dropping the rounding and just allocating the exact size.

I can't see any reason to round up now so I think we should remove it. I don't mind if its this PR or a separate PR.

I'm interested to know if this can be changed to use allocate as it doesn't need a direct buffer here. FileChannel.read uses the thread-local buffer cache when called with a heap-buffer.

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

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


More information about the core-libs-dev mailing list