Memory alignment of classes in c#?

后端 未结 6 803
不思量自难忘°
不思量自难忘° 2020-12-17 15:35

(btw. This refers to 32 bit OS)

SOME UPDATES:

  • This is definitely an alignment issue

  • Sometimes the alignment (for whatever reason?) i

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-17 16:14

    Using struct instead of class, makes the time constant. also consider using StructLayoutAttribute. It helps to specify exact memory layout of a structures. For CLASSES I do not think you have any guarantees how they are layouted in memory.

提交回复
热议问题