I see ring buffers are very useful with their speed and if you have a known maximum buffer length they make a lot of sense. Let's say in the scenario where you have streaming data, but the playing stream is paused and caching continually in the background.

What do you do with a ring buffer when the data that needs to be cached exceeds that of the size of the ring buffer? Or is there a better buffering method for this?

1 Answer 1


I would say that ring buffers, by design, overwrite old data. Rather than saying that ring buffer is useful when you know your maximum buffer length, consider it useful when you know the maximum amount of history you need.

In the case of video a ring buffer would make it possible to keep last N seconds of data, for example, otherwise you need a growing buffer or maybe even start caching data to disk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.