When malloc returns, what does 8-byte alignment mean?

Libc malloc (x) says that the function returns a pointer to a memory area of ​​at least x bytes, and the pointer is aligned with 8 bytes. What does this alignment mean? Hell.

+5
source share
3 answers

This means that the pointed address of mod 8 is 0:

pointer % 8 == 0

This can be important for low-level operations, where it can affect correctness or efficiency. See also this answer .

+8
source

This means that the memory starts with an address multiple of 8.

, : , , CPU , . . " 8 " , , - .

( - . , - .)

+6

. , 8 , .

, "", . , .

Later computers fix this problem by loading from any address, but often this means that it takes several cycles to load the data.

+1
source

All Articles