Possible Duplicate:
When you exit a C application, is the malloc-ed memory automatically freed?
Pretty much the title. Do (modern) OSs automatically reclaim heap-allocated memory on program termination? If so, is freeing the memory a strict must or more of a just-follow-the-damn- standard-you-fool kinda thing?
What is the worst thing than can happen if I do not explicitly free the memory except that I end up wasting it while the application is in run?
When an application terminates, all memory will be reclaimed by the OS. The reason people preach memory management techniques is because so long as the app is running, any memory it’s asked for will remain in its posession (even if it’s no longer being used). Unless, of course, you were nice enough to call
free.