diff --git a/client/src/com/aerospike/client/Value.java b/client/src/com/aerospike/client/Value.java index 0dc598846..38ce7efd5 100644 --- a/client/src/com/aerospike/client/Value.java +++ b/client/src/com/aerospike/client/Value.java @@ -1499,7 +1499,10 @@ public ListValue(List list) { @Override public int estimateSize() throws AerospikeException { - bytes = Packer.pack(list); + // Cache the packed bytes to avoid repeated packing/allocations on subsequent calls. + if (bytes == null) { + bytes = Packer.pack(list); + } return bytes.length; }