首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到18条相似文献,搜索用时 203 毫秒
1.
Android应用程序的主体采用Java编程语言实现,Java语言的一个显著特点是它通过Java虚拟机和垃圾回收机制管理大部分的内存事务,但是在Java程序中不可避免地存在着内存泄漏的问题。本文从造成Android应用程序内存泄漏的原因入手,对内存泄漏进行检测和定位。阐述了在编写应用程序时规避内存泄漏的方法,并分别介绍了一种内存监测工具和一种内存分析工具的使用方法。  相似文献   

2.
C程序内存泄漏智能化检测方法   总被引:1,自引:1,他引:0  
内存泄漏在采用显式内存管理机制的C语言中是一种常见的代码缺陷,内存泄漏的检测方法目前主要是静态分析与动态检测.动态检测开销大,且高度依赖测试用例;静态分析目前被学术界和工业界广泛应用,但是存在大量误报,需要人工对检测结果进行确认.内存泄漏静态分析的误报通常是由于对指针、分支语句和全局变量分析的不准确性导致的.提出了一种内存泄漏的智能化检测方法,通过使用机器学习算法学习程序特征与内存泄漏之间的相关性,构建机器学习分类器,并应用机器学习分类器进一步提高内存泄漏静态分析的准确性.首先构建机器学习分类器,然后通过静态分析方法构建从内存分配点开始的Sparse Value Flow Graph(SVFG),并从中提取内存泄漏相关特征,再使用规则和机器学习分类器进行内存泄漏的检测.实验结果显示,该方法在分析指针、分支语句和全局变量时是有效的,能够提高内存泄漏检测的准确性,降低内存泄漏检测结果的误报.最后,对未来研究的可行性以及面临的挑战进行了展望.  相似文献   

3.
内存泄漏是软件系统中常见的一种错误,会持续消耗内存,致使系统运行效率下降,甚至导致系统崩溃。内存泄漏的检测工具主要可以分为两类:一类是使用基于程序扫描分析技术的静态工具;另一类则是监视实时内存分配状态进行判别的动态工具。如何评估工具检测内存泄漏的能力,相关的标准并不明确。通过对内存泄漏的认识与了解,对相关工具能力进行了调研与分析,提出了一个内存泄漏工具的评估标准。  相似文献   

4.
一种混合式内存泄漏静态检测方法   总被引:1,自引:0,他引:1  
内存泄漏是导致系统性能降低的重要问题.提出一种基于模型检测算法的内存泄漏静态检查方法TMC.该方法依据程序的控制流图构建对应于程序执行的有限状态自动机,进而在此基础上应用模型检测算法分析程序中可能存在的内存泄漏.论文利用几个典型的程序实例详细说明了TMC的工作原理,并通过基于内存操作密集的测试程序集PtrDist的实验对TMC进行了验证.实验结果表明,TMC能够显著提升内存泄漏分析的精度.  相似文献   

5.
C/C 语言中的动态内存管理机制自由且灵活,但动态内存的使用容易引入内存泄漏,导致系统性能降低甚至系统崩溃。为了更加有效的检测内存泄漏,提出了一个基于有界模型检测技术的C/C 程序内存泄漏检测方案MLD-CBMC。该方案以C/C 程序文件为输入,利用有界模型检测技术,对程序进行展开处理,加入内存泄漏性质,并利用可满足性模理论(SMT)对程序约束和性质组成的验证条件编码,使用SMT求解器对验证条件求解,将检测内存泄漏问题转换为求解可满足性问题,实现C/C 程序内存泄漏的检测。通过实验验证了方案的有效性,并与其他有界模型检测工具进行对比实验,实验证明方案对内存泄漏的检测能力更强。  相似文献   

