⚙️Memory Management
Also known as Memory Allocation, Manual Memory Management
How a program gets room for its data. Then it gives the room back.
Think of it like
Think of it like borrowing books from a library. You take what you need and bring it back when you are done.
Example
Emma's C program asks for room for 1,000 numbers with malloc. When it is done with them, it calls free so the memory can be used again.
Why it matters
Getting it wrong causes crashes, slow apps and security holes. Most languages today handle it for you for that reason.
Definition
Common mistake
Key takeaways
- 1Take, then return. Every piece of memory.
- 2By hand or automatic. C by hand, Python automatic.
- 3Mistakes are costly. Crashes, leaks, holes.