Memory Leak
Sign in

memory leak

Analyst Programmer
See interview of Abhishek Kumar Sahay
Memory leaks are caused by programs that allocate virtual memory, fail to free after they are finished with it. Memory leaks are nasty program bugs that are sometimes difficult to find. A program containing memory leak bug often executes to completion and produces the correct results, so the presence of the bug is not always detected. In fact, as long as the program containing the memory leak does not impact other executing processes, the bug can go undetected for a long time.

The telltale sign of a memory leak is that Committed Bytes at the system level and/or Virtual Bytes at the process level are continuously increasing. Eventually, a program with a memory leak exhausts the system’s supply of virtual memory, which can cause other running programs and even system code to fail as the system runs up against the virtual memory Committed Bytes limit. Depending on the rate at which the defective program leaks memory and the amount of excess virtual memory available, it can be a long time before any dire effects are evident.

A program that is leaking memory by allocating and then failing to free some private virtual memory areas is relatively easy spot because the process Virtual Bytes counter is continuously increasing. It is often harder to detect programs that allocate shared memory from the system’s Pageable Pool and fail to release that. Because virtual memory allocated in the shared memory region of the Pageable Pool is not associated with any specific process, finding the offending program can be difficult. Often, it is necessary to use the process elimination to find the offender.
start_blog_img