Software Testing Practices, Test Methodologies and Test Competency Services


Welcome to the world of Software Testing & Best Test Practices.

All you wanted to know about Software Testing, Test Practices, Test Methodologies and building the Test Competency Services !!


Tuesday, February 21, 2012

Memory Leaks


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

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 cannot be easily restarted. So, it is important to plan and make sure that the application is free from such leakages.
  • Applications stay in memory when not in use. Typically, the operating system can clean up after a program which leaks memory after it terminates. However, since we do not allow the users to easily shut down automotive applications, Windows CE cannot clean up after any ill–behaved applications.
  • System run–time is expected to be unlimited. If all else fails, a system reboot will clean up all memory leaks. However, although we do support system reboots, our goal is that the user will never need to do so. Since you do not need to “reboot” your car stereo every few weeks because it stops working, or because the performance becomes poor, it is unacceptable to need to do so on the automotive platform.
  • Systems typically have lower total available system memory. Desktop applications can get away with being sloppy with memory when they run on systems with 64 megabytes of RAM and more, and with large hard drives to store swapped out virtual memory pages. But the automotive platform may have only 16 megabytes total memory, and that includes process and storage memory together! In order words, that memory must store what would be in RAM on a desktop PC, as well as what would be on the hard drive. System memory is at a premium.
 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

No comments: