Predicting Required Buffer Size

I am sending fix messages encoded into RWF using UPA Java. These messages have a wide range of different sizes. I would like to allocate Buffers for encoding that are close to what is actually needed, rather than always allocating a buffer that is large enough for the “worst case.”


While some of our values are coverted to numbers, most of FIX is UTF-8. Is there a ratio of bytes in RWF for Bytes in a java.lang.String that I can use to “guess” what I will need?

Best Answer

  • LarryT
    Answer ✓

    If you know your payload data length, you can just add a fixed RWF overhead number to your length when requesting the buffer size. I’ve used 128 bytes for this in the past.

    However, this number may be too small if you’re using extended headers, large message keys, or permission expressions in the messages you’re sending. You may need to tweak for your specific usage.