diff --git a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDictionary.java b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDictionary.java
index 596fb94..7620e47 100644
--- a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDictionary.java
+++ b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDictionary.java
@@ -105,6 +105,7 @@ public class LLLocalDictionary implements LLDictionary {
* Default: true
*/
private static final boolean USE_DIRECT_BUFFER_BOUNDS = true;
+ private static final int INITIAL_DIRECT_READ_BYTE_BUF_SIZE_BYTES = 4096;
static {
boolean assertionsEnabled = false;
@@ -235,7 +236,7 @@ public class LLLocalDictionary implements LLDictionary {
ByteBuffer keyNioBuffer = LLUtils.toDirect(key);
assert keyNioBuffer.isDirect();
// Create a direct result buffer because RocksDB works only with direct buffers
- ByteBuf resultBuf = alloc.directBuffer();
+ ByteBuf resultBuf = alloc.directBuffer(LLLocalDictionary.INITIAL_DIRECT_READ_BYTE_BUF_SIZE_BYTES);
try {
int valueSize;
int assertionReadData = -1;
diff --git a/src/main/java/it/cavallium/dbengine/database/serialization/SerializerFixedBinaryLength.java b/src/main/java/it/cavallium/dbengine/database/serialization/SerializerFixedBinaryLength.java
index 78385a4..426fc41 100644
--- a/src/main/java/it/cavallium/dbengine/database/serialization/SerializerFixedBinaryLength.java
+++ b/src/main/java/it/cavallium/dbengine/database/serialization/SerializerFixedBinaryLength.java
@@ -110,7 +110,7 @@ public interface SerializerFixedBinaryLength extends Serializer {
@Override
public @NotNull ByteBuf serialize(@NotNull Integer deserialized) {
- ByteBuf buf = allocator.directBuffer(Integer.BYTES);
+ ByteBuf buf = allocator.buffer(Integer.BYTES);
return buf.writeInt(deserialized);
}
@@ -139,7 +139,7 @@ public interface SerializerFixedBinaryLength extends Serializer {
@Override
public @NotNull ByteBuf serialize(@NotNull Long deserialized) {
- ByteBuf buf = allocator.directBuffer(Long.BYTES);
+ ByteBuf buf = allocator.buffer(Long.BYTES);
return buf.writeLong(deserialized);
}