tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Alignment of small memory allocations returned by malloc(3)

On Sat, Feb 01, 2014 at 01:16:54PM +0000, David Laight wrote:
> But gcc is assuming the maximal alignment for 'normal' items - which
> ends up being 16 bytes for long double on some systems.

My problem with the approach is that it special cases a very limited set
of functions and this magical alignment property is lost very, very
soon, so it shouldn't change code generation that much anyway. E.g.
whenever a pointer value is not provably direct from malloc/strdup it
has lost this extra alignment already. The x86 rmw cycles for some ops
are irrelevant -- you get this for access to short fields in structures
all the time. Whether or not malloc should use the compact allocation is
another completely separate discussion.


Home | Main Index | Thread Index | Old Index