+ 1
What happens when dynamically allocated memory is not freed?
In C programming, memory can be dynamically allocated using functions like malloc() and calloc(). After finishing to use such memory, it can be freed using free() function. What happens if free() function is not used? Will such memory get freed itself after the program terminates or will it remain for forever?
2 Respuestas
+ 6
It will be freed after the program terminates but not while the program is running, so if that memory is no longer used while a long-term program is running like a high availability server, you have a memory leak. Unlike Java etc. C has no automatic garbage collector to free unused memory automatically.
+ 1
Okay I got it. Thanks for the answer!!!