[Development] are clangs 3.5 new builtin_operator_(new/delete) also useable for Qt Container optimization?

Thiago Macieira thiago.macieira at intel.com
Thu Jul 17 18:42:27 CEST 2014


On Thursday 17 July 2014 12:20:56 Olivier Goffart wrote:
> But Qt don't use custom allocators. According to grep, the only place where 
> "operator new" is used directly in Qt is QSharedPointer[2]. And I believe
> it is better to change the code to call the normal new. (I'm not sure why
> it's done this way.)

Because we need to split the memory allocation from the initialisation of the 
object. The memory is allocated for the object plus the 16 bytes required for 
the QSharedPointer internal data in one go.

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




More information about the Development mailing list