Windows 7 cleans up C++ memory leaks? Windows 7 cleans up C++ memory leaks? windows windows

Windows 7 cleans up C++ memory leaks?


When the program terminates, the operating system reclaims all the memory that had previously been allocated to it. Cleaning up memory leaks may be a perceived by-product of this, but the OS does not actually see it that way. It does not know that the program had been leaking memory, just that it had allocated it.


Once a process in which your application runs exits, the OS reclaims all the memory allocated to the process.

This is typically true for all operating systems not just Windows 7 or Windows for that matter.

Note that, you may observe different behavior for other leaking resources like file handles etc, usually OS'es dont reclaim those. So, it is usually(Yes,there are exceptions) a good practice to make your own application clear the mess(deallocate the allocated resource) that it made instead of delegating it to the OS.


Not only does the program manages memory but does the OS too. And it reclaims all the memory allocated to a program after it exist. It doesn't interfere in between the execution of the program (Other than for paging and swapping). This control over memory of the OS helps the OS from crashing from memory leaks to a point.

Memory management is the act of managing computer memory. The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and freeing it for reuse when no longer needed. This is critical to the computer system.

BSD Unix normally starts reclaiming memory when the percentage of free memory drops below 5% and continues reclaiming until the free memory percentage reaches 7%