To illustrate the difference, I wrote two quick programs.
This one has memory that the OS can recover:
#include <stdlib.h>
int main(void) {
char *a = malloc(10);
return 0;
}
This one has memory that the OS cannot recover: #include <stdlib.h>
int main(void) {
char *a = malloc(10);
a = malloc(10);
return 0;
}