[Interest] QueuedConnection, QByteArray, reserve, capacity

Thiago Macieira thiago.macieira at intel.com
Thu Jun 1 20:05:47 CEST 2017


On Wednesday, 31 May 2017 13:38:19 PDT Yuri Alexandrov wrote:
> Hi,
> 
> >It you shrink too much, then it releases the memory. (where "too much" may
> >be "less than half", I'd have to check the sources)
> 
> I think it would be great if this thing is documented (may be we can have a
> flag to be able to disable this optimization), as sometimes it’s pretty
> useful to make sure that ‘reserve’ area is static not depending on actual
> resize.

I don't want to document internal behaviour which we may change in the future. 
I understand your use-case and it might be a good idea to change the behaviour 
to support it.

> In regards of QueuedConnection issue mentioned, I agree that it’s probably
> an absolutely normal behavior as I hardly can imagine a use case where it’s
> desired to receive a pre-allocated QByteArray.

If you intend to modify it, then pass it by pointer. If you don't intend to 
modify, then the allocation size is irrelevant.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list