⚙️Memory Safety
Also known as Memory-Safe Language, Memory Safe, Memory Unsafety
A guard that stops code from using memory it does not own.
Think of it like
It is like a parking lot with painted lines and a guard. Nobody can park in a space that is not theirs.
Example
The team that makes the Chromium web browser looked at its worst security bugs. About 70% of them came from unsafe use of memory.
Why it matters
Memory bugs cause a lot of the worst security holes. A safe language rules out whole kinds of them.
Definition
Example code
python
scores = [90, 75, 88, 60]
scores[6] = 100
# IndexError: list assignment index out of rangeCommon mistake
Key takeaways
- 1Stay in bounds. No reading past the end.
- 2No use after free. Freed memory stays off limits.
- 3Fewer security holes. Whole bug types disappear.