<![endif] RSS Blog Archive (by date) Archive (by popularity) About Dec 4 th , 2014 Let’s write a malloc and see how it works with existing programs! This tutorial is going to assume that you know what pointers are, and that you know enough C to know that *ptr dereferences a pointer, ptr->foo means (*ptr).foo , that malloc is used to dynamically allocate space , and that you’re familiar with the concept of a linked list. If you decide to work through this tutorial without really knowing C, please let me know what parts could use more exposition. If you want to look at all of this code at once, it’s available here . The tests are from Andrew Roth, who had a github repo lying around with some tests for malloc. Preliminaries aside, malloc’s function signature is void *malloc(size_t size); It takes as input a number of bytes and returns a pointer to a block of memory of t...