unsafe.Sizeof(

// Sample code struct { a string b bool c string }
Note! Any numbers generated by this application are true only for x64 architectures.

)

Type size: 40

Explanation

Your type is struct and its size depends on how underlying types were defined. Two structs with same fields but different order may have different sizes. Size of struct is counted accordingly with padding and alignment rules.

Struct alignment: 8

Fields Aligment
a string


b bool

padding

c string