Search before asking
Describe the bug
When deserializing objects whose construction goes through a property-based creator – which includes every Java record, since records always use the canonical constructor – BeanDeserializer._deserializeUsingPropertyBased allocates a fresh TokenBuffer on every call. Each TokenBuffer allocates at least one Segment (an Object[] plus a token-type array). For workloads that stream many small records, this shows up prominently in allocation profiles.
Code path:
BeanDeserializer.deserialize
→ BeanDeserializerBase.deserializeFromObjectUsingNonDefault
→ BeanDeserializer._deserializeUsingPropertyBased
→ DeserializationContext.bufferForInputBuffering
→ TokenBuffer.forBuffering // fresh allocation per object
Format-independent — reproduces with JSON, CSV, or any other backend. Since records are now the idiomatic way to model immutable DTOs in Java and unconditionally force this path, users migrating DTOs from classes-with-setters to records see a regression in allocation rate with no change in code shape.
The buffer's lifetime is bounded to _deserializeUsingPropertyBased, so reusing it (with RecyclerPool?) may be feasible.
Version Information
3.1.1
Reproduction
No response
Expected behavior
No response
Additional context
No response
Search before asking
Describe the bug
When deserializing objects whose construction goes through a property-based creator – which includes every Java record, since records always use the canonical constructor –
BeanDeserializer._deserializeUsingPropertyBasedallocates a freshTokenBufferon every call. EachTokenBufferallocates at least oneSegment(anObject[]plus a token-type array). For workloads that stream many small records, this shows up prominently in allocation profiles.Code path:
Format-independent — reproduces with JSON, CSV, or any other backend. Since records are now the idiomatic way to model immutable DTOs in Java and unconditionally force this path, users migrating DTOs from classes-with-setters to records see a regression in allocation rate with no change in code shape.
The buffer's lifetime is bounded to _deserializeUsingPropertyBased, so reusing it (with
RecyclerPool?) may be feasible.Version Information
3.1.1
Reproduction
No response
Expected behavior
No response
Additional context
No response