OpenHFT / Chronicle-Bytes

Chronicle Bytes has a similar purpose to Java NIO's ByteBuffer with many extensions
http://chronicle.software
Apache License 2.0
396 stars 84 forks source link

BytesStore.empty should not allocate #464

Closed ctrychta closed 1 year ago

ctrychta commented 1 year ago

It looks like BytesStore.empty() started allocating with this change: https://github.com/OpenHFT/Chronicle-Bytes/pull/407.

We noticed this as using JSONWire/TextWire and calling clear() calls valueOut.resetState(); which has sep = empty(); and we started seeing those calls generating garbage.

Would it be possible to change empty to not allocate or is there another recommended way to reset the state of a wire so it can be reused which does not allocate?

JerryShea commented 1 year ago

Closing as I believed fixed by recent changes