calculating ring buffer size