计算机科学 ›› 2020, Vol. 47 ›› Issue (9): 31-39.doi: 10.11896/jsjkx.200100075

• 计算机软件* 上一篇    下一篇

基于脚本预测和重组的内存泄漏测试加速技术

李吟1,2, 李必信1   

  1. 1 东南大学计算机科学与工程学院 南京211189
    2 江苏自动化研究所 江苏 连云港222006
  • 收稿日期:2020-01-10 发布日期:2020-09-10
  • 通讯作者: 李必信(bx.li@seu.edu.cn)
  • 作者简介:leein121999@126.com

Memory Leak Test Acceleration Based on Script Prediction and Reconstruction

LI Yin1,2, LI Bi-xin1   

  1. 1 School of Computer Science and Engineering,Southeast University,Nanjing 211189,China
    2 Jiangsu Automation Research Institute,Lianyungang,Jiangsu 222006,China
  • Received:2020-01-10 Published:2020-09-10
  • About author:LI Yin,born in 1988,master.His main research interests include bigdata,software reliability and software testing,etc.
    LI Bi-xin,born in 1969,Ph.D,professor.His main research interests include software analysis,testing and verification,and empirical software engineering,etc.

摘要: 内存泄漏是云应用、Web服务、中间件等各类连续工作型软件中的一种常见缺陷,它会导致程序运行速度减慢、资源耗尽崩溃等软件稳定性问题。现有测试一般以较长周期运行测试用例来检测泄漏缺陷,用于检测泄漏的测试用例通常需要运行数小时以上才能产生足以暴露泄漏的内存表现。整个测试过程代价高昂,若对测试用例不加筛选,可能会耗费大量的时间在暴露泄漏可能性低的测试用例上,降低了泄漏发现的效率。为了弥补现有技术的不足,并解决Java Web程序长时间运行的内存泄漏缺陷不易发现、不易诊断及不易修复的难题,文中对内存泄漏的发现技术进行了研究,提出了基于机器学习的内存泄漏测试脚本预测方法,通过构建内存特征模型,对存在内存泄漏的脚本进行训练及预测,基于训练的模型进行脚本内存泄漏风险值预测,并给出相应的参数打分,以指导后续的脚本重组,从而预测获取更可能造成内存泄漏的功能测试脚本。同时,提出了脚本重组优化方法,改善其缺陷揭示能力。对预测和重组后的脚本进行优先测试,可以加速泄漏缺陷的发现。最后通过案例验证表明了所提框架具有较强的泄漏发现能力,重组优化后的测试脚本在发现缺陷的速度方面比普通脚本高出一倍以上,从而缩短了内存膨胀问题的暴露时间,达到了提高测试效率以及保障软件质量的目的。

关键词: 内存泄漏, 泄漏预测模型, 机器学习, 测试脚本, 脚本重组

Abstract: Memory leak is a common defect in continuous working software,such as cloud applications,web service,middleware,etc.It can affect the stability of software applications,lead to run in bad performance and even crash.To clearly observe memory leaks,the test cases toward them need to execute longer time in order to generate significant memory pressure.The cost of memory leaks testing is expensive.If the execution orders of test cases are not optimized,we may waste lots of time on the test cases that are not likely to reveal faults before finding test cases that really containing memory leaks.This seriously reduces the efficiency of fault discovery.In order to make up for the shortcomings of the existing technology and solve the problems of the me-mory leak of Java Web program while running for a long time,which is not easy to find,diagnose and repair,this paper studies the memory leak detection technology,proposes the memory leak test script prediction method based on machine learning.The methodtrains and predicts the script with memory leak by building the memory feature model.Then,based on the training model,it predicts the risk value of script memory leak,and gives the corresponding parameter scores,to guide the subsequent script reorganization,can predict and obtain the function test script that is more likely to cause memory leak.At the same time,a script reorganization optimization method is proposed to improve its defect revealing ability.Priority testing of predicted and recombined scripts can accelerate the detection of leakage defects.Finally,a case study shows that the proposed framework has strong leak detection ability.The speed of defect detection of the optimized test script can be more than twice as fast as that of the common script,thus accelerating the exposure time of memory expansion problem,achieving the purpose of improving test efficiency and ensuring software quality.

Key words: Memory leak, Memory leak prediction model, Machine learning, Test script, test script reconstruction

中图分类号: 

  • TP311.5
