Memory Allocation in Go | Melatoni
This blog post primarily focuses on Go 1.24 programming language running on Linux on ARM architecture. It may not cover platform-specific details for other operating systems or hardware architectures. The content is based on other sources and my own understanding of Go, so it might not be entirely accurate. Feel free to correct me or give suggestions in the comment section at the very bottom 😄. Memory allocation is at the heart of every programming language runtime, and Go is no exception. Efficient allocation and management of memory directly affect the performance, scalability, and responsiveness of Go applications. While Go abstracts away most of the complexity through its simple APIs (new(T), &T{} and make), understanding what happens under the hood gives us valuable insight into how the runtime achieves efficiency, and where potential bottlenecks may arise. In this post, we’ll explore Go’s memory allocator in depth. We’ll look at its core components, how they interact to serve al
Memory Allocation in Go | Melatoni Memory Allocation in Go Contents Introduction Go’s View of Virtual Memory Arena and Page Span and Size Class Span Class Span Set Heap Bits and Malloc Header Heap Management Span Allocation: mheap.alloc Central Span Manager: mcentral Processor’s Memory Allocator: mcache Heap Allocation Tiny Objects: mallocgcTiny Small Objects: mallocgcSmall* Large Objects: mallocgcLarge Stack Management Allocating Stack: stackalloc Stack Growth: morestack Reusing Stack: stackfree Stack or Heap? Case Studies Disclaimer This blog post primarily focuses on Go 1.24 programming lan
Explore this link on the map →saved by
related reading
- Frequently Asked Questions (FAQ) - The Go Programming Languagego.dev
- Diagnostics - The Go Programming Languagego.dev
- A Guide to the Go Garbage Collector - The Go Programming Languagego.dev
- Go at Google: Language Design in the Service of Software Engineering - The Go Programming Languagego.dev
- [Java][Profiling] Async-profiler - manual by use cases | JVM/Java profiling and tuningkrzysztofslusarski.github.io
- Avoiding high GC overhead with large heaps | Gopher Academy Blogblog.gopheracademy.com
- CS107E Assignment 4: Stack and Heapcs107e.github.io
- Profiling Go programs with pprofjvns.ca
- abseil / Performance Hintsabseil.io
- Untangling Lifetimes: The Arena Allocator - by Ryan Fleurydgtlgrove.com
- Syscall implementation | CS 162 HW 4cs162.org
- Allocators | zig.guidezig.guide