Interview Questions

I have a program which mallocs and later frees a lot of memory

C Interview Questions and Answers


(Continued from previous question...)

I have a program which mallocs and later frees a lot of memory

Q: I have a program which mallocs and later frees a lot of memory, but I can see from the operating system that memory usage doesn't actually go back down.

A: Most implementations of malloc/free do not return freed memory to the operating system, but merely make it available for future malloc calls within the same program.

(Continued on next question...)

Other Interview Questions