In the continued lecture of week 5, it is stated that if we don't free memory in our programs, this can lead to a memory leak. But, just to be clear, when my program exit, all the memory used by my program will be freed, isn't it? So the memory leak reported by valgrind could occour only during the execution of my program, right? Sorry if this is a dumb question.

1 Answer 1


Pretty much. In very specific environments Application allocated memory may not be fully freed when the application exits. But it's safe to say that in any regular OS'es (including the one you're working in) all memory gets freed up when you terminate the application.

So in that sense: Yeah the memory leak reported by Valgrind refers to something that's not freed during the execution of your program.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .