If one were to categorize to fine-granularity memory errors (typically caused via programming in C or C++), one would have a difficult time of it—hundreds of types exist! Instead, let's keep the discussion manageable and check out what would be considered the typical or common memory errors that befall us poor C programmers:
- Incorrect memory accesses
- Using uninitialized variables
- Out-of-bounds memory accesses (read/write underflow/overflow bugs)
- Use-after-free/use-after-return (out-of-scope) bugs
- Double-free
- Leakage
- Undefined behavior (UB)
- Data Races
- Fragmentation (internal implementation) issues
- Internal
- External
All these common memory issues (except fragmentation) are classified as UB; still, we keep UB as a separate entry as we will explore it more deeply. Also, though the word bug is colloquially used, one should really (and more correctly...