
Keith B. answered 08/22/19
Software Engineer and Math Geek
When you are dealing with pointers in C++, you are responsible for the memory you allocate. That means if you use new you must have a delete somewhere to clean it up. Otherwise you get what is know as memory leak, a common issue in large projects.
To combat this issue, other languages have what is known as garbage collection - they manage it for you. In such a language (like Java) when the system discovers that a pointer is no longer in use, it frees up the memory for you. In C++, they introduced smart pointers to have a similar effect.