+ 2

does heap allocated memory delets after program shut?

27th Jul 2017, 7:55 AM
amarnath kumar
amarnath kumar - avatar
2 Answers
+ 7
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
27th Jul 2017, 8:25 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
It depends on the operational system. Most do, but a custom made operational system might not.
27th Jul 2017, 3:04 PM
Denis Felipe
Denis Felipe - avatar