c++ - Not deleting dynamically allocated memory and let it get free by the OS after programme termination -


i have read question , answer dynamically allocated memory after program termination, , want know if okay not delete dynamically allocated memory , let freed os after programme termination. so, if have allocated memory objects need thoughout programme, ok skip deleting them @ end of programme, in order make code run faster?

the short answer yes, can, long answer possibly better not that: if code needs refactored , turned library, delivering considerable amount of technical debt person going job, you.

furthermore, if have real, hard-to-find memory leak (not memory leak caused intentionally not freeing long-living objects) it's going quite time consuming debug valgrind due considerable amount of noise , false positives.

have @ std::shared_ptr , std::unique_ptr. latter has no overhead.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -