I've got a desktop program. Most Operating Systems run the program in its own address space.
When the program exits, I believe most operating systems free the memory allocated by the program and return it to the memory stack for reuse.
What I am not sure of, is if the program has a memory leak, will the memory "leaked" also be returned for reuse, or is it lost until the machine is rebooted?
This is a followup to the question I asked earlier today: Do Small Memory Leaks Matter Anymore?, and a couple of comments there mentioned that program memory is freed when a program finishes. If leaks are freed when a program is done, then it definitely puts less pressure on me to rigorously rid my program of the tiniest leaks.
Specifically, I'm a Windows programmer and I need to know what happens (memory lost or memory freed) for Windows 98, 2000, XP, Vista and 7. But I'd also like to hear what happens on Mac and Unix machines.
Clarification: I am talking about non-growing leaks. These are leaks of a constant size that happen once when a program is run.
I do realize that leaks that are continually growing in a program are severe and must be fixed.
Either way, the question isn't about whether or not leaks must be fixed. It is whether or not the Operating Systems give you back the leaked memory when the program ends.