Memory

This part of the C course is memory: the stack and the heap, malloc, calloc and realloc, the leaks and double frees that follow them, and the arenas and pools that replace many small allocations with one. It closes with undefined behaviour and with the sanitizers that catch it in a test run instead of in production.

30 The stack and the heap frames, automatic objects, heap lifetime, when to allocate Open 31 malloc, calloc and realloc allocation, zeroing, growth, free, alignment Open 32 Memory leaks and ownership leak hunting, double free, use after free, ownership rules Open 33 Arenas and pools bump allocator, free lists, bulk reset, cache locality Open 34 Undefined behaviour overflow, out-of-bounds, uninitialised reads, strict aliasing Open 35 Sanitizers AddressSanitizer, UndefinedBehaviorSanitizer, LeakSanitizer Open

Lessons