HBASE-22496 UnsafeAccess.unsafeCopy should not copy more than UNSAFE_COPY_THRESHOLD on each iteration

Signed-off-by: huzheng <openinx@gmail.com>
This commit is contained in:
Wellington Chevreuil 2019-05-30 10:27:07 +08:00 committed by huzheng
parent 68a01606ac
commit e0197ac615
1 changed files with 1 additions and 1 deletions

View File

@ -100,7 +100,7 @@ public final class UnsafeAccess {
private static void unsafeCopy(Object src, long srcAddr, Object dst, long destAddr, long len) {
while (len > 0) {
long size = (len > UNSAFE_COPY_THRESHOLD) ? UNSAFE_COPY_THRESHOLD : len;
theUnsafe.copyMemory(src, srcAddr, dst, destAddr, len);
theUnsafe.copyMemory(src, srcAddr, dst, destAddr, size);
len -= size;
srcAddr += size;
destAddr += size;