indexPointers & Memory#pointers#memory#allocators#heap#c-layer

Pointers & Memory

This is the branch where low-level either clicks or doesn't. A pointer is just an address with a type; from that one idea comes everything that makes C fast and everything that makes it dangerous. We go deep on the stack and the heap, malloc/free, pointer arithmetic, struct layout, the classic bugs (use-after-free, double-free, leaks, overflows), and writing your own allocators so you stop treating memory as infinite and start managing it with intention.

Memory is not a detail the language hides from you here — it's the material you work in. Owning it means knowing who allocates, who frees, and what every byte of a struct is doing.

Planned notes

Core sources

  • Ulrich Drepper — What Every Programmer Should Know About Memory — the memory paper. https://www.akkadia.org/drepper/cpumemory.pdf
  • CS:APP — dynamic memory allocation chapters — how malloc actually works. https://csapp.cs.cmu.edu/
  • Richard Reese — Understanding and Using C Pointers (O'Reilly) — pointers end to end. https://www.oreilly.com/library/view/understanding-and-using/9781449344535/
  • Ryan Fleury — Untangling Lifetimes: The Arena Allocator — arena allocation as a design tool. https://www.rfleury.com/p/untangling-lifetimes-the-arena-allocator
  • Doug Lea — A Memory Allocator (dlmalloc) and Dan Luu malloc writeups — real allocator internals. https://gee.cs.oswego.edu/dl/html/malloc.html · https://danluu.com/malloc-tutorial/

Connects to: C from the Metal · Machine Model · Assembly & Compiler Output · OS from Scratch