Home > Software > Testing > Manual-Testing
Interview Questions   Tutorials   Discussions   Programs   Videos   

Manual-Testing - What is memory leak and how you will find memory leak ? Which tools can be used to find out memory leak ?

asked mar August 24, 2014 08:38 AM  

What is memory leak and how you will find memory leak ? Which tools can be used to find out memory leak ?


1 Answers

answered By kpreeti2011   0  
A memory leak or space leak occurs when a computer program incorrectly manages memory allocations. In object-oriented programming, a memory leak may happen when an object is stored in memory but cannot be accessed by the running code. A memory leak has symptoms similar to a number of other problems and generally can only be diagnosed by a programmer with access to the program.
Because they can exhaust available system memory as an application runs, memory leaks are often the cause of or a contributing factor to software aging.
How to find a Memory Leak
To locate a memory leak, use the following process:
  • Find the memory leak – Detect the presence of a memory leak in the system, given a particular reproducible sequence. You should be able to identify a specific process, but demonstrating an overall increase in committed system memory can qualify a memory leak as well.
  • Isolate the memory leak – Determine the exact location in the source code where the un–freed allocation occurs. This can be a lengthy and tedious process, requiring specific tools, trial–and–error, and teamwork with the original author of the code.
  • Fix the memory leak – After the first two steps are completed, this is easy. Fixing the memory leak usually involves adding some code to free the memory in the questionable code path.
The information that can be gathered in the first step becomes very helpful in completing step 2 and step 3.
Checking Memory
Basically, you can spot a memory leak when you detect an unexplained increase in either committed system memory—memory used by various applications—or in memory owned by a specific application. There are several approaches to take for checking the current memory situation, as follows:
Run the mi command. At the cesh prompt, type mi. This command generates a list of memory usages for each running application. In the Page Summary line specified for each application, you will see “r/w=” followed immediately by a number. This number indicates the number of allocated pages of memory for the indicated application. If this number is unexpected or has grown unexpectedly, you may have detected a memory leak in the indicated application.
Additional tools are available to snapshot the available memory, however, the approaches described above are recommended.
Valgrind is a multipurpose code profiling and memory debugging tool for Linux used to find memory leak.
   add comment

Your answer

Join with account you already have



Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!