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 Thu, Jan 30, 2014 at 12:10:54PM +0000, Nick Hudson wrote:
> Standards and modern tools, e.g. gcc[1] 4.8, expect malloc to return
> memory with alignment that is different to our current
> jemalloc.Attached is a suggested diff to fix the problem for most
> platforms.

I still don't see the point of the GCC behavior and I don't agree with
the standard interpretation. The referenced DR covers a quite different
problem (pointer casts). It doesn't make sense to justify the larger
alignment if accessing the storage with any such type is UB because it
is an access beyond the end of the allocation. As such, I do strongly
consider this an overeager optimisation.


Home | Main Index | Thread Index | Old Index