My application is a network application. Its job is to receive streams of packets (QByteArray) in which I would like to emit them as signals. Would doing so be inefficient? I'm concerned with copying of large buffers.
+6
A:
QByteArray uses Copy-on-write. Which means that only the pointer is copied around, that is, until you modify the content of the QByteArray. So you should be alright if you just pass it along.
bitc
2010-04-29 18:01:15
And if you have already allocated the memory which you want to pass around, you can create the first QByteArray in the chain using the QByteArray::fromRawData() function.
Gareth Stockwell
2010-04-29 18:12:23