you could directly read into the ring buffer here. I start wondering though if it makes sense to have 2 sizes: one for chunk size and one for max_string length. I mean if we need to keep a buffer of size max_string_length around anyway why use a smaller chunk_size? Or do you want to grow the string buffer for that?