There is a class called ByteStream that represents ... a byte stream. BS allocates and uses another arbitrary sized chunk of RAM storing RGData with long strings. BS also runs a memcpy to move the data.
This behavior is too wasteful resource-wise. The current implementation of BS can't mix together the stream from its own buffer and data from a smart pointer backed buffer.
The suggested approach is to replace BS'es internal buffer in certain cases(when it serializes RGData to send another portion of records over the network) with a stack of smart pointers that contains actual data buffers. This saves RAM that is shared b/w RGData and ByteStream and time b/c runtime skips memcpy calls.