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
parent
13b139d028
commit
ae9ee18cad
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue