In other words, why doesn't free() just return the memory to the operating system, and malloc simply request memory from the operating system?
This unpacks to three closely related questions:
- Why does
Cneed to manage its own heap? (Is it because the OS will only allow you to allocate and free contiguous memory of a minimum size?) - Assuming what I wrote in parentheses is true, why is it?
- Can this problem affect the operating system itself, so that it's unable to allocate blocks of memory to any running processes?