Skip to content

Commit 88cb912

Browse files
committed
Update example
1 parent 00c975c commit 88cb912

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/examples/basic/structs/struct_memory_padding.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import (
88
)
99

1010
// MemoryPadding は、構造体メンバーの定義順によってGoランタイムがメモリ上にパディングを挿入することを確認するサンプルです.
11+
//
12+
// REFERENCES:
13+
// - https://itnext.io/structure-size-optimization-in-golang-alignment-padding-more-effective-memory-layout-linters-fffdcba27c61
14+
// - https://logicalbeat.jp/blog/4032/
15+
// - https://ja.wikipedia.org/wiki/%E3%83%87%E3%83%BC%E3%82%BF%E6%A7%8B%E9%80%A0%E3%82%A2%E3%83%A9%E3%82%A4%E3%83%A1%E3%83%B3%E3%83%88
1116
func MemoryPadding() error {
1217
var (
1318
st4bytes = types.Struct4Bytes{} // メモリ上のサイズが 4bytes になる構造体

0 commit comments

Comments
 (0)