Heap Memory
We introduce heap memory and contrast it with the stack using a refactored drawPolygon example that allocates a Line array on the heap, showing how local variables on the stack hold references to heap objects and why a garbage collector is necessary.