[Development] Changing container privates again
João Abecasis
joao.abecasis at nokia.com
Mon Jun 11 16:00:58 CEST 2012
Thiago Macieira wrote:
>> Following Olivier's suggestion I think it might be beneficial to have alloc
>> unconditionally in the base class, even if it is not being used at times.
>> If nothing else, it saves padding. Additionally, deleter function and token
>> would be more generally useful if they can be used with the alloc member.
>
> Yes, if we move the alloc member to the main struct, then it will simply
> occupy the space currently used for padding. The total overhead for an
> allocation would be 24 bytes on 64-bit systems. Since glibc's allocator is 16-
> byte aligned, this means our data is always 8 bytes off.
>
> In my opinion, that's actually worse than having a larger header.
But that's what we currently have and wouldn't change with you suggestion above, right?
Would it be worth to set the minimum alignment for the data as 16-bytes, at the expense of padding we explicitly add in QArrayData::allocate? (Since this decision can be done inside that function it would have no impact on ABI)
Cheers,
João
More information about the Development
mailing list