This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Add malloc micro benchmark


On Fri, 5 Jan 2018, Carlos O'Donell wrote:

> I think that for blocks smaller than the fundamental language types 
> (which require malloc to have 16-byte alignment) we do not have to 
> return sufficiently aligned memory. For example if you allocate a 3-byte 
> block or a 13-byte block, you cannot possibly put a 16-byte long double 
> there, nor can you use that for a stack block, so it's a waste to 
> guarantee alignment.

As per DR#075, the memory needs to be aligned for any type of object (with 
a fundamental alignment requirement, in C11 and later), not just those 
that will fit in the block.  (This in turn allows for applications using 
low bits for tagged pointers.)

This does not of course rule out having another allocation API that 
supports smaller alignment requirements.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]