QRingBuffer: optimize memory usage

QByteArray resizing behavior is to preallocate a certain amount
of memory for future growth. Make QRingBuffer aware of the extra
capacity in QByteArray.

Change-Id: I68310d5783fbc32e4fd5075ed3269ce6b7128a92
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Alex Trotsenko 2014-08-27 16:43:52 +03:00
parent 13b139d028
commit ae9ee18cad
1 changed files with 1 additions and 1 deletions

View File

@ -113,7 +113,7 @@ public:
// if need buffer reallocation
if (tail + bytes > buffers.last().size()) {
if (tail >= basicBlockSize) {
if (tail + bytes > buffers.last().capacity() && tail >= basicBlockSize) {
// shrink this buffer to its current size
buffers.last().resize(tail);