>
> > >From the linux man page:
> > For calloc() and malloc(), the value returned is a pointer
> > to the allocated memory, which is suitably aligned for any
> > kind of variable, or NULL if the request fails.
>
> OK, then why is electric fence telling him to make DOUBLEALIGN match
> INTALIGN? You would think that if this change made sense, we would be
> having some Linux problems, but we don't.
>
> ---------------------------------------------------------------------------
>
>
> #if ! defined(sco)
> #define DOUBLEALIGN(LEN)\
> (((long)(LEN) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
>
> #define MAXALIGN(LEN)\
> (((long)(LEN) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
> #else
> #define DOUBLEALIGN(LEN) INTALIGN(LEN)
> #define MAXALIGN(LEN) INTALIGN(LEN)
> #endif
>
Hi Hackers,
it seems that Linux malloc, or better libc-5.4.23 malloc, is doing what is
declared in the man page, i.e. returning "memory which is suitably aligned
for any kind of variable". I have some malloc traces and all malloc results
are aligned to double size (8 bytes):
op caller ptr size
--------------------------------------------
malloc 400c32b2 080a06c8 25
malloc 400c32b2 080a06e8 13
malloc 400c32b2 080a0700 26
malloc 400c32b2 080a0720 11
malloc 400c32b2 080a0730 50
malloc 400c32b2 080a0768 14
malloc 400c32b2 080a0780 17
malloc 400c32b2 080a0798 24
malloc 400c32b2 080a07b8 27
malloc 400c32b2 080a07d8 817
malloc 400c32b2 080a0b10 11
malloc 400c32b2 080a0b20 14
malloc 400c32b2 080a0b38 164
malloc 400c32b2 080a0be0 11
malloc 400c32b2 080a0bf0 14
malloc 400c32b2 080a0c08 25
malloc 400c32b2 080a0c28 16
malloc 400c32b2 080a0c40 35
malloc 400c32b2 080a0c68 9
malloc 400c32b2 080a0c78 7
So I don't see where is the problem.
Massimo Dal Zotto
+----------------------------------------------------------------------+
| Massimo Dal Zotto e-mail: dz@cs.unitn.it |
| Via Marconi, 141 phone: ++39-461-534251 |
| 38057 Pergine Valsugana (TN) www: http://www.cs.unitn.it/~dz/ |
| Italy pgp: finger dz@tango.cs.unitn.it |
+----------------------------------------------------------------------+