This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Add malloc micro benchmark
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, nd <nd at arm dot com>
- Date: Fri, 5 Jan 2018 16:28:43 +0000
- Subject: Re: [PATCH v2] Add malloc micro benchmark
- Authentication-results: sourceware.org; auth=none
- References: <DB6PR0801MB205334E9F59632F30A17202683390@DB6PR0801MB2053.eurprd08.prod.outlook.com> <bcc3af78-c1ac-2d24-6a6a-c14d6ca7dc96@redhat.com> <DB6PR0801MB20538A414F1659748E703918833C0@DB6PR0801MB2053.eurprd08.prod.outlook.com> <6ad98d83-d49b-25a3-ef01-e93e18f4740b@redhat.com> <DB6PR0801MB2053641333453CE91496266E83190@DB6PR0801MB2053.eurprd08.prod.outlook.com> <96b76d58-d2f0-2176-51e5-f6338ed079e1@redhat.com>
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