Go Right Ahead! Simple Hacks to Cut Memory Usage by 80&
summary
Cubescape reduces memory usage by ~80%, dropping a hot function from 33.64 GB to 0.85 GB by applying concrete fixes: reorder struct fields to avoid padding, preallocate slices to stop repeated resizes, avoid unnecessary pointers or use sync.Pool for reuse, compile regexes once, and limit concurrent goroutines with timeouts/cancellation. Memory hotspots are found and validated with pprof heap profiles and benchmarks so each change shows measurable impact before deployment.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:50Agenda
- 2:12Why is it important
- 3:08Challenges
- 3:44Tradeoffs
- 5:28Golang Memory Model
- 10:09Size declarations
- 12:03Pointer usage
- 13:35Regular Expressions
- 14:37Loops
- 16:02Go routines
related talks
19mHeap Optimization for Go Systems
14mMemory Optimization through Structure Packaging
30mMemory Management in Go: The good, the bad and the ugly
26mPractical Memory Profiling
24m"Slice Recycling Performance and Pitfalls"
40mGolang memory footprint
51mEvolving the Go Memory Manager's RAM and CPU Efficiency
48mGolang's Garbage
