does heap allocated memory delets after program shut?
Most operating systems will deallocate the memory when your program ends. However, the C++ standard doesn't guarantee that the OS will clean up the memory for you. It is good practice to deallocate it explicitly for reasons. https://stackoverflow.com/questions/677812/is-there-a-reason-to-call-delete-in-c-when-a-program-is-exiting-anyway
It depends on the operational system. Most do, but a custom made operational system might not.