Type alignment (understanding memory layout)

This should be the relevant part. This forces the OS to allocate one page per object, without having to write a lot to the page (so it stays fast).
Alingment here is equal to the page size, so that the object can only be placed at the beginning of a page.

similarly I have seen some concurrent data structures which put an alignment equal to the size of a cache line on their locks, so that there is no "false sharing" and each lock gets its own cache line.

1 Like