Question: How to parse data stream, when data can be in many different formats without reallocating space to hold parsed data

So lets say we have data stream, that can be be in n different structures. Lets say first byte defines what data structure it is. I want to have one structure that wraps all possible data structures and do not have to allocate space each time new data structure is received from client. So lets name it Payload. The easy way is to hold all possible data structures into one and use each structure accordingly. But the problem is that it will have to allocate multiple times for all received data structures. This consumes time and GC work. Any better ideas? :slight_smile: Of course, we can go the easy way, but its no fun :smiley:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.