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

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


On Wed, 28 May 2025 16:49:17 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> We have https://github.com/openjdk/jdk8u/blob/master/jdk/src/share/classes/java/nio/Bits.java#L776-L779, at least. Not sure if there are others.
>
> I see, so that copying threshold was removed by [JDK-8149596](https://bugs.openjdk.org/browse/JDK-8149596) in JDK 9: https://github.com/openjdk/jdk/commit/2255be0267ea036750587e2b9aef11e37d25eace
> 
> Which is extra confusing, because I don't think `Unsafe.copyMemory` is immune to TTSP issue as well.

But anyway, I think this shows a better home for the constant and the cleaning code, in `java/nio/Bits.java`. Putting it there would also allow us to later reinstate copying loop, if we see it is a problem as well.

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

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


More information about the nio-dev mailing list