📄️ Escape Analysis: Stack vs Heap Allocation
How the Go compiler decides whether a variable lives on the stack or escapes to the heap, and how to read -gcflags output to understand allocations.
📄️ defer Internals: Stack, Argument Evaluation, and Hot Loop Cost
How defer works at the runtime level, when arguments are evaluated, and why deferring inside a tight loop is an anti-pattern.
📄️ Map Internals: Hashing, Buckets, Growth, and Random Iteration
How Go maps work internally — the bucket structure, hash function, map growth strategy, and why iteration order is intentionally randomized.
📄️ Slice Internals: len, cap, append Growth, and Shared Backing Arrays
How Go slices work under the hood — the three-word header, append's growth strategy, and the subtle bugs from shared backing arrays.
📄️ String Immutability and []byte Conversions
Why Go strings are immutable, what happens when you convert between string and []byte, and how to avoid unnecessary allocations in string-heavy code.
📄️ GC Basics: Tri-Color Marking and STW Phases
How Go's garbage collector works — the tri-color mark-and-sweep algorithm, stop-the-world phases, and what drives GC frequency.
📄️ Write Barrier: Why It Exists and Its Performance Impact
The write barrier is the mechanism that keeps Go's concurrent garbage collector correct. Here's what it does and what it costs.
📄️ Memory Alignment and False Sharing in Structs
How Go aligns struct fields, why field order affects struct size, and how false sharing between CPU cache lines can destroy performance in concurrent code.
📄️ init() Order and Package Init Traps
How Go determines the order of init() function execution across packages and files, and the subtle bugs that arise from side effects in init.