Details
Description
In UnsafeAccess.unsafeCopy, we calculate a size _ to be read, no greater than UNSAFE_COPY_THRESHOLD, if total _len is larger than UNSAFE_COPY_THRESHOLD:
long size = (len > UNSAFE_COPY_THRESHOLD) ? UNSAFE_COPY_THRESHOLD : len;
But then we simply read the whole len anyway:
theUnsafe.copyMemory(src, srcAddr, dst, destAddr, len);
I believe the real intention here is to copy chunks of size bytes, the current code is already copying everything on the first iteration, then performing additional chunked copies.