Skip to content
New this month 24 fresh C++, C#, F#, JavaScript, TypeScript and Lua courses just landed. Browse new releases Use code WELCOME10 for 10% off your first order · 14-day refund
Systems & Low-Level Intermediate Save 34%

How Memory Really Works: Stack, Heap, Cache Lines and Allocators

The mental model behind every performance problem you have ever failed to explain.

Rated 5.0 out of 5 from 2 reviews 25 students

AP Created by Ana Petrova

  • Last updated August 2026
  • English
  • 3h 42m of material
  • 28 lessons

What you will learn

8 concrete outcomes

Every bullet below is something you will have built, shipped or be able to explain by the time you finish the last lesson.

  • Describe the process address space: stack, heap, static and thread-local storage
  • Explain what an allocator does and why allocation cost varies so widely
  • Measure your own cache hierarchy and see the L1, L2 and L3 boundaries
  • Lay out data for locality, and quantify the gain rather than assuming it
  • Recognise false sharing between threads and fix it with alignment
  • Implement arena and pool allocators for predictable, low-latency workloads
  • Interpret perf and cachegrind output including cache miss and branch statistics
  • Reason about garbage-collected runtimes and where the same rules still apply

Course curriculum

5 modules · 28 lessons · 3h 42m of material

6 lessons running 48m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

5 lessons running 40m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

6 lessons running 48m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

6 lessons running 46m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

5 lessons running 40m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

5 modules · 28 lessons

3h 42m total length

Requirements

Short list, and deliberately so. If you meet these you can start today.

  • Comfortable in a systems language; examples use C++, Rust and Go
  • A Linux machine or virtual machine for perf, with Windows alternatives noted
  • Basic familiarity with pointers and arrays

About this course

Two functions can perform identical work and differ by a factor of ten in runtime. The difference is almost never the instructions, it is memory: where data lives, how it is laid out and how often the processor has to wait for it. This course builds the model that explains those factors.

You begin with the address space: stack frames and why they are fast, the heap and what an allocator does on every call, static and thread-local storage, and virtual memory with pages, the translation lookaside buffer and page faults. Then the cache hierarchy, with a benchmark you run yourself that reveals L1, L2 and L3 boundaries as visible steps on a graph produced from your own machine.

The applied modules turn that into decisions: array of structures versus structure of arrays, alignment and padding, false sharing between threads, prefetching and access patterns, arena and pool allocators, small-buffer optimisation, and how garbage-collected runtimes change the picture in Go, Java and JavaScript. Every claim is measured with perf and cachegrind so the numbers come from your hardware, not from folklore.

Topics covered

Frequently asked questions

Still unsure about something? Write to misteryjj100@gmail.com and a human answers, usually the same working day.

It helps, since perf and cachegrind are the primary tools. Windows alternatives using Visual Studio and Intel VTune are documented, and a container recipe is provided.

Yes. Locality and allocation pressure matter in every runtime, and the final module covers exactly how garbage collection changes the advice.

No. A few short listings appear to show alignment and padding, and they are explained line by line where they do.

Checkout is handled on our provider's secure payment page. The moment your payment clears we email your personal access link and access code to the address you used at checkout, and the same link appears in your account library. There is nothing to install and nothing to wait for.

Email misteryjj100@gmail.com within 14 days of your purchase, quote your order number, and we refund the full amount to your original payment method. No form to fill in and no questions about how much of the course you watched.

What students say

Reviews are written by people who bought this course. We publish the critical ones too.

5.0

Rated 5.0 out of 5

Course rating · 2 reviews

Rating distribution

  • 5 stars 100%
  • 4 stars 0%
  • 3 stars 0%
  • 2 stars 0%
  • 1 star 0%
  • KA

    Kwame Asante

    Performance engineer

    Feb 2026
    Rated 5.0 out of 5

    You measure the cache yourself

    Instead of quoting latency figures off a slide, you write the stride benchmark and watch your own machine's cache levels appear as steps in the graph. I have never once forgotten a number I measured myself.
  • RM

    Riikka Mäkinen

    Systems developer

    Oct 2025
    Rated 5.0 out of 5

    False sharing without the hand-waving

    I had read about false sharing a dozen times and never quite believed it mattered at my scale. Watching two counters on one cache line wreck a four-thread benchmark, then adding padding and seeing the throughput come back, settled it.

Your instructor

AP

Ana Petrova

Systems engineer and C++ instructor

  • 206 students taught
  • 9 courses published
  • 4.4 instructor rating
  • C++
  • Systems programming
  • Memory management
  • Concurrency

Ana spent nine years writing real-time C++ for trading infrastructure before moving into teaching full time. She specialises in the parts of the language people quietly avoid: templates, move semantics, custom allocators and the memory model. Her courses are built around profiling sessions on code that is deliberately slow, so every fix is something you measure rather than memorise. She still contributes to two open-source benchmarking libraries.

$19 USD $29 Discounted from $29. You save 34 percent.

One-time payment · lifetime access

The WisdomCharms dispatch

One useful email a week. No fluff, no spam.

New course releases, discount codes before anyone else, and a short, practical breakdown of one technique — a prompt pattern, a C++ idiom, a TypeScript trick — that you can use the same day.

  • Subscriber-only launch pricing
  • Unsubscribe in one click
  • We never sell your address

By subscribing you agree to our Privacy Policy. Questions? Write to misteryjj100@gmail.com.