What is memory leak in c? I have googled it and my conception is still unclear after that or maybe I'm not satisfied with it. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is memory leak in c? I have googled it and my conception is still unclear after that or maybe I'm not satisfied with it.

15th Aug 2021, 9:04 PM
Akila Nipo
Akila Nipo - avatar
2 Answers
+ 2
For the second question Yes, a memory leak only happens for dynamically allocated memory on heap, the objects on the stack memory are automatically destroyed when they go out of scope.
16th Aug 2021, 1:23 AM
Arsenic
Arsenic - avatar
0
Thank you so much for clarifying in detail... I'm almost clear now..... I have another question.Is it that memory leak always happens for memory allocation only in the heap segment of the memory?
15th Aug 2021, 9:29 PM
Akila Nipo
Akila Nipo - avatar