Step Into Labs

Step Into C · Lesson 26 · Win32 in Depth

Memory: Pages, Protections and Heaps

VirtualAlloc reserve vs commit, VirtualProtect and VirtualQuery, private heaps, and when to use which.

Part of Step Into C. The full lesson, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.

malloc and new sit on top of a heap, and a heap gets its pages from the virtual memory layer.

In this lesson

Missions

  1. The two magic numbers
  2. Reserve, then commit
  3. Change the protection
  4. A heap of your own