AI 与机器学习
在 Go 中恰到好处的内存对齐
Posts on 煎é±0 次浏览
问题 type Part1 struct { a bool b int32 c int8 d int64 e byte } 在开始之前,希望你计算一下 Part1 共占用的大小是多少呢? func main() { fmt.Printf("bool size: %d\n", unsafe.Sizeof(bool(true))) fmt.Printf("int32 size: %d\n", unsafe.Sizeof(int32(0))) fmt.
原文:https://eddycjy.com/posts/go/talk/2018-12-26-go-memory-align/
