Subscribe via E-mail

Your email:

published qa papers free

Browse by Tag

Posts by Month

Follow Me

NTT DATA Canada Discussion Room

Current Articles | RSS Feed RSS Feed

Memory Leak Testing

 

Memory Leak Testing

It can crash your application, can you afford to ignore it?

Written by Sunil Damle

Memory Leak

Memory leak testing is an important aspect of a software testing process but often it is ignored during the various testing phases.  A memory leak issue is difficult to debug or fix if identified in production.

 

Memory leak - Why it happens?

 

An ideal application program releases memory after use but if it cannot, it will result into a memory leak. Such a dynamically allocated memory could be not used by any other program or system and may result into issues like slowness in system performance or as critical as an application crash, with only remedy of rebooting the system. This is much critical issue in case of automotive applications or a business applications where it can not be easily restarted. So, it is important to plan and make sure that the application is free from such leakages.

 

How can Memory leaks be handled?

 

To detect a memory leak issue is very challenging. As such a defect is difficult to reproduce and isolate, it should be handled appropriately at different phases in the software development life cycle (SDLC). There can be different methodologies specific to an application.

 

Here is a suggested four step approach from QA's perspective:

1. Plan – A plan to minimize memory leak risks considering different factors

There are various factors to be considered for this issue but not limited to:

  • Application Technology
  • System Environment
  • Programming practice
  • Development approach
  • Performance Testing

2. Design –Design test scripts and unit tests to detect memory issues, follow good design practices

3. Detect – Test for the presence of a memory leak in the system with functional and non-functional testing

4. Fix – Once detected, debug, isolate the issue and then fix the Memory leak. Once a Memory leak issue is fixed, the procedure to repeat steps 2 to 4

 

Memory Leak Detection Tools:

 

There are different tools available in market that can detect memory leaks mainly during unit testing. Examples: IBM Rational Purify, Compuware BoundsChecker; open Source tools like Valgrind.

Further, QA activities like static code analysis, following coding guidelines and thorough code reviews would help to minimize such issues.

Memory leak issues are often difficult to detect with just with functional testing, however specific performance testing helps to detect such issues.

 

 

Reference: http://msdn.microsoft.com/en-us/library/ms859415.aspx

The opinions expressed on this discussion room are writer's and don't necessarily represent NTT DATA Canada's positions, strategies or opinions.

Comments

Posted by Christel Reeve on Linkedin 
 
Memory leaks aren't that hard to find, but you do have to be paying attention to look for them, and tools are useful. One thing you didn't mention in your article, is that memory leaks are more common with particular programming languages over others (C versus Java comes immediately to mind).  
 
Posted @ Sunday, January 29, 2012 8:48 AM by JORRIT WIT
Posted by Frank Pergolizzi on Linked in.  
 
Assuming you can reliably identify the process that's leaking I've used WMI queries from QTP to tap into Windows performance counters and monitor private bytes and working sets, for example. It can get tricky when you're dealing with multiple process instances or threads within a single instance, such as explorer.exe. We implement this as a framework function the script writer can call to test scenarios where a leak may occur. 
 
 
 
Depending on the AUT what you find may not be granular enough to identify the precise cause, but hopefully it can point the developers in the right direction.  
 
 
 
Posted @ Sunday, January 29, 2012 1:41 by JORRIT WIT
Posted by Francine Jackson on linkedin. 
 
Ignoring memory leaks is guaranteeing Production failure. The keys to debugging memory leaks lies within (1) the investment in your testing environment so it mirrors your Production environment closely (2) allowing enough realistic & stress test runtime and (3) the collaboration between QA, Development and Technical Operations teams to detect the leak.  
 
 
 
Some memory leaks can be traced by understanding all the events and conditions leading up to the leak, some seem to arise out of very random conditions and others are seemingly spontaneous. This makes it very important that you attack a memory leak with the expertise of all your teams and the realistic setup of your test environments.  
 
 
 
Posted @ Sunday, January 29, 2012 1:43 by JORRIT WIT
Depending on the technology used, there are tools available that monitor for memory leaks and are able to pinpoint the source of the leak. 
 
For Java I've been using Plumbr for some time now, and can only speak good of it.
Posted @ Tuesday, January 31, 2012 2:14 AM by Selle
Response from Sunil 
 
 
 
Mike, 
 
 
 
Great input and I agree finding the root cause of the memory is tricky though that was not in the scope of the blog. I was addressing the importance of finding leaks from a QA perspective which is often neglected. The known memory leakages (as you have mentioned in your reply) would generally are known application issues however QC is performed to find new memory leakages in specific conditions or with particular sequence of user actions that can be challenging. Again thanks for building on the topic.
Posted @ Thursday, February 02, 2012 7:59 AM by JORRIT WIT
Posted by Sateesh Gandra on Linkedin 
 
Yes I do accept its importance.We can use system monitor to check the memory usage of QTP, thread counts, so on within QTP11.It gives you very good graphical result where you can check at any given point in the graph or Vs time or by using reportevent so on. 
 
We were developing a Model Based Driven Testing framework where the script could run for hours as AUT is huge.So we see there could be problem with memory leak at some point. This analysis helped us a lot.  
 
Posted @ Tuesday, February 07, 2012 7:09 AM by JORRIT WIT
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics