[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] [bootstrappable] Re: Re: wip-full-source-bootstrap: f
From: |
Vincent Lefevre |
Subject: |
Re: [Tinycc-devel] [bootstrappable] Re: Re: wip-full-source-bootstrap: from a 357-byte `hex0' to 'hello' |
Date: |
Fri, 8 Jan 2021 16:16:51 +0100 |
User-agent: |
Mutt/2.0.4+67 (a3db7ccb) vl-132933 (2021-01-03) |
On 2021-01-08 13:36:26 +0000, Orians, Jeremiah (DTMB) wrote:
> > If so, is libc malloc supposed to ensure alignment of allocated memory?
> > According to https://man7.org/linux/man-pages/man3/malloc.3.html yes.
> > @Janneke: So our mes libc malloc should be aligning the stuff--but it's not
> > doing it. So it's a bug in our libc.
>
> Looks like you'll have to waste 3.7bytes on average per malloc to
> always pad to the 8byte boundary.
Note that it's an 8-byte boundary for 32-bit systems, but a 16-byte
boundary for 64-bit systems:
https://www.gnu.org/software/libc/manual/html_node/Aligned-Memory-Blocks.html
And about the average waste, this depends on other factors (the
main one may be that the block size is often a multiple of some
power of two).
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)