c++resource-management

Why free resources if the program is already quitting?


Many libraries like SDL, etc, etc have in their tutorials method calls that free resources right before quitting the program, but as far as I know, most OSes free all memory from the processes when they quit, why do I need to bother to free them if the application is going to quit anyway?


Solution

  • Even if your OS (not all do that) frees memory at exit, there are some reasons: