Simplify allocateUninitialized

This commit is contained in:
2025-04-16 16:26:58 +02:00
parent dbe2a72f7c
commit 94218330b1

View File

@@ -9,10 +9,6 @@ public class UninitializedByteBuffer {
private static final Logger LOGGER = Logger.getLogger(UninitializedByteBuffer.class.getName());
public static ByteBuffer allocateUninitialized(int size) {
try {
if (size < DhfsSupport.PAGE_SIZE)
return ByteBuffer.allocateDirect(size);
var bb = new ByteBuffer[1];
long token = DhfsSupport.allocateUninitializedByteBuffer(bb, size);
var ret = bb[0];
@@ -25,8 +21,5 @@ public class UninitializedByteBuffer {
}
});
return ret;
} catch (OutOfMemoryError e) {
return ByteBuffer.allocate(size);
}
}
}