Releasing Dynamically Allocated Memory
Any memory dynamically allocated with new
must be released with delete
. The delete
operator can be used in two ways: one for de-allocating memory allocated to arrays with new
and the other for deleting single objects.
Note that the compiler is not required to generate a diagnostic message for using the wrong delete
. Furthermore, using the inappropriate deallocator will result in undefined behavior.
Read more about this topic: New (C++)
Famous quotes containing the word memory:
“Perhaps a man like you cant realize what it is to have a conscience and no memory at all. Do you imagine its pleasant to be ashamed of something you cant even remember?”
—Orson Welles (19151985)