Linkers, Loaders & Executables
After repeated malloc and free, a large block may become impossible to allocate even though total free memory is sufficient. What is this phenomenon called?
- AA memory leak
- BFragmentation
- CA stack overflow
Show answer and explanation
Answer: B. Fragmentation
Repeatedly allocating and freeing blocks of different sizes scatters small free gaps between blocks in use. Even if total free space is large, a big allocation fails without a large contiguous gap. This is called fragmentation. Allocators reduce it by managing blocks by size class and merging adjacent free blocks. It needs special care in embedded devices that run for a long time.
- A. A memory leak is losing memory by forgetting to free it.
- B. Correct. Free space is split into small pieces.
- C. A stack overflow is exceeding the stack limit.