The Two Zones of Memory NOBODY Explains | Stack vs Heap

Опубликовано: 17 Июнь 2026
на канале: HEX 1000
765
30

Every variable you've ever written lives somewhere. Most programmers
never think about where.

Turns out, your program has two completely different memory zones —
with completely different rules. One cleans up after itself. The other
doesn't. One dies when your function ends. The other outlives everything.

And the difference between them is the difference between a program
that works, and a program that slowly eats all your RAM and crashes
two hours later.

In this video we open up both zones, write real C code that shows
exactly what's happening inside, and connect it to the thing everyone
wants to understand — why an 8GB laptop can't run a 20GB AI model.

▶ Chapters:
0:04 — The lie your variables tell you
0:25 — RAM has two halves
1:00 — Why most tutorials skip this
1:15 — The stack — the plate dispenser
2:06 — The heap — the warehouse
3:04 — C code: seeing both zones in real memory
6:24 — Stack overflow — what actually happens
8:33 — Why your AI model lives in the heap

▶ Code from this video:
stack_demo.c — local variables on the stack, address proof
heap_demo.c — malloc, free, heap objects that survive functions
overflow.c — recursive crash, segmentation fault live

▶ HEX 1000 — Computer Science & AI explained from first principles.
Series A: CompSci & AI fundamentals
Series B: Python from scratch

Logic behind the code.

#ComputerScience #Programming #Memory #StackVsHeap #C #LearnToCode
#SoftwareEngineering #ComputerArchitecture #AI #MachineLearning
#ProgrammerLife #CodingForBeginners #DevCommunity #100DaysOfCode
#TechEducation #LowLevel #SystemsProgramming #HEX1000