Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: Intermediate
Jul 31, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Memory Deallocation Myths

A common myth among programmers says that you can avoid calling delete in your application because the operating system will release the allocated memory when the application terminates anyways. Indeed, modern operating systems release leaked memory after an application terminates. However, there's a substantial difference between releasing raw memory and properly destroying objects. The operating system will perform the former operation but it will not call object's destructors, flush unclosed streams, release locks, and so on. Therefore, never rely on the operating system's cleanup operation. Instead, delete all allocated objects before the application terminates.
Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date