6.
内存泄漏是C/C++程序的一种常见的、难以发现的缺陷,一直困扰着软件开发者,尤其是针对长时间运行的程序或者系统软件,内存泄漏的后果十分严重.针对内存泄漏的检测,目前主要有静态分析和动态测试两种方法.动态测试实际运行程序,具有较大开销,同时依赖测试用例的质量;静态分析技术及自动化工具已经被学术界和工业界广泛运用于内存泄漏缺陷检测中,然而由于静态分析采取了保守的策略,其结果往往包含数量巨大的误报,需要通过进一步人工确认来甄别误报,但人工确认静态分析的结果耗时且容易出错,严重限制了静态分析技术的实用性.本文提出了一种基于混合执行测试的静态内存泄漏警报的自动化确认方法.首先,针对静态分析报告的目标程序中内存泄漏的静态警报,对目标程序进行控制流分析,并计算警报的可达性,形成制导信息;其次,基于警报制导信息对目标程序进行混合执行测试;最后,在混合执行测试过程中,监控追踪内存对象的状态,判定内存泄漏是否发生,对静态警报进行动态确认并分类.实验结果表明该方法可以对静态内存泄漏警报进行有效的分类,显著降低了人工确认的工作量.实验详情参见:http://ssthappy.github.io/memleak/.  相似文献   

7.
提出了一个有效的C 内存泄漏检测方法.方法在分析内存泄漏的基础上,通过重新实现动态内存分配和释放函数,记录内存分配的确切位置并跟踪动态内存的使用情况.在程序结束时,方法利用跟踪结果检测和定位内存泄漏.最后,通过在Windows和Linux平台上的实验验证了本文方法的有效性.  相似文献   

8.
Qt继承了C++语言动态分配内存机制,保证了开发人员能根据实际需要灵活地使用内存,同时Qt也不可避免的要面对“内存泄漏”这个严重威胁软件安全的问题,虽然Qt采取了半自动化内存管理机制等措施,但不能从根本上解决问题。对此,提出了一种基于Qt的软件内存泄漏静态检测方法,该方法针对Qt的半自动化内存管理机制,通过静态分析被测对象中分配内存的代码识别出是否属于Qt自动管理的范围,从而准确地检测出内存泄漏和内存重复释放问题;并基于该检测方法设计了一种Qt内存泄漏自动检测工具,该工具能很大程度上提高测试效率。  相似文献   

9.
冯涛  宋成明 《微机发展》2006,16(7):123-125
Java语言的一个显著特点是它通过虚拟机和垃圾回收机制管理着大部分的内存事务,但是在Java程序中还是可能存在内存泄漏问题。文中首先对Java内存泄漏做一个简要的定义,接着围绕一个实例详细地介绍如何用工具检测Java内存泄漏,最后列举了一些典型的泄漏,以便读者在Java程序开发中尽量避免类似的内存泄漏。  相似文献   

10.
Java语言的一个显著特点是它通过虚拟机和垃圾回收机制管理着大部分的内存事务,但是在Jaya程序中还是可能存在内存泄漏问题。文中首先对Java内存泄漏做一个简要的定义,接着围绕一个实例详细地介绍如何用工具检测Jaya内存泄漏,最后列举了一些典型的泄漏,以便读者在Java程序开发中尽量避免类似的内存泄漏。  相似文献   

11.
Programmers spend most of their time and resources in localizing program defects. On the other hand, they commit many errors by manipulating dynamic data improperly, which may produce dynamic memory problems, such as dangling pointer, memory leaks, and inaccessible objects. Dangling pointers can occur when a function returns a pointer to an automatic variable, or when trying to access a deleted object. Inaccessible objects occur when a pointer is assigned to point to another object, leaving the original object inaccessible, either by using the new operator or regular assignment operator. Memory leaks occur when a dynamic data is allocated but never de-allocated. The existence of such dynamic memory problems causes the programs to behave incorrectly. Improper usage of dynamic data is a common defect that is easy to commit, but is difficult to diagnose and discover. In this paper, we propose a dynamic approach that detects different types of program defects including those that occur as a result of misusing the dynamic data in computer programs. Our approach uses the notion of redundant computation to identify the suspicious locations in the program that may contain defects. Redundant computation is an execution of a program statement(s) that does not contribute to the program output. The notion of redundant computation is introduced as a potential indicator of defects in programs. We investigate the application of redundant computation in debugging programs. The detection of redundant computation indicates deficiency that may represent a bug in the program. The results of the experiment show that, the redundant computation detection can help the debuggers to localize the source(s) of the program defects.  相似文献   

12.
Timing channels constitute one form of covert channels through which programs may be leaking information about the confidential data they manipulate. Such timing channels are typically eliminated by design, employing ad-hoc techniques to avoid information leaks through execution time, or by program transformation techniques, that transform programs that satisfy some form of noninterference property into programs that are time-sensitive termination-sensitive non-interfering. However, existing program transformations are thus far confined to simple languages without objects nor exceptions.We introduce a program transformation that uses transaction mechanisms to prevent timing leaks in sequential object-oriented programs. Under some strong but reasonable hypotheses, the transformation preserves the semantics of programs and yields for every termination-sensitive noninterfering program a time-sensitive termination-sensitive non-interfering program.  相似文献   

