Alignment requirements
Rules about which memory addresses are valid for accessing a given type or instruction, affecting correctness and performance.
Definition
Alignment requirements are rules about which memory addresses are valid (or optimal) for accessing a given type or instruction.
Many CPU instructions assume data starts at addresses that are multiples of some number (for example 4, 8, or 16 bytes).
Why it matters
If data is misaligned:
- some architectures handle it more slowly
- some architectures raise a fault, which can lead to a crash (often
SIGBUS)
Related term
When you hit these problems in practice, they usually show up as alignment issues.