4 ms·
That's essentially how all leak detection tools work, minus the money part. And it is not even always appropriate. It is common to allocate some memory for the
by GuB-42 3y ago
That's essentially how all leak detection tools work, minus the money part.
And it is not even always appropriate. It is common to allocate some memory for the entire lifetime of the process. For example, if your app is GUI-based and has a main window, there is no need to free the resources tied to the main window, because closing it means quitting the app which will cause all memory to be reclaimed by the OS. You can properly free your memory but it will only make quitting slower. Usually programmers only do that to satisfy leak detection tools, and if the overhead is significant, it may only be done in debug mode.