We build the malloc() and free() functions from scratch, seeing how memory allocation actually works. This screencast is done entirely in C, but it's OK if you don't know C already; we'll introduce the necessary ideas as we go.

(Nitpicky note: the comment in this screencast about pointers and arrays being "the same" will ruffle experienced C programmers' feathers. The C language does distinguish between arrays and pointers, so the comment is strictly wrong. However, thinking of arrays as being pointers will help new C programmers to understand what's actually happening: arrays are laid out directly in memory, with no extra metadata added, so the address of the array itself is also the address of the first element of the array. Simplifying this to "arrays are lies; they're really just pointers" is easier to grasp for someone who's new to C.)

Execute Program

Looking for something more interactive? Try Execute Program, an interactive learning platform from Destroy All Software LLC! It has courses on TypeScript, SQL, regular expressions, JavaScript concurrency, and more. All Destroy All Software subscriptions include full access to Execute Program, or you can subscribe to Execute Program directly.