计算机科学 ›› 2020, Vol. 47 ›› Issue (9): 31-39.doi: 10.11896/jsjkx.200100075
李吟1,2, 李必信1
LI Yin1,2, LI Bi-xin1
摘要: 内存泄漏是云应用、Web服务、中间件等各类连续工作型软件中的一种常见缺陷,它会导致程序运行速度减慢、资源耗尽崩溃等软件稳定性问题。现有测试一般以较长周期运行测试用例来检测泄漏缺陷,用于检测泄漏的测试用例通常需要运行数小时以上才能产生足以暴露泄漏的内存表现。整个测试过程代价高昂,若对测试用例不加筛选,可能会耗费大量的时间在暴露泄漏可能性低的测试用例上,降低了泄漏发现的效率。为了弥补现有技术的不足,并解决Java Web程序长时间运行的内存泄漏缺陷不易发现、不易诊断及不易修复的难题,文中对内存泄漏的发现技术进行了研究,提出了基于机器学习的内存泄漏测试脚本预测方法,通过构建内存特征模型,对存在内存泄漏的脚本进行训练及预测,基于训练的模型进行脚本内存泄漏风险值预测,并给出相应的参数打分,以指导后续的脚本重组,从而预测获取更可能造成内存泄漏的功能测试脚本。同时,提出了脚本重组优化方法,改善其缺陷揭示能力。对预测和重组后的脚本进行优先测试,可以加速泄漏缺陷的发现。最后通过案例验证表明了所提框架具有较强的泄漏发现能力,重组优化后的测试脚本在发现缺陷的速度方面比普通脚本高出一倍以上,从而缩短了内存膨胀问题的暴露时间,达到了提高测试效率以及保障软件质量的目的。
中图分类号:
[1] OR V,SRIRAMAS N.Memory leak detection in Java:Taxonomy and classification of approaches[J].Journal of Systems and Software (JSS),2014,96:139-151. [2] VALENTIM N A,MACEDO A,MATIASR.A SystematicMapping Review of the First 20 Years of Software Aging and Rejuvenation Research[C]//IEEE International Symposium on Software Reliability Engineering Workshops (ISSREW).2016. [3] HEINE D L,LAM M S.A practical flow-sensitive and context-sensitive C and C++ memory leak detector[C]//ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI).2003. [4] XIE Y,AIKEN A.Context- and path-sensitive memory leak detection[C]//13th ACM SIGSOFT International Symposium on Foundations of Software Engineering (FSE).2005:115-125. [5] XU Z,ZHANG J,XU Z.Memory leak detection based on me-mory state transition graph[C]//Proceedings of the Asia-Pacific Software Engineering Conference (APSEC).2011:33-40. [6] SUI Y,YE D,XUE J.Static memory leak detection using full-sparse value-flow analysis[C]//Proceedings of the International Symposium on Software Testing and Analysis.2012. [7] LI Q,PAN M X,LIX D.Benchmark of tools for memory leak[J].Computer Science and Exploration,2010,4(1):29-35. [8] JUMP M,MCKINLEY K S.Detecting memory leaks inma-naged languages with Cork[J].Software:Practice and Expe-rience,2010,40(1):1-22. [9] MAXWELL E K,BACK G,RAMAKRISHNANN.Diagnosingmemory leaks using graph mining on heap dumps[C]//Procee-dings of the 16th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD).2010:115-124. [10] RAYSIDE D,MENDE L L.Object ownership profiling:a technique for finding and fixing memory leaks [C]//The 22nd IEEE/ACM International Conference on Automated Software Engineering (ASE).2007:194-203. [11] OR V,SRIRAMAS N,SALNIKOV-TARNOVSKI N.Memory leak detection in Plumbr.Software[M].Practice and Expe-rience (SPE),2014. [12] CHILIMBI T,HAUSWIRTHM.Low-overhead memory leakdetection using adaptive statistical profiling[C]//The 11th International Conference on Architectural Support for Programming Languages and Operating Systems.2004. [13] BOND M D,MCKINLEY K S.Bell:bit-encoding online memory leak detection[C]//The 12th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS).2006:61-72. [14] XU G,ROUNTEV A.Precise memory leak detection for Java software using container profiling[J].ACM Transactions on Software Engineering and Methodology (TOSEM),2013,22(3):17. [15] JUNG C,LEE S,RAMAN E,et al.Automated memory leak detection for production use[C]//International Conference on Software Engineering (ICSE).2014. [16] LEE S,JUNG C,PANDES.Detecting memory leaks through introspective dynamic behavior modelling using machine learning[C]//International Conference on Software Engineering (ICSE).2014. [17] JIA X X,WU J,JIN M Z,et al.Overviewon memory leak of Java program [J].Computer Research and Application,2006(9):1-4. [18] SHAHRIAR H,NORTH S,MAWANG I E.Testing of Memory Leak in Android Applications[C]//International Symposium on High-Assurance Systems Engineering (HASE).2014. [19] YAN D,YANG S,ROUNTEV A.Systematic testing for re-source leaks in Android applications[C]//24th International Symposium on Software Reliability Engineering (ISSRE).2013. [20] GUNDECHA U.Selenium Testing Tools Cookbook (2 edition) [M].Packt Publishing,2015. [21] BODDEN E.Invoke Dynamic support in Soot.ACM SIGPLAN[C]//International Workshop on the State of the Art in Java Program Analysis.2012:51-55. |
[1] | 冷典典, 杜鹏, 陈建廷, 向阳. 面向自动化集装箱码头的AGV行驶时间估计 Automated Container Terminal Oriented Travel Time Estimation of AGV 计算机科学, 2022, 49(9): 208-214. https://doi.org/10.11896/jsjkx.210700028 |
[2] | 宁晗阳, 马苗, 杨波, 刘士昌. 密码学智能化研究进展与分析 Research Progress and Analysis on Intelligent Cryptology 计算机科学, 2022, 49(9): 288-296. https://doi.org/10.11896/jsjkx.220300053 |
[3] | 何强, 尹震宇, 黄敏, 王兴伟, 王源田, 崔硕, 赵勇. 基于大数据的进化网络影响力分析研究综述 Survey of Influence Analysis of Evolutionary Network Based on Big Data 计算机科学, 2022, 49(8): 1-11. https://doi.org/10.11896/jsjkx.210700240 |
[4] | 李瑶, 李涛, 李埼钒, 梁家瑞, Ibegbu Nnamdi JULIAN, 陈俊杰, 郭浩. 基于多尺度的稀疏脑功能超网络构建及多特征融合分类研究 Construction and Multi-feature Fusion Classification Research Based on Multi-scale Sparse Brain Functional Hyper-network 计算机科学, 2022, 49(8): 257-266. https://doi.org/10.11896/jsjkx.210600094 |
[5] | 张光华, 高天娇, 陈振国, 于乃文. 基于N-Gram静态分析技术的恶意软件分类研究 Study on Malware Classification Based on N-Gram Static Analysis Technology 计算机科学, 2022, 49(8): 336-343. https://doi.org/10.11896/jsjkx.210900203 |
[6] | 陈明鑫, 张钧波, 李天瑞. 联邦学习攻防研究综述 Survey on Attacks and Defenses in Federated Learning 计算机科学, 2022, 49(7): 310-323. https://doi.org/10.11896/jsjkx.211000079 |
[7] | 肖治鸿, 韩晔彤, 邹永攀. 基于多源数据和逻辑推理的行为识别技术研究 Study on Activity Recognition Based on Multi-source Data and Logical Reasoning 计算机科学, 2022, 49(6A): 397-406. https://doi.org/10.11896/jsjkx.210300270 |
[8] | 姚烨, 朱怡安, 钱亮, 贾耀, 张黎翔, 刘瑞亮. 一种基于异质模型融合的 Android 终端恶意软件检测方法 Android Malware Detection Method Based on Heterogeneous Model Fusion 计算机科学, 2022, 49(6A): 508-515. https://doi.org/10.11896/jsjkx.210700103 |
[9] | 李亚茹, 张宇来, 王佳晨. 面向超参数估计的贝叶斯优化方法综述 Survey on Bayesian Optimization Methods for Hyper-parameter Tuning 计算机科学, 2022, 49(6A): 86-92. https://doi.org/10.11896/jsjkx.210300208 |
[10] | 赵璐, 袁立明, 郝琨. 多示例学习算法综述 Review of Multi-instance Learning Algorithms 计算机科学, 2022, 49(6A): 93-99. https://doi.org/10.11896/jsjkx.210500047 |
[11] | 王飞, 黄涛, 杨晔. 基于Stacking多模型融合的IGBT器件寿命的机器学习预测算法研究 Study on Machine Learning Algorithms for Life Prediction of IGBT Devices Based on Stacking Multi-model Fusion 计算机科学, 2022, 49(6A): 784-789. https://doi.org/10.11896/jsjkx.210400030 |
[12] | 许杰, 祝玉坤, 邢春晓. 机器学习在金融资产定价中的应用研究综述 Application of Machine Learning in Financial Asset Pricing:A Review 计算机科学, 2022, 49(6): 276-286. https://doi.org/10.11896/jsjkx.210900127 |
[13] | 李野, 陈松灿. 基于物理信息的神经网络:最新进展与展望 Physics-informed Neural Networks:Recent Advances and Prospects 计算机科学, 2022, 49(4): 254-262. https://doi.org/10.11896/jsjkx.210500158 |
[14] | 么晓明, 丁世昌, 赵涛, 黄宏, 罗家德, 傅晓明. 大数据驱动的社会经济地位分析研究综述 Big Data-driven Based Socioeconomic Status Analysis:A Survey 计算机科学, 2022, 49(4): 80-87. https://doi.org/10.11896/jsjkx.211100014 |
[15] | 张潆藜, 马佳利, 刘子昂, 刘新, 周睿. 以太坊Solidity智能合约漏洞检测方法综述 Overview of Vulnerability Detection Methods for Ethereum Solidity Smart Contracts 计算机科学, 2022, 49(3): 52-61. https://doi.org/10.11896/jsjkx.210700004 |
|