[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] 丁钰, 魏浩, 潘志松, 刘鑫. 网络表示学习算法综述[J]. 计算机科学, 2020, 47(9): 52-59.
[2] 苏畅, 张定权, 谢显中, 谭娅. 面向5G通信网络的NFV内存资源管理方法[J]. 计算机科学, 2020, 47(9): 246-251.
[3] 王慧, 乐孜纯, 龚轩, 武玉坤, 左浩. 基于特征分类的链路预测方法综述[J]. 计算机科学, 2020, 47(8): 302-312.
[4] 袁野, 和晓歌, 朱定坤, 王富利, 谢浩然, 汪俊, 魏明强, 郭延文. 视觉图像显著性检测综述[J]. 计算机科学, 2020, 47(7): 84-91.
[5] 彭伟, 胡宁, 胡璟璟. 图像隐写分析算法研究概述[J]. 计算机科学, 2020, 47(6A): 325-331.
[6] 包振山, 郭俊南, 谢源, 张文博. 基于LSTM-GA的股票价格涨跌预测模型[J]. 计算机科学, 2020, 47(6A): 467-473.
[7] 徐江峰谭玉龙. 基于机器学习的HBase配置参数优化研究[J]. 计算机科学, 2020, 47(6A): 474-479.
[8] 朱林立, 华钢, 高炜. 决定图框架下本体学习算法的稳定性分析[J]. 计算机科学, 2020, 47(5): 43-50.
[9] 蹇松雷, 卢凯. 复杂异构数据的表征学习综述[J]. 计算机科学, 2020, 47(2): 1-9.
[10] 刘苗苗,扈庆翠,郭景峰,陈晶. 符号网络链接预测算法研究综述[J]. 计算机科学, 2020, 47(2): 21-30.
[11] 刘云,尹传环,胡迪,赵田,梁宇. 基于循环神经网络的通信卫星故障检测[J]. 计算机科学, 2020, 47(2): 227-232.
[12] 杨立, 马佳佳, 江华禧, 马肖肖, 梁赓, 左春. 面向机器学习系统的需求建模与决策选择[J]. 计算机科学, 2020, 47(12): 42-49.
[13] 王莹, 郑丽伟, 张禹尧, 张晓妘. 面向中文APP用户评论数据的软件需求挖掘方法[J]. 计算机科学, 2020, 47(12): 56-64.
[14] 郭茂祖, 杨帅, 赵玲玲. 基于RNA-Seq的转录组分析方法[J]. 计算机科学, 2020, 47(11A): 35-39.
[15] 景丽, 李曼曼, 何婷婷. 结合扩充词典与自监督学习的网络评论情感分类[J]. 计算机科学, 2020, 47(11A): 78-82.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
[1] 孙启,金燕,何琨,徐凌轩. 用于求解混合车辆路径问题的混合进化算法[J]. 计算机科学, 2018, 45(4): 76 -82 .
[2] 张佳男,肖鸣宇. 带权混合支配问题的近似算法研究[J]. 计算机科学, 2018, 45(4): 83 -88 .
[3] 周燕萍,业巧林. 基于L1-范数距离的最小二乘对支持向量机[J]. 计算机科学, 2018, 45(4): 100 -105 .
[4] 刘博艺,唐湘滟,程杰仁. 基于多生长时期模板匹配的玉米螟识别方法[J]. 计算机科学, 2018, 45(4): 106 -111 .
[5] 韩奎奎,谢在鹏,吕鑫. 一种基于改进遗传算法的雾计算任务调度策略[J]. 计算机科学, 2018, 45(4): 137 -142 .
[6] 吴姝,周安民,左政. PDiOS:iOS应用程序中私有API的调用检测[J]. 计算机科学, 2018, 45(4): 163 -168 .
[7] 刘琴. 计算机取证过程中基于约束的数据质量问题研究[J]. 计算机科学, 2018, 45(4): 169 -172 .
[8] 罗霄阳,霍宏涛,王梦思,陈亚飞. 基于多残差马尔科夫模型的图像拼接检测[J]. 计算机科学, 2018, 45(4): 173 -177 .
[9] 郭俊霞,郭仁飞,许南山,赵瑞莲. 基于Session的Web应用软件EFSM模型构建方法研究[J]. 计算机科学, 2018, 45(4): 203 -207 .
[10] 翁理国,孔维斌,夏旻,仇学飞. 基于深度极限学习机的卫星云图云量计算[J]. 计算机科学, 2018, 45(4): 227 -232 .