Possible duplicate:Is it allowed to free memory
This is a common question. I have several projects on the C ++ desktop that work with some global data structure. My question is, before exiting the applications, do I need to free memory for these data structures? In any case, the memory will be destroyed by the OS after closing the application.
Short answer: No ( Yes , if you are pedantic enough (that's good) ... see edit)
All memory allocated by the program will be automatically freed by the operating system when the program exits.
, , , , .
. @David Thornley , . , , , , , . , , , , .
, , , alocate, . , , valgrind
, . Undefined ++. .
, , , , . , , .
If you know exactly what global objects you leave hanging in the end, then this is absolutely normal.
It may be good practice to always write code that stops completely so as not to miss actual leaks; it just depends on your confidence in your code.
Source: https://habr.com/ru/post/1616837/More articles:why can't import pandas after successful installation? - python-3.xhow to filter a cassandra request by field in a user-defined type - cassandraЕсть ли какой-нибудь плагин в Android Studio для создания подпапок Layout? - androidHow to disable Eclipse error reporting for .md files - eclipseMulti-line extended header in CollapsingToolbarLayout Android? - androidPhpMyAdmin error: table does not exist in the engine - phpmyadminЕсть ли разница между разрезами списков Python [-1:] и [-1]? - pythonA faster way to search for strings in a large file using python - pythonProblems with the wrong time zone on Android - javaWKWebView: get the name of the selected link - iosAll Articles