Skip to content

Trimming oversized Message StringBuilder to page size#1159

Merged
chrjohn merged 2 commits intoquickfix-j:masterfrom
the-thing:string-builder-trim
Mar 10, 2026
Merged

Trimming oversized Message StringBuilder to page size#1159
chrjohn merged 2 commits intoquickfix-j:masterfrom
the-thing:string-builder-trim

Conversation

@the-thing
Copy link
Contributor

@the-thing the-thing commented Mar 9, 2026

Fixes #1137

Changes

  • trimming message thread local string builder to max 4096 bytes

Why 4096?

  • same as default page size on most operating systems
  • Claude gave me the summary

Typical Message Sizes by Type

Message Type FIX Tag Example Approx. Size
Heartbeat / Session MsgType=0 50–150 bytes
New Order Single (D) Simple FX Spot 200–400 bytes
New Order Single (D) Fixed Income / complex 400–800 bytes
Execution Report (8) FX fill 300–600 bytes
Execution Report (8) Fixed Income fill 500–1,200 bytes
Quote Request (R) FX RFQ 200–500 bytes
Quote (S) FX streaming 150–400 bytes
Market Data Snapshot FI multi-leg 500–2,000+ bytes
Allocation / TradeCaptureReport Post-trade 800–3,000+ bytes

Note: These are approximate estimates based on FIX 4.x tag=value encoding.
Actual sizes vary by venue, FIX version, and custom tag usage.

@chrjohn chrjohn added this to the QFJ 3.0.1 milestone Mar 9, 2026
@chrjohn chrjohn changed the title Trimming oversized message string builder to page size Trimming oversized Message StringBuilder to page size Mar 9, 2026
@chrjohn
Copy link
Member

chrjohn commented Mar 10, 2026

Thank you @the-thing 👍

@chrjohn chrjohn merged commit 43ecb40 into quickfix-j:master Mar 10, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory leak due to unbounded StringBuilder reuse in Message.class ThreadLocal

2 participants