We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
If a program is just about to terminate, not really. The OS is more efficient at cleaning up than you because it only has to mark pages as free. It doesn't have to touch each object and it can free paged out memory without paging it in.
Of course, if you're holding database connections etc, then yes you want to explicitly deallocate those, and it may be better to explicitly deallocate everything than to try and pick and choose. But if it's just memory, leave it.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Virtual Functions
You are viewing a single comment's thread. Return to all comments →
If a program is just about to terminate, not really. The OS is more efficient at cleaning up than you because it only has to mark pages as free. It doesn't have to touch each object and it can free paged out memory without paging it in.
Of course, if you're holding database connections etc, then yes you want to explicitly deallocate those, and it may be better to explicitly deallocate everything than to try and pick and choose. But if it's just memory, leave it.