The OS that runs your program usually does a memory cleanup that is not freed explicitly, and processes that do not close explicitly, but this is not guaranteed by the C ++ standard. You may find some kind of built-in device that does not fix memory leaks.
In doing so, Windows and all the Linux distributions I have ever seen eliminate memory leaks.
You can easily create a huge loop of memory leaks to test it yourself. Watch how the amount of RAM used is growing, and then close the program. You will see that the use of RAM is reduced.
Another consideration when using C ++ is that if you do not delete the allocated memory for the heap, then your destructors are also not called. Sometimes you will have other side effects if your destructors are not called.
Brian R. Bondy Jun 04 2018-10-06T00-06-04 16:06
source share