13.
A memory leak in a managed language occurs when the program inadvertently maintains references to objects that it no longer needs. Memory leaks cause systematic heap growth that degrade performance and can result in program crashes after perhaps days or weeks of execution. Prior approaches for detecting memory leaks rely on heap differencing or detailed object statistics which store state proportional to the number of objects in the heap. These overheads preclude their use on the same processor for deployed long‐running applications. This paper introduces Cork as a tool that accurately identifies heap growth caused by leaks. It is space efficient (adding less than 1% to the heap) and time efficient (adding 2.3% on average to total execution time). We implement this approach of examining and summarizing the class of live objects during garbage collection in a class points‐from graph (CPFG). Each node in the CPFG represents a class and edges between nodes represent references between objects of the specific classes. Cork annotates nodes and edges with the corresponding volume of live objects. Cork identifies growing data structures across multiple collections and computes a class slice to identify leaks for the user. We experiment with two functions for identifying growth and show that Cork is accurate: it identifies systematic heap growth with no false positives in 4 of 15 benchmarks we tested. Cork's slice report enabled us to quickly identify and eliminate growing data structures in large and unfamiliar programs, something their developers had not previously done. Copyright © 2009 John Wiley & Sons, Ltd.  相似文献   

14.
Memory leaks are a common type of defect that is hard to detect manually. Existing memory leak detection tools suffer from lack of precise interprocedural analysis and path-sensitivity. To address this problem, we present a static interprocedural analysis algorithm, that performs fully pathsensitive analysis and captures precise function behaviors, to detect memory leak in C programs. The proposed algorithm uses path-sensitive symbolic execution to track memory actions in different program paths guarded by path conditions. A novel analysis model called memory state transition graph (MSTG) is proposed to describe the tracking process and its results. In order to do interprocedural analysis, the proposed algorithm generates a summary for each procedure from MSTG and applies the summary at the procedure’s call sites. A prototype tool called Melton is implemented for this procedure. Melton was applied to five open source C programs and 41 leaks were found. More than 90% of these leaks were subsequently confirmed and fixed by their maintainers. For comparison with other tools, Melton was also applied to some programs in standard performance evaluation corporation (SPEC) CPU 2000 benchmark suite and detected more leaks than the state of the art approaches.  相似文献   

15.
Platforms with automatic memory management, such as the JVM, are usually considered free of memory leaks. However, memory leaks can happen in such environments, as the garbage collector cannot free objects, which are not used by the application anymore, but are still referenced. Such unused objects can eventually fill up the heap and crash the application. Although this problem has been studied extensively, nevertheless, there are still many rooms for improvement in this area. This paper describes the statistical approach for memory leak detection, as an alternative, along with a commercial tool, Plumbr, which is based on the method. The tool is later analyzed with three case studies of real applications and in the process also analyzes strengths and weaknesses of the statistical approach for memory leak detection. Copyright © 2014 John Wiley & Sons, Ltd.  相似文献   

16.
Linux下面向函数的动态内存泄漏监测   总被引:4,自引:1,他引:4  
动态内存泄漏是一个严重的编程错误,可以导致程序的错误行为。由于定位内存泄漏发生的位置是困难的,一些工具已被开发出来辅助程序员找出内存泄漏。论文提出了面向函数的动态内存泄漏监测的概念,阐述了它的必要性和有效性,并给出了在Linux下的实现。  相似文献   

17.
针对内存泄漏检测问题,本文通过示例说明使用软件Visual Leak Detector来检测泄漏点的方法。通过实验说明该方法在检测一般的c/c++程序内存泄漏时,可以提高检测效率。  相似文献   

18.
孙青岩  陈平 《计算机工程》2004,30(20):42-44
内存泄漏是程序设计中经常出现的问题,会降低系统性能,甚至耗尽内存空间导致系统崩溃。文章采用反射和开放编译技术,对开放编译器OpenC 进行了扩展与改进,设计并实现了一个CC 动态内存泄漏检测工具,以帮助开发和测试人员查找内存泄漏。  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号