Possible Duplicate:
What REALLY happens when you don’t free after malloc?
When ending a program in C/C++, you have to clean up by freeing pointers. What happens if you doesn't free the memory, like if you have a pointer to an int and doesn't delete it when ending the program? Is the memory still used and can only be freed by restart, or is it automatically freed when the program ends? And in the last case, why free it, if the operating system does it for you?