PDA

View Full Version : Memory leaks




bahlquist
Oct 16, 2010, 07:53 PM
If you fail to release memory in a program, what is the worst that can happen? Is it just the case that you must shutdown the computer to release the memory, or can you have more significant problems?



lee1210
Oct 16, 2010, 09:12 PM
Nothing of that severity at all. When your program exits, the memory is returned to the system. Worst case users have to restart your program as it gets bloaty, and they get sick of doing so, and stop using your program. You're not going to do anything to hardware, etc.

-Lee

EDIT: I guess if you leak badly enough that the system exhausts RAM and swap then the OS will no longer be able to grant requests for memory, and the system will start behaving oddly. This is the most extreme case, but it happens.