diff --git a/Shared/src/org/bimserver/shared/ByteBufferVirtualObject.java b/Shared/src/org/bimserver/shared/ByteBufferVirtualObject.java index 761a12ac21..ea5583e386 100644 --- a/Shared/src/org/bimserver/shared/ByteBufferVirtualObject.java +++ b/Shared/src/org/bimserver/shared/ByteBufferVirtualObject.java @@ -50,14 +50,13 @@ public class ByteBufferVirtualObject extends AbstractByteBufferVirtualObject imp private Map referencedBuffers; public ByteBufferVirtualObject(QueryContext reusable, EClass eClass, int capacity) { - super(Math.max(capacity, 17)); // 17 bytes are always needed + super(Math.max(capacity, reusable.getPackageMetaData().getUnsettedLength(eClass) + 16)); // 16 bytes plus the class specific ones are always needed this.reusable = reusable; this.eClass = eClass; this.oid = reusable.getDatabaseInterface().newOid(eClass); this.uuid = reusable.getDatabaseInterface().newUuid(); int unsettedLength = reusable.getPackageMetaData().getUnsettedLength(eClass); - ensureCapacity(buffer.position(), 16 + unsettedLength); buffer.put(new byte[unsettedLength]); buffer.putLong(this.uuid.getMostSignificantBits()); buffer.putLong(this.uuid.getLeastSignificantBits());