Skip to main content
Log in

Prioritizing Test Cases for Memory Leaks in Android Applications

  • Regular Paper
  • Published:
Journal of Computer Science and Technology Aims and scope Submit manuscript

Abstract

Mobile applications usually can only access limited amount of memory. Improper use of the memory can cause memory leaks, which may lead to performance slowdowns or even cause applications to be unexpectedly killed. Although a large body of research has been devoted into the memory leak diagnosing techniques after leaks have been discovered, it is still challenging to find out the memory leak phenomena at first. Testing is the most widely used technique for failure discovery. However, traditional testing techniques are not directed for the discovery of memory leaks. They may spend lots of time on testing unlikely leaking executions and therefore can be inefficient. To address the problem, we propose a novel approach to prioritize test cases according to their likelihood to cause memory leaks in a given test suite. It firstly builds a prediction model to determine whether each test can potentially lead to memory leaks based on machine learning on selected code features. Then, for each input test case, we partly run it to get its code features and predict its likelihood to cause leaks. The most suspicious test cases will be suggested to run at first in order to reveal memory leak faults as soon as possible. Experimental evaluation on several Android applications shows that our approach is effective.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Šor V, Srirama S N. Memory leak detection in Java: Taxonomy and classification of approaches. Journal of Systems and Software, 2014, 96: 139-151.

    Article  Google Scholar 

  2. Pienaar J A, Hundt R. JSWhiz: Static analysis for JavaScript memory leaks. In Proc. the IEEE/ACM International Symposium on Code Generation and Optimization (CGO), February 2013, pp.11:1-11:11.

  3. Yan D, Xu G, Yang S, Rountev A. LeakChecker: Practical static memory leak detection for managed languages. In Proc. the IEEE/ACM International Symposium on Code Generation and Optimization (CGO), February 2014, pp.87-97.

  4. Jump M, McKinley K S. Detecting memory leaks in managed languages with Cork. Software: Practice and Experience, 2010, 40(1): 1-22.

    Google Scholar 

  5. De Pauw W, Sevitsky G. Visualizing reference patterns for solving memory leaks in Java. In Proc. the 13th European Conference on Object-Oriented Programming (ECOOP), June 1999, pp.116-134.

  6. Xu G, Bond M D, Qin F, Rountev A. LeakChaser: Helping programmers narrow down causes of memory leaks. In Proc. the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ), June 2011, pp.270-282.

  7. Rayside D, Mendel L. Object ownership profiling: A technique for finding and fixing memory leaks. In Proc. the 22nd IEEE/ACM International Conference on Automated Software Engineering (ASE), November 2007, pp.194-203.

  8. Mitchell N, Sevitsky G. LeakBot: An automated and lightweight tool for diagnosing memory leaks in large Java applications. In Proc. the 17th European Conference on Object-Oriented Computing (ECOOP), July 2003, pp.351-377.

  9. Maxwell E K, Back G, Ramakrishnan N. Diagnosing memory leaks using graph mining on heap dumps. In Proc. the 16th International Conference on Knowledge Discovery and Data Mining (KDD), July 2010, pp.115-124.

  10. Bond M D, McKinley K S. Bell: Bit-encoding online memory leak detection. In Proc. the 12th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), October 2006, pp.61-72.

  11. Xu G, Rountev A. Precise memory leak detection for Java software using container profiling. ACM Transactions on Software Engineering and Methodology (TOSEM), 2013, 22(3): Article No. 17.

  12. Guo C, Zhang J, Yan J, Zhang Z, Zhang Y. Characterizing and detecting resource leaks in Android applications. In Proc. the 28th IEEE/ACM International Conference on Automated Software Engineering (ASE), November 2013, pp.389-398.

  13. Yan D, Yang S, Rountev A. Systematic testing for resource leaks in Android applications. In Proc. the 24th IEEE International Symposium on Software Reliability Engineering (ISSRE), November 2013, pp.411-420.

  14. Zhang H, Wu H, Rountev A. Automated test generation for detection of leaks in Android applications. In Proc. the 11th IEEE/ACM International Workshop on Automation of Software Test (AST), May 2016, pp.64-70.

  15. Shahriar H, North S, Mawangi E. Testing of memory leak in Android applications. In Proc. the 15th IEEE International Symposium on High-Assurance Systems Engineering (HASE), January 2014, pp.176-183.

  16. Park J, Choi B. Automated memory leakage detection in Android based systems. International Journal of Control and Automation, 2012, 5(2): 35-42

    Google Scholar 

  17. Vallée-Rai R, Co P, Gaghon E et al. Soot – A Java optimization framework. In Proc. the IBM Centre for Advanced Studies Conference (CASCON), November 1999, Article No. 13.

  18. Joachims T. Optimizing search engines using ClickThrough data. In Proc. the ACM Conference on Knowledge Discovery and Data Mining (KDD), July 2002, pp.133-142.

  19. Yang W, Prasad M, Xie T. A grey-box approach for automated GUI-model generation of mobile applications. In Proc. the International Conference on Fundamental Approaches to Software Engineering (FASE), March 2013, pp.250-265.

  20. Zhang P, Elbaum S. Amplifying tests to validate exception handling code. In Proc. the 34th International Conference on Software Engineering (ICSE), June 2012, pp.595-605.

  21. Xie Y, Aiken A. Context- and path-sensitive memory leak detection. In Proc. the 10th European Software Engineering Conference Held Jointly with the 13th ACM SIGSOFT International Symposium on Foundations of Software Engineering, September 2005, pp.115-125.

  22. Dor N, Rodeh M, Sagiv S. Checking cleanness in linked lists. In Proc. the International Static Analysis Symposium (SAS), June 29-July 1, 2000, pp.115-134

  23. Heine D L, Lam M S. A practical flow-sensitive and contextsensitive C and C++ memory leak detector. In Proc. the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ), June 2003, pp.168-181.

  24. Sui Y, Ye D, Xue J. Static memory leak detection using fullsparse value-flow analysis. In Proc. the International Symposium on Software Testing and Analysis (ISSTA), July 2012, pp.254-264.

  25. Hastings R, Joyce B. Purify: Fast detection of memory leaks and access errors. In Proc. the Winter USENIX Conference, January 1992, pp.125-138

  26. Jung C, Lee S, Raman E et al. Automated memory leak detection for production use. In Proc. the 36th International Conference on Software Engineering (ICSE), May 31-June 7, 2014, pp.825-836.

  27. Lee S, Jung C, Pande S. Detecting memory leaks through introspective dynamic behavior modelling using machine learning. In Proc. the 36th International Conference on Software Engineering, May 31-June 7, 2014, pp.814-824.

  28. Li M, Chen Y,Wang L, Xu G. Dynamically validating static memory leak warnings. In Proc. the ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA), July 2013, pp.112-122.

  29. Gao Q, Xiong Y, Mi Y, Zhang L, Yang W, Zhou Z, Xie B, Mei H. Safe memory-leak fixing for C programs. In Proc. the 37th International Conference on Software Engineering (ICSE), May 2015, pp.459-470.

Download references

Acknowledgement

We thank the anonymous reviewers for their insightful comments and criticisms.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ju Qian.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Qian, J., Zhou, D. Prioritizing Test Cases for Memory Leaks in Android Applications. J. Comput. Sci. Technol. 31, 869–882 (2016). https://doi.org/10.1007/s11390-016-1670-2

Download citation

  • Received:

  • Revised:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11390-016-1670-2

Keywords

Navigation