Why double in C is 8 bytes aligned?

后端 未结 4 1441
时光说笑
时光说笑 2020-12-03 17:08

I was reading a article about data types alignment in memory(here) and I am unable to understand one point i.e.

Note that a double variable will be al

4条回答
  •  星月不相逢
    2020-12-03 17:55

    Aligning a value on a lower boundary than its size makes it prone to be split across two cachelines. Splitting the value in two cachlines means extra work when evicting the cachelines to the backing store (two cachelines will be evicted; instead of one), which is a useless load of memory buses.

提交回复
热议问题