Data alignment is the strategy of arranging data in main memory according to certain rules contributing to speed-up of access to them.
When working with memory microprocessors use a machine word of different sizes as a main unit. As a rule, the machine word equals 2^k bytes. When saving a data object into memory some field consisting of several bytes can intersect with the "natural boundary" of words in memory. Some processor models cannot address those data in memory which violate the boundaries of machine words. Others can address data without alignment but less effectively than when addressing the data within the full "machine word" in memory.
Data alignment is performed with the help of empty memory cells between data objects. It increase the size of the data structures but speeds up access to data.
- Jonathan Rentzsch. Data alignment: Straighten up and fly right.
- Wikipedia. Data structure alignment.
- Noel Llopis. Data Alignment.
- Andrey Karpov. Optimization of 64-bit programs.
- Kang Su Gatlin. Windows Data Alignment on IPF, x86, and x64.