RFR: 8357959: (bf) ByteBuffer.allocateDirect initialization can result in large TTSP spikes [v2]

Aleksey Shipilev shade at openjdk.org
Wed May 28 16:26:52 UTC 2025


On Wed, 28 May 2025 16:07:01 GMT, Rohitash Kumar <duke at openjdk.org> wrote:

>> src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template line 119:
>> 
>>> 117: 
>>> 118:         // Zero in chunks to avoid blocking safepoints for too long
>>> 119:         long chunkSize = 1024 * 1024;
>> 
>> In the past, the bulk put/get when swapping also used 1MB as the threshold because of TTSP. So I think this value is reasonable. Might be a bit nicer to make it a constant (static final).
>
> Thanks for the insight on value of chunk size. And agreed on static final part, I’ve made it a `private static final `constant

> In the past, the bulk put/get when swapping also used 1MB as the threshold because of TTSP

Oh, TIL. Do you have a pointer where that was? I searched around and cannot find it. We should probably put the constant in the similar place.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25487#discussion_r2112300504


More information about the nio-dev mailing list