liveBook · Manning

Memory management model

As explained in Go in Practice, Second Edition

Memory management is the allocation, use, lifetime control, and reclamation of memory occupied by program data.

Go uses a runtime and garbage-collection system to reduce the day-to-day burden of memory management compared with C, where memory is intentionally managed without a garbage collector. section 1.3.1

This model suits systems, server, and cloud applications, but Go’s runtime and garbage collector are a poor fit for embedded systems with limited resources. section 1.3

Comparable memory-management approaches include:

  • Rust uses a borrow checker for more granular control over variable and data lifetimes. section 1.3.2
  • Zig provides no garbage collection by default and uses smart pointers for memory safety. section 1.3.2
  • C exposes risks including memory leaks and buffer overflows when memory is managed manually. section 1.3.1

How Go in Practice, Second Edition covers it

How deep it goes
Contrasts manual management, garbage collection, borrow checking, and smart pointers without explaining their implementation internals.
Examples
Compares memory-management choices across Go, C, Rust, Zig, and embedded-system workloads.
What you can do after
Evaluate/understand how garbage collection, manual management, borrow checking, and smart pointers trade convenience against lifetime control.
How it connects
Connects memory management with garbage collection, memory leaks, buffer overflows, borrow checking, smart pointers, and embedded systems.

Also explained in

Compare how 3 books explain memory management model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Go in Practice, Second Edition. The section links point to the parts of the book it draws on.