CN105912398A - Memory detection method and device - Google Patents
Memory detection method and device Download PDFInfo
- Publication number
- CN105912398A CN105912398A CN201610210654.6A CN201610210654A CN105912398A CN 105912398 A CN105912398 A CN 105912398A CN 201610210654 A CN201610210654 A CN 201610210654A CN 105912398 A CN105912398 A CN 105912398A
- Authority
- CN
- China
- Prior art keywords
- memory
- bitmap
- snapshot file
- application
- preset
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5022—Mechanisms to release resources
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Quality & Reliability (AREA)
- Debugging And Monitoring (AREA)
Abstract
本公开是关于内存检测方法及装置。该方法包括:当应用程序符合预设条件时,获取所述应用程序的内存快照文件;从所述内存快照文件中提取所述至少两张位图的位图数据;根据所述位图数据对所述至少两张位图进行比较;当所述内存快照文件中存在相同位图时,执行预设提醒操作。该技术方案,可以准确、快速地定位该应用程序因位图资源重复创建而导致的内存泄露问题,为应用程序的内存优化,提供了明确的处理目标,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。
The present disclosure relates to a memory detection method and device. The method includes: when the application meets the preset conditions, acquiring the memory snapshot file of the application; extracting the bitmap data of the at least two bitmaps from the memory snapshot file; The at least two bitmaps are compared; when the same bitmap exists in the memory snapshot file, a preset reminder operation is performed. This technical solution can accurately and quickly locate the memory leak problem caused by the repeated creation of bitmap resources in the application, provides a clear processing target for the memory optimization of the application, and improves the efficiency and accuracy of the memory optimization of the application , reduce unnecessary memory consumption, and improve the experience of terminal use.
Description
技术领域technical field
本公开涉及终端操作系统技术领域,尤其涉及内存检测方法及装置。The present disclosure relates to the technical field of terminal operating systems, and in particular to a memory detection method and device.
背景技术Background technique
目前,运行一段时间后,终端的剩余内存越来越少,这是由于运行程序存在内存泄露导致的。内存泄漏也称作“存储渗漏”,用动态存储分配函数动态开辟的空间,在使用完毕后未释放,结果导致一直占据该内存单元,直到程序结束。程序运行时间越长,占用存储空间越来越多,最终用尽全部存储空间,整个系统崩溃。At present, after running for a period of time, the remaining memory of the terminal becomes less and less, which is caused by a memory leak in the running program. Memory leaks are also called "storage leaks". The space dynamically opened by the dynamic storage allocation function is not released after use, resulting in the memory unit being occupied until the end of the program. The longer the program runs, the more and more storage space is taken up, and eventually all storage space is used up, and the entire system crashes.
发明内容Contents of the invention
本公开实施例提供内存检测方法及装置。所述技术方案如下:Embodiments of the present disclosure provide a memory detection method and device. Described technical scheme is as follows:
根据本公开实施例的第一方面,提供一种内存检测方法,包括:According to a first aspect of an embodiment of the present disclosure, a memory detection method is provided, including:
当应用程序符合预设条件时,获取所述应用程序的内存快照文件;When the application meets the preset conditions, obtain the memory snapshot file of the application;
从所述内存快照文件中提取所述至少两张位图的位图数据;Extracting the bitmap data of the at least two bitmaps from the memory snapshot file;
根据所述位图数据对所述至少两张位图进行比较;comparing the at least two bitmaps according to the bitmap data;
当所述内存快照文件中存在相同位图时,执行预设提醒操作。When the same bitmap exists in the memory snapshot file, a preset reminder operation is performed.
可选的,所述获取所述应用程序的内存快照文件,包括:Optionally, the acquiring the memory snapshot file of the application includes:
调用预设内存调试程序,根据所述应用程序的内存数据生成所述应用程序的内存快照文件,所述内存快照文件为二进制格式。Invoke a preset memory debugging program, generate a memory snapshot file of the application program according to the memory data of the application program, and the memory snapshot file is in a binary format.
可选的,所述从所述内存快照文件中提取至少两张位图的位图数据,包括:Optionally, the extracting bitmap data of at least two bitmaps from the memory snapshot file includes:
使用预设内存分析程序,对所述内存快照文件进行分析,提取至少两张位图的位图数据;Using a preset memory analysis program to analyze the memory snapshot file and extract bitmap data of at least two bitmaps;
所述根据所述位图数据对所述至少两张位图进行比较,包括:The comparing the at least two bitmaps according to the bitmap data includes:
采用消息摘要算法5对所述至少两张位图的位图数据进行比较。A message digest algorithm 5 is used to compare the bitmap data of the at least two bitmaps.
可选的,所述执行预设提醒操作,包括:Optionally, the execution of preset reminder operations includes:
将所述相同位图的位图数据以二进制格式发送到所述预设终端;sending the bitmap data of the same bitmap to the preset terminal in binary format;
或or
将所述相同位图的位图数据以位图格式发送到所述预设终端。sending the bitmap data of the same bitmap to the preset terminal in a bitmap format.
根据本公开实施例的第二方面,提供一种内存检测装置,包括:According to a second aspect of an embodiment of the present disclosure, a memory detection device is provided, including:
获取模块,用于当应用程序符合预设条件时,获取所述应用程序的内存快照文件;An acquisition module, configured to acquire a memory snapshot file of the application when the application meets a preset condition;
提取模块,用于从所述获取模块获取的内存快照文件中提取所述至少两张位图的位图数据;An extraction module, configured to extract the bitmap data of the at least two bitmaps from the memory snapshot file acquired by the acquisition module;
比较模块,用于根据所述提取模块提取的位图数据对所述至少两张位图进行比较;A comparison module, configured to compare the at least two bitmaps according to the bitmap data extracted by the extraction module;
提醒模块,用于当所述比较模块比较得到内存快照文件中存在相同位图时,执行预设提醒操作。The reminding module is used to execute a preset reminding operation when the comparison module obtains that the same bitmap exists in the memory snapshot file.
可选的,所述获取模块,用于调用预设内存调试程序,根据所述应用程序的内存数据生成所述应用程序的内存快照文件,所述内存快照文件为二进制格式。Optionally, the obtaining module is configured to invoke a preset memory debugging program, and generate a memory snapshot file of the application program according to the memory data of the application program, and the memory snapshot file is in a binary format.
可选的,所述提取模块,用于使用预设内存分析程序,对所述获取模块获取的内存快照文件进行分析,提取至少两张位图的位图数据。Optionally, the extraction module is configured to use a preset memory analysis program to analyze the memory snapshot file acquired by the acquisition module, and extract bitmap data of at least two bitmaps.
可选的,所述比较模块,用于采用消息摘要算法5对所述提取模块提取的至少两张位图的位图数据进行比较;Optionally, the comparison module is configured to compare the bitmap data of at least two bitmaps extracted by the extraction module by using message digest algorithm 5;
可选的,所述提醒模块包括:发送子模块,用于将所述相同位图的位图数据以二进制格式发送到所述预设终端;或将所述相同位图的位图数据以位图格式发送到所述预设终端。Optionally, the reminder module includes: a sending submodule, configured to send the bitmap data of the same bitmap to the preset terminal in binary format; or send the bitmap data of the same bitmap in binary format The graph format is sent to the preset terminal.
根据本公开实施例的第三方面,提供一种内存检测装置,包括:According to a third aspect of an embodiment of the present disclosure, a memory detection device is provided, including:
处理器;processor;
用于存储处理器可执行指令的存储器;memory for storing processor-executable instructions;
其中,所述处理器被配置为:Wherein, the processor is configured as:
当应用程序符合预设条件时,获取所述应用程序的内存快照文件;When the application meets the preset conditions, obtain the memory snapshot file of the application;
从所述内存快照文件中提取所述至少两张位图的位图数据;Extracting the bitmap data of the at least two bitmaps from the memory snapshot file;
根据所述位图数据对所述至少两张位图进行比较;comparing the at least two bitmaps according to the bitmap data;
当所述内存快照文件中存在相同位图时,执行预设提醒操作。When the same bitmap exists in the memory snapshot file, a preset reminder operation is performed.
本公开的实施例提供的技术方案可以包括以下有益效果:The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects:
本实施例中,通过获取内存快照文件,对内存快照文件的分析,找到内存中重复创建的位图资源,可以准确、快速地定位该应用程序因位图资源重复创建而导致的内存泄露问题,为应用程序的内存优化,提供了明确的处理目标,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, by obtaining the memory snapshot file and analyzing the memory snapshot file, the repeatedly created bitmap resource in the memory can be found, and the memory leak problem caused by the repeated creation of the bitmap resource of the application program can be accurately and quickly located. For the memory optimization of the application, it provides a clear processing target, improves the efficiency and accuracy of the memory optimization of the application, reduces unnecessary memory consumption, and improves the user experience of the terminal.
在另一个实施例中,以对所有当前正在运行的应用程序的内存占用情况进行分析,以确定这些应用程序中是否存在因位图资源重复创建而导致的内存泄露问题,可以准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In another embodiment, the memory usage of all currently running applications is analyzed to determine whether there is a memory leak problem caused by repeated creation of bitmap resources in these applications, which can be accurately and quickly located For applications with memory leaks, improve the efficiency and accuracy of application memory optimization, reduce unnecessary memory consumption, and improve the experience of terminal use.
在另一个实施例中,可以不用对所有当前正在运行的应用程序的内存占用情况进行分析,而是选择内存占用异常的应用程序进行分析。例如,应用程序A的实际内存占用值为150M,超过预设内存占用阈值100M,则对该应用程序A的内存占用情况进行分析,以确定该应用程序A是否存在因位图资源重复创建而导致的内存泄露问题,进一步准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In another embodiment, instead of analyzing the memory usage of all currently running applications, an application with an abnormal memory usage may be selected for analysis. For example, if the actual memory usage value of application A is 150M, which exceeds the preset memory usage threshold of 100M, analyze the memory usage of application A to determine whether there is an error caused by repeated creation of bitmap resources in application A. memory leaks, further accurately and quickly locate applications with memory leaks, improve the efficiency and accuracy of application memory optimization, reduce unnecessary memory consumption, and improve the experience of terminal use.
在另一个实施例中,调用预设调试程序生成应用程序的内存快照文件,从而后续可以通过分析内存快照文件确定应用程序是否存在因位图资源重复创建而导致的内存泄露问题,可以准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In another embodiment, the preset debugger is invoked to generate the memory snapshot file of the application, so that it can be determined whether the application program has a memory leak problem caused by repeated creation of bitmap resources by analyzing the memory snapshot file, which can be accurate and fast It can accurately locate applications with memory leaks, improve the efficiency and accuracy of application memory optimization, reduce unnecessary memory consumption, and improve the experience of terminal use.
在另一个实施例中,通过对内存快照文件进行分析,提取其中位图对应的数据。使得可以通过分析位图数据是否相同,确定应用程序是否存在因位图资源重复创建而导致的内存泄露问题,可以准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In another embodiment, the data corresponding to the bitmap is extracted by analyzing the memory snapshot file. By analyzing whether the bitmap data is the same, it is possible to determine whether the application has memory leaks caused by repeated creation of bitmap resources, accurately and quickly locate applications with memory leaks, and improve the efficiency and accuracy of application memory optimization. speed, reduce unnecessary memory consumption, and improve the experience of terminal use.
在另一个实施例中,对相同位图的识别也可采用其他算法。如果内存快照文件中不存在相同位图,则说明不存在内存泄露的问题。如果内存快照文件中存在相同位图,则说明该应用程序存在内存泄露。通过对内存快照文件中相同位图的识别,确定该应用程序是否存在因位图资源重复创建而导致的内存泄露问题,进一步准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In another embodiment, other algorithms may also be used to identify the same bitmap. If the same bitmap does not exist in the memory snapshot file, it means that there is no memory leak problem. If the same bitmap exists in the memory snapshot file, the application has a memory leak. By identifying the same bitmap in the memory snapshot file, determine whether the application has memory leaks caused by repeated creation of bitmap resources, further accurately and quickly locate applications with memory leaks, and improve application memory optimization. Efficiency and accuracy, reduce unnecessary memory consumption, and improve the experience of terminal use.
在另一个实施例中,通过通知开发者或用户本身内存泄露的问题,便于开发者优化应用程序中重复创建位图资源而导致的内存泄露的问题,便于用户准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In another embodiment, by notifying developers or users of their own memory leaks, it is convenient for developers to optimize memory leaks caused by repeated creation of bitmap resources in applications, and it is convenient for users to accurately and quickly locate memory leaks. Applications, improve the efficiency and accuracy of application memory optimization, reduce unnecessary memory consumption, and improve the experience of terminal use.
在另一个实施例中,可以直接将二进制格式的位图数据发送到预设终端,也可以将位图数据转化为可见的位图发送到预设终端。这样,预设终端的用户可以通过接收到的位图数据或位图发现应用程序中重复创建位图资源的问题,以便开发者及时优化应用程序,减少不必要的内存消耗,提高终端使用的体验度。In another embodiment, the bitmap data in binary format can be directly sent to the preset terminal, or the bitmap data can be converted into a visible bitmap and sent to the preset terminal. In this way, the user of the preset terminal can discover the problem of repeatedly creating bitmap resources in the application through the received bitmap data or bitmap, so that developers can optimize the application in time, reduce unnecessary memory consumption, and improve the experience of using the terminal Spend.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure.
图1是根据一示例性实施例示出的一种内存检测方法的流程图。Fig. 1 is a flow chart of a memory detection method according to an exemplary embodiment.
图2是根据另一示例性实施例示出的一种内存检测方法的流程图。Fig. 2 is a flow chart of a memory detection method according to another exemplary embodiment.
图3是根据一示例性实施例示出的一种内存检测装置的框图。Fig. 3 is a block diagram of a memory detection device according to an exemplary embodiment.
图4是根据一示例性实施例示出的提醒模块的框图。Fig. 4 is a block diagram of a reminder module according to an exemplary embodiment.
图5是根据一示例性实施例示出的一种用于内存检测的装置的框图。Fig. 5 is a block diagram of a device for memory detection according to an exemplary embodiment.
具体实施方式detailed description
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with aspects of the present disclosure as recited in the appended claims.
本公开实施例提供的技术方案,涉及终端,找出内存中被应用程序重复创建的位图资源,为程序的内存优化,提供了明确的处理目标。The technical solution provided by the embodiments of the present disclosure relates to a terminal, and finds out bitmap resources repeatedly created by application programs in memory, and provides a clear processing target for program memory optimization.
该终端可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等任一具有图像识别功能的设备。The terminal can be any device with image recognition function, such as mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, etc.
图1是根据一示例性实施例示出的一种内存检测方法的流程图,如图1所示,内存检测方法用于终端中,包括以下步骤:Fig. 1 is a flow chart of a memory detection method according to an exemplary embodiment. As shown in Fig. 1, the memory detection method is used in a terminal and includes the following steps:
在步骤S11中,当应用程序符合预设条件时,获取应用程序的内存快照文件;In step S11, when the application meets the preset condition, the memory snapshot file of the application is obtained;
在步骤S12中,从内存快照文件中提取至少两张位图的位图数据;In step S12, extract bitmap data of at least two bitmaps from the memory snapshot file;
在步骤S13中,根据位图数据对至少两张位图进行比较;In step S13, at least two bitmaps are compared according to the bitmap data;
在步骤S14中,当内存快照文件中存在相同位图时,执行预设提醒操作。In step S14, when the same bitmap exists in the memory snapshot file, a preset reminder operation is performed.
其中,内存快照文件,为关于内存数据集合的一个完全可用拷贝,该拷贝包括内存数据在某个时间点(拷贝开始的时间点)的映像。快照可以是其所表示的数据的一个副本,也可以是数据的一个复制品。Wherein, the memory snapshot file is a fully available copy of the memory data set, and the copy includes the image of the memory data at a certain point in time (the point in time when the copy starts). A snapshot can be either a copy or a replica of the data it represents.
本实施例中,通过获取内存快照文件,对内存快照文件的分析,找到内存中重复创建的位图资源,可以准确、快速地定位该应用程序因位图资源重复创建而导致的内存泄露问题,为应用程序的内存优化,提供了明确的处理目标,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, by obtaining the memory snapshot file and analyzing the memory snapshot file, the repeatedly created bitmap resource in the memory can be found, and the memory leak problem caused by the repeated creation of the bitmap resource of the application program can be accurately and quickly located. For the memory optimization of the application, it provides a clear processing target, improves the efficiency and accuracy of the memory optimization of the application, reduces unnecessary memory consumption, and improves the user experience of the terminal.
在另一个实施例中,应用程序符合预设条件,包括:应用程序当前正在运行。In another embodiment, the application meets a preset condition, including: the application is currently running.
本实施例中,可以对所有当前正在运行的应用程序的内存占用情况进行分析,以确定这些应用程序中是否存在因位图资源重复创建而导致的内存泄露问题,可以准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, the memory usage of all currently running applications can be analyzed to determine whether there is a memory leak problem caused by repeated creation of bitmap resources in these applications, and the existing memory can be accurately and quickly located. Leaked applications, improve the efficiency and accuracy of application memory optimization, reduce unnecessary memory consumption, and improve the experience of terminal use.
在另一个实施例中,应用程序符合预设条件,还包括:应用程序的内存占用值超过预设阈值。In another embodiment, the application meeting the preset condition further includes: the memory usage value of the application exceeds a preset threshold.
本实施例中,可以不用对所有当前正在运行的应用程序的内存占用情况进行分析,而是选择内存占用异常的应用程序进行分析。例如,应用程序A的实际内存占用值为150M,超过预设内存占用阈值100M,则对该应用程序A的内存占用情况进行分析,以确定该应用程序A是否存在因位图资源重复创建而导致的内存泄露问题,进一步准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, instead of analyzing the memory usage of all currently running applications, an application with abnormal memory usage may be selected for analysis. For example, if the actual memory usage value of application A is 150M, which exceeds the preset memory usage threshold of 100M, analyze the memory usage of application A to determine whether there is an error caused by repeated creation of bitmap resources in application A. memory leaks, further accurately and quickly locate applications with memory leaks, improve the efficiency and accuracy of application memory optimization, reduce unnecessary memory consumption, and improve the experience of terminal use.
在另一个实施例中,获取应用程序的内存快照文件,包括:In another embodiment, obtaining the memory snapshot file of the application program includes:
调用预设内存调试程序,根据所述应用程序的内存数据生成应用程序的内存快照文件,内存快照文件为二进制格式。A preset memory debugging program is invoked to generate a memory snapshot file of the application program according to the memory data of the application program, and the memory snapshot file is in a binary format.
其中,当终端操作系统为安卓系统时,预设内存调试程序可以为AndroidDebug Bridge(adb)工具,通过adb工具,调用adb shell am dumpheap命令,生成应用程序的内存快照文件。Wherein, when the terminal operating system is the Android system, the preset memory debugging program may be the AndroidDebug Bridge (adb) tool, and the adb shell am dumpheap command is invoked through the adb tool to generate a memory snapshot file of the application program.
本实施例中,调用预设调试程序生成应用程序的内存快照文件,从而后续可以通过分析内存快照文件确定应用程序是否存在因位图资源重复创建而导致的内存泄露问题,可以准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, the preset debugger is invoked to generate the memory snapshot file of the application program, so that the subsequent analysis of the memory snapshot file can determine whether the application program has a memory leak problem caused by repeated creation of bitmap resources, and can accurately and quickly locate For applications with memory leaks, improve the efficiency and accuracy of application memory optimization, reduce unnecessary memory consumption, and improve the experience of terminal use.
在另一个实施例中,从内存快照文件中提取至少两张位图的位图数据,包括:In another embodiment, the bitmap data of at least two bitmaps are extracted from the memory snapshot file, including:
使用预设内存分析程序,对内存快照文件进行分析,提取至少两张位图的位图数据。Use a preset memory analysis program to analyze the memory snapshot file and extract bitmap data of at least two bitmaps.
其中,预设内存分析程序可以为Memory Analyzer Tool(MAT)工具,对内存快照文件进行分析,找出内存快照文件中所有的位图资源,以二进制的格式保存下来。Wherein, the preset memory analysis program may be a Memory Analyzer Tool (MAT) tool, which analyzes the memory snapshot file, finds out all the bitmap resources in the memory snapshot file, and saves them in a binary format.
本实施例中,通过对内存快照文件进行分析,提取其中位图对应的数据。使得可以通过分析位图数据是否相同,确定应用程序是否存在因位图资源重复创建而导致的内存泄露问题,可以准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, the data corresponding to the bitmap is extracted by analyzing the memory snapshot file. By analyzing whether the bitmap data is the same, it is possible to determine whether the application has memory leaks caused by repeated creation of bitmap resources, accurately and quickly locate applications with memory leaks, and improve the efficiency and accuracy of application memory optimization. speed, reduce unnecessary memory consumption, and improve the experience of terminal use.
在另一个实施例中,根据位图数据对至少两张位图进行比较,包括:In another embodiment, comparing at least two bitmaps according to the bitmap data includes:
采用消息摘要算法5对至少两张位图的位图数据进行比较。The bitmap data of at least two bitmaps are compared using the message digest algorithm 5 .
其中,可以采用消息摘要算法5(MD5)对位图数据进行比较,找到相同位图的位图数据。Wherein, message digest algorithm 5 (MD5) may be used to compare the bitmap data to find the bitmap data of the same bitmap.
本实施例中,对相同位图的识别也可采用其他算法。如果内存快照文件中不存在相同位图,则说明不存在内存泄露的问题。如果内存快照文件中存在相同位图,则说明该应用程序存在内存泄露。通过对内存快照文件中相同位图的识别,确定该应用程序是否存在因位图资源重复创建而导致的内存泄露问题,进一步准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, other algorithms may also be used to identify the same bitmap. If the same bitmap does not exist in the memory snapshot file, it means that there is no memory leak problem. If the same bitmap exists in the memory snapshot file, the application has a memory leak. By identifying the same bitmap in the memory snapshot file, determine whether the application has memory leaks caused by repeated creation of bitmap resources, further accurately and quickly locate applications with memory leaks, and improve application memory optimization. Efficiency and accuracy, reduce unnecessary memory consumption, and improve the experience of terminal use.
在另一个实施例中,当内存快照文件中存在相同位图时,执行预设提醒操作,包括执行以下至少一项操作:In another embodiment, when the same bitmap exists in the memory snapshot file, performing a preset reminder operation includes performing at least one of the following operations:
将相同位图的位图数据发送到预设终端;Send the bitmap data of the same bitmap to the preset terminal;
在本终端对相同位图的位图数据进行提醒。Remind the bitmap data of the same bitmap on this terminal.
其中,该预设终端可以是应用程序开发者的终端。当应用程序存在因位图资源重复创建而导致的内存泄露问题时,可提醒该应用程序的开发者,或是提醒该终端的用户。Wherein, the preset terminal may be a terminal of an application program developer. When an application program has a memory leak problem caused by repeated creation of bitmap resources, the developer of the application program or the user of the terminal can be reminded.
本实施例中,通过通知开发者或用户本身内存泄露的问题,便于开发者优化应用程序中重复创建位图资源而导致的内存泄露的问题,便于用户准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, by notifying the developer or the user of the memory leak problem, it is convenient for the developer to optimize the memory leak problem caused by repeatedly creating bitmap resources in the application program, and it is convenient for the user to accurately and quickly locate the application program with the memory leak , improve the efficiency and accuracy of application memory optimization, reduce unnecessary memory consumption, and improve the experience of terminal use.
在另一个实施例中,将相同位图的位图数据发送到预设终端,包括:In another embodiment, sending bitmap data of the same bitmap to a preset terminal includes:
将相同位图的位图数据以二进制格式发送到预设终端;Send the bitmap data of the same bitmap to the preset terminal in binary format;
或or
将相同位图的位图数据以位图格式发送到预设终端。Send the bitmap data of the same bitmap to the preset terminal in bitmap format.
本实施例中,可以直接将二进制格式的位图数据发送到预设终端,也可以将位图数据转化为可见的位图发送到预设终端。这样,预设终端的用户可以通过接收到的位图数据或位图发现应用程序中重复创建位图资源的问题,以便开发者及时优化应用程序,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, the bitmap data in binary format can be directly sent to the preset terminal, or the bitmap data can be converted into a visible bitmap and sent to the preset terminal. In this way, the user of the preset terminal can discover the problem of repeatedly creating bitmap resources in the application through the received bitmap data or bitmap, so that developers can optimize the application in time, reduce unnecessary memory consumption, and improve the experience of using the terminal Spend.
以下对上述方法实施例进行具体说明。The above method embodiments are described in detail below.
图2是根据另一示例性实施例示出的一种内存检测方法的流程图,如图2所示,该方法包括以下步骤:Fig. 2 is a flowchart of a memory detection method shown according to another exemplary embodiment. As shown in Fig. 2, the method includes the following steps:
在步骤S21中,获取当前正在运行的应用程序A的内存占用值;In step S21, the memory usage value of the currently running application program A is acquired;
在步骤S22中,判断应用程序A的内存占用值超过预设阈值,如果是,执行步骤S23,如果否,执行步骤S21;In step S22, it is judged that the memory usage value of application A exceeds the preset threshold, if yes, execute step S23, if no, execute step S21;
在步骤S23中,调用adb工具,生成应用程序A的内存快照文件,内存快照文件为二进制格式。In step S23, the adb tool is invoked to generate a memory snapshot file of the application program A, and the memory snapshot file is in binary format.
在步骤S24中,使用MAT工具,对内存快照文件进行分析,提取至少两张位图的位图数据,以二进制的格式保存下来;In step S24, use the MAT tool to analyze the memory snapshot file, extract the bitmap data of at least two bitmaps, and save them in binary format;
在步骤S25中,采用MD5对位图数据进行比较;In step S25, adopt MD5 to compare bitmap data;
在步骤S26中,判断应用程序A的内存快照文件是否存在相同位图的位图数据,如果是,执行步骤S27,如果否,结束;In step S26, judge whether the memory snapshot file of application program A has the bitmap data of same bitmap, if yes, execute step S27, if no, end;
在步骤S27中,将相同位图的位图数据发送到应用程序A的开发者的终端。In step S27, the bitmap data of the same bitmap is transmitted to the terminal of the developer of the application A.
本实施例中,通过获取内存快照文件,对内存快照文件的分析,找到内存中重复创建的位图资源,可以准确、快速地定位该应用程序因位图资源重复创建而导致的内存泄露问题,为应用程序的内存优化,提供了明确的处理目标,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, by obtaining the memory snapshot file and analyzing the memory snapshot file, the repeatedly created bitmap resource in the memory can be found, and the memory leak problem caused by the repeated creation of the bitmap resource of the application program can be accurately and quickly located. For the memory optimization of the application, it provides a clear processing target, improves the efficiency and accuracy of the memory optimization of the application, reduces unnecessary memory consumption, and improves the user experience of the terminal.
下述为本公开装置实施例,可以用于执行本公开方法实施例。The following are device embodiments of the present disclosure, which can be used to implement the method embodiments of the present disclosure.
图3是根据一示例性实施例示出的一种内存检测装置的框图,该装置可以通过软件、硬件或者两者的结合实现成为电子设备的部分或者全部。如图3所示,该内存检测装置包括:Fig. 3 is a block diagram showing a memory detection device according to an exemplary embodiment, and the device can be implemented as part or all of an electronic device through software, hardware or a combination of the two. As shown in Figure 3, the memory detection device includes:
获取模块31,被配置为当应用程序符合预设条件时,获取应用程序的内存快照文件;The obtaining module 31 is configured to obtain the memory snapshot file of the application program when the application program meets the preset condition;
提取模块32,被配置为从获取模块31获取的内存快照文件中提取至少两张位图的位图数据;The extracting module 32 is configured to extract bitmap data of at least two bitmaps from the memory snapshot file acquired by the acquiring module 31;
比较模块33,被配置为根据提取模块32提取的位图数据对至少两张位图进行比较;The comparison module 33 is configured to compare at least two bitmaps according to the bitmap data extracted by the extraction module 32;
提醒模块34,被配置为当比较模块33比较得到内存快照文件中存在相同位图时,执行预设提醒操作。The reminder module 34 is configured to execute a preset reminder operation when the comparison module 33 finds that the same bitmap exists in the memory snapshot file.
其中,内存快照文件,为关于内存数据集合的一个完全可用拷贝,该拷贝包括内存数据在某个时间点(拷贝开始的时间点)的映像。快照可以是其所表示的数据的一个副本,也可以是数据的一个复制品。Wherein, the memory snapshot file is a fully available copy of the memory data set, and the copy includes the image of the memory data at a certain point in time (the point in time when the copy starts). A snapshot can be either a copy or a replica of the data it represents.
本实施例中,通过获取内存快照文件,对内存快照文件的分析,找到内存中重复创建的位图资源,可以准确、快速地定位该应用程序因位图资源重复创建而导致的内存泄露问题,为应用程序的内存优化,提供了明确的处理目标,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, by obtaining the memory snapshot file and analyzing the memory snapshot file, the repeatedly created bitmap resource in the memory can be found, and the memory leak problem caused by the repeated creation of the bitmap resource of the application program can be accurately and quickly located. For the memory optimization of the application, it provides a clear processing target, improves the efficiency and accuracy of the memory optimization of the application, reduces unnecessary memory consumption, and improves the user experience of the terminal.
可选的,应用程序符合预设条件,包括:应用程序当前正在运行。Optionally, the application meets preset conditions, including: the application is currently running.
本实施例中,可以对所有当前正在运行的应用程序的内存占用情况进行分析,以确定这些应用程序中是否存在因位图资源重复创建而导致的内存泄露问题,可以准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, the memory usage of all currently running applications can be analyzed to determine whether there is a memory leak problem caused by repeated creation of bitmap resources in these applications, and the existing memory can be accurately and quickly located. Leaked applications, improve the efficiency and accuracy of application memory optimization, reduce unnecessary memory consumption, and improve the experience of terminal use.
可选的,应用程序符合预设条件,还包括:应用程序的内存占用值超过预设阈值。Optionally, the application meeting the preset condition also includes: the memory usage value of the application exceeds a preset threshold.
本实施例中,可以不用对所有当前正在运行的应用程序的内存占用情况进行分析,而是选择内存占用异常的应用程序进行分析。例如,应用程序A的实际内存占用值为150M,超过预设内存占用阈值100M,则对该应用程序A的内存占用情况进行分析,以确定该应用程序A是否存在因位图资源重复创建而导致的内存泄露问题,进一步准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, instead of analyzing the memory usage of all currently running applications, an application with abnormal memory usage may be selected for analysis. For example, if the actual memory usage value of application A is 150M, which exceeds the preset memory usage threshold of 100M, analyze the memory usage of application A to determine whether there is an error caused by repeated creation of bitmap resources in application A. memory leaks, further accurately and quickly locate applications with memory leaks, improve the efficiency and accuracy of application memory optimization, reduce unnecessary memory consumption, and improve the experience of terminal use.
可选的,获取模块31,被配置为调用预设内存调试程序,根据所述应用程序的内存数据生成应用程序的内存快照文件,内存快照文件为二进制格式。Optionally, the obtaining module 31 is configured to invoke a preset memory debugging program, and generate a memory snapshot file of the application program according to the memory data of the application program, and the memory snapshot file is in a binary format.
其中,当终端操作系统为安卓系统时,预设内存调试程序可以为AndroidDebug Bridge(adb)工具,通过adb工具,调用adb shell am dumpheap命令,生成应用程序的内存快照文件。Wherein, when the terminal operating system is the Android system, the preset memory debugging program may be the AndroidDebug Bridge (adb) tool, and the adb shell am dumpheap command is invoked through the adb tool to generate a memory snapshot file of the application program.
本实施例中,调用预设调试程序生成应用程序的内存快照文件,从而后续可以通过分析内存快照文件确定应用程序是否存在因位图资源重复创建而导致的内存泄露问题,可以准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, the preset debugger is invoked to generate the memory snapshot file of the application program, so that the subsequent analysis of the memory snapshot file can determine whether the application program has a memory leak problem caused by repeated creation of bitmap resources, and can accurately and quickly locate For applications with memory leaks, improve the efficiency and accuracy of application memory optimization, reduce unnecessary memory consumption, and improve the experience of terminal use.
可选的,提取模块32,被配置为使用预设内存分析程序,对获取模块31获取的内存快照文件进行分析,提取至少两张位图的位图数据。Optionally, the extraction module 32 is configured to use a preset memory analysis program to analyze the memory snapshot file acquired by the acquisition module 31, and extract bitmap data of at least two bitmaps.
其中,预设内存分析程序可以为Memory Analyzer Tool(MAT)工具,对内存快照文件进行分析,找出内存快照文件中所有的位图资源,以二进制的格式保存下来。Wherein, the preset memory analysis program may be a Memory Analyzer Tool (MAT) tool, which analyzes the memory snapshot file, finds out all the bitmap resources in the memory snapshot file, and saves them in a binary format.
本实施例中,通过对内存快照文件进行分析,提取其中位图对应的数据。使得可以通过分析位图数据是否相同,确定应用程序是否存在因位图资源重复创建而导致的内存泄露问题,可以准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, the data corresponding to the bitmap is extracted by analyzing the memory snapshot file. By analyzing whether the bitmap data is the same, it is possible to determine whether the application has memory leaks caused by repeated creation of bitmap resources, accurately and quickly locate applications with memory leaks, and improve the efficiency and accuracy of application memory optimization. speed, reduce unnecessary memory consumption, and improve the experience of terminal use.
可选的,比较模块33,被配置为采用消息摘要算法5对提取模块32提取的至少两张位图的位图数据进行比较。Optionally, the comparison module 33 is configured to use the message digest algorithm 5 to compare the bitmap data of at least two bitmaps extracted by the extraction module 32 .
其中,可以采用消息摘要算法5(MD5)对位图数据进行比较,找到相同位图的位图数据。Wherein, message digest algorithm 5 (MD5) may be used to compare the bitmap data to find the bitmap data of the same bitmap.
本实施例中,对相同位图的识别也可采用其他算法。如果内存快照文件中不存在相同位图,则说明不存在内存泄露的问题。如果内存快照文件中存在相同位图,则说明该应用程序存在内存泄露。通过对内存快照文件中相同位图的识别,确定该应用程序是否存在因位图资源重复创建而导致的内存泄露问题,进一步准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, other algorithms may also be used to identify the same bitmap. If the same bitmap does not exist in the memory snapshot file, it means that there is no memory leak problem. If the same bitmap exists in the memory snapshot file, the application has a memory leak. By identifying the same bitmap in the memory snapshot file, determine whether the application has memory leaks caused by repeated creation of bitmap resources, further accurately and quickly locate applications with memory leaks, and improve application memory optimization. Efficiency and accuracy, reduce unnecessary memory consumption, and improve the experience of terminal use.
图4是根据一示例性实施例示出的提醒模块的框图,如图4所示,提醒模块34包括Fig. 4 is a block diagram of a reminder module shown according to an exemplary embodiment, as shown in Fig. 4, the reminder module 34 includes
发送子模块41,被配置为将相同位图的位图数据以二进制格式发送到预设终端;或将相同位图的位图数据以位图格式发送到预设终端。The sending sub-module 41 is configured to send the bitmap data of the same bitmap to the preset terminal in binary format; or send the bitmap data of the same bitmap to the preset terminal in bitmap format.
其中,该预设终端可以是应用程序开发者的终端。当应用程序存在因位图资源重复创建而导致的内存泄露问题时,可提醒该应用程序的开发者,或是提醒该终端的用户。Wherein, the preset terminal may be a terminal of an application program developer. When an application program has a memory leak problem caused by repeated creation of bitmap resources, the developer of the application program or the user of the terminal can be reminded.
本实施例中,通过通知开发者或用户本身内存泄露的问题,便于开发者优化应用程序中重复创建位图资源而导致的内存泄露的问题,便于用户准确、快速地定位存在内存泄露的应用程序,提高应用程序内存优化的效率和准确度,减少不必要的内存消耗,提高终端使用的体验度。可以直接将二进制格式的位图数据发送到预设终端,也可以将位图数据转化为可见的位图发送到预设终端。这样,预设终端的用户可以通过接收到的位图数据或位图发现应用程序中重复创建位图资源的问题,以便开发者及时优化应用程序,减少不必要的内存消耗,提高终端使用的体验度。In this embodiment, by notifying the developer or the user of the memory leak problem, it is convenient for the developer to optimize the memory leak problem caused by repeatedly creating bitmap resources in the application program, and it is convenient for the user to accurately and quickly locate the application program with the memory leak , improve the efficiency and accuracy of application memory optimization, reduce unnecessary memory consumption, and improve the experience of terminal use. You can directly send the bitmap data in binary format to the preset terminal, or convert the bitmap data into a visible bitmap and send it to the preset terminal. In this way, the user of the preset terminal can discover the problem of repeatedly creating bitmap resources in the application through the received bitmap data or bitmap, so that developers can optimize the application in time, reduce unnecessary memory consumption, and improve the experience of using the terminal Spend.
本公开还提供一种内存检测装置,包括:The present disclosure also provides a memory detection device, including:
处理器;processor;
用于存储处理器可执行指令的存储器;memory for storing processor-executable instructions;
其中,所述处理器被配置为:Wherein, the processor is configured as:
当应用程序符合预设条件时,获取所述应用程序的内存快照文件;When the application meets the preset conditions, obtain the memory snapshot file of the application;
从所述内存快照文件中提取所述至少两张位图的位图数据;Extracting the bitmap data of the at least two bitmaps from the memory snapshot file;
根据所述位图数据对所述至少两张位图进行比较;comparing the at least two bitmaps according to the bitmap data;
当所述内存快照文件中存在相同位图时,执行预设提醒操作。When the same bitmap exists in the memory snapshot file, a preset reminder operation is performed.
图5是根据一示例性实施例示出的一种用于内存检测的装置的框图,该装置适用于终端设备。例如,装置1700可以是摄像机,录音设备,移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。Fig. 5 is a block diagram of an apparatus for memory detection according to an exemplary embodiment, and the apparatus is applicable to a terminal device. For example, the apparatus 1700 may be a video camera, a recording device, a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and the like.
装置1700可以包括以下一个或多个组件:处理组件1702,存储器1704,电源组件1706,多媒体组件1708,音频组件1710,输入/输出(I/O)的接口1712,传感器组件1714,以及通信组件1716。Apparatus 1700 may include one or more of the following components: processing component 1702, memory 1704, power supply component 1706, multimedia component 1708, audio component 1710, input/output (I/O) interface 1712, sensor component 1714, and communication component 1716 .
处理组件1702通常控制装置1700的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件1702可以包括一个或多个处理器1720来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件1702可以包括一个或多个模块,便于处理组件1702和其他组件之间的交互。例如,处理组件1702可以包括多媒体模块,以方便多媒体组件1708和处理组件1702之间的交互。The processing component 1702 generally controls the overall operations of the device 1700, such as those associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 1702 may include one or more processors 1720 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 1702 may include one or more modules that facilitate interaction between processing component 1702 and other components. For example, processing component 1702 may include a multimedia module to facilitate interaction between multimedia component 1708 and processing component 1702 .
存储器1704被配置为存储各种类型的数据以支持在设备1700的操作。这些数据的示例包括用于在装置1700上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器1704可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。The memory 1704 is configured to store various types of data to support operations at the device 1700 . Examples of such data include instructions for any application or method operating on device 1700, contact data, phonebook data, messages, pictures, videos, and the like. The memory 1704 can be realized by any type of volatile or non-volatile memory device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
电源组件1706为装置1700的各种组件提供电力。电源组件1706可以包括电源管理系统,一个或多个电源,及其他与为装置1700生成、管理和分配电力相关联的组件。The power supply component 1706 provides power to various components of the device 1700 . Power components 1706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for device 1700 .
多媒体组件1708包括在所述装置1700和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件1708包括一个前置摄像头和/或后置摄像头。当设备1700处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。The multimedia component 1708 includes a screen that provides an output interface between the device 1700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense a boundary of a touch or swipe action, but also detect duration and pressure associated with the touch or swipe action. In some embodiments, the multimedia component 1708 includes a front camera and/or a rear camera. When the device 1700 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capability.
音频组件1710被配置为输出和/或输入音频信号。例如,音频组件1710包括一个麦克风(MIC),当装置1700处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器1704或经由通信组件1716发送。在一些实施例中,音频组件1710还包括一个扬声器,用于输出音频信号。The audio component 1710 is configured to output and/or input audio signals. For example, the audio component 1710 includes a microphone (MIC), which is configured to receive external audio signals when the device 1700 is in operation modes, such as call mode, recording mode and voice recognition mode. Received audio signals may be further stored in memory 1704 or sent via communication component 1716 . In some embodiments, the audio component 1710 also includes a speaker for outputting audio signals.
I/O接口1712为处理组件1702和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 1712 provides an interface between the processing component 1702 and a peripheral interface module, and the above peripheral interface module may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: a home button, volume buttons, start button, and lock button.
传感器组件1714包括一个或多个传感器,用于为装置1700提供各个方面的状态评估。例如,传感器组件1714可以检测到设备1700的打开/关闭状态,组件的相对定位,例如所述组件为装置1700的显示器和小键盘,传感器组件1714还可以检测装置1700或装置1700一个组件的位置改变,用户与装置1700接触的存在或不存在,装置1700方位或加速/减速和装置1700的温度变化。传感器组件1714可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件1714还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件1714还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。Sensor assembly 1714 includes one or more sensors for providing status assessments of various aspects of device 1700 . For example, the sensor component 1714 can detect the open/closed state of the device 1700, the relative positioning of components, such as the display and keypad of the device 1700, and the sensor component 1714 can also detect a change in the position of the device 1700 or a component of the device 1700 , the presence or absence of user contact with the device 1700, the device 1700 orientation or acceleration/deceleration and the temperature change of the device 1700. Sensor assembly 1714 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. Sensor assembly 1714 may also include optical sensors, such as CMOS or CCD image sensors, for use in imaging applications. In some embodiments, the sensor assembly 1714 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.
通信组件1716被配置为便于装置1700和其他设备之间有线或无线方式的通信。装置1700可以接入基于通信标准的无线网络,如WiFi,2G或3G,或它们的组合。在一个示例性实施例中,通信组件1716经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件1716还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。The communication component 1716 is configured to facilitate wired or wireless communication between the apparatus 1700 and other devices. The device 1700 can access wireless networks based on communication standards, such as WiFi, 2G or 3G, or a combination thereof. In one exemplary embodiment, the communication component 1716 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1716 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology and other technologies.
在示例性实施例中,装置1700可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, apparatus 1700 may be programmed by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation for performing the methods described above.
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器1704,上述指令可由装置1700的处理器1720执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, there is also provided a non-transitory computer-readable storage medium including instructions, such as the memory 1704 including instructions, which can be executed by the processor 1720 of the device 1700 to implement the above method. For example, the non-transitory computer readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
一种非临时性计算机可读存储介质,当所述存储介质中的指令由装置1700的处理器执行时,使得装置1700能够执行上述内存检测的方法,所述方法包括:A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by the processor of the device 1700, the device 1700 is enabled to perform the above-mentioned memory detection method, the method comprising:
当应用程序符合预设条件时,获取所述应用程序的内存快照文件;When the application meets the preset conditions, obtain the memory snapshot file of the application;
从所述内存快照文件中提取所述至少两张位图的位图数据;Extracting the bitmap data of the at least two bitmaps from the memory snapshot file;
根据所述位图数据对所述至少两张位图进行比较;comparing the at least two bitmaps according to the bitmap data;
当所述内存快照文件中存在相同位图时,执行预设提醒操作。When the same bitmap exists in the memory snapshot file, a preset reminder operation is performed.
可选的,所述获取所述应用程序的内存快照文件,包括:Optionally, the acquiring the memory snapshot file of the application includes:
调用预设内存调试程序,根据所述应用程序的内存数据生成所述应用程序的内存快照文件,所述内存快照文件为二进制格式。Invoke a preset memory debugging program, generate a memory snapshot file of the application program according to the memory data of the application program, and the memory snapshot file is in a binary format.
可选的,所述从所述内存快照文件中提取至少两张位图的位图数据,包括:Optionally, the extracting bitmap data of at least two bitmaps from the memory snapshot file includes:
使用预设内存分析程序,对所述内存快照文件进行分析,提取至少两张位图的位图数据;Using a preset memory analysis program to analyze the memory snapshot file and extract bitmap data of at least two bitmaps;
所述根据所述位图数据对所述至少两张位图进行比较,包括:The comparing the at least two bitmaps according to the bitmap data includes:
采用消息摘要算法5对所述至少两张位图的位图数据进行比较。A message digest algorithm 5 is used to compare the bitmap data of the at least two bitmaps.
可选的,所述执行预设提醒操作,包括:Optionally, the execution of preset reminder operations includes:
将所述相同位图的位图数据以二进制格式发送到所述预设终端;sending the bitmap data of the same bitmap to the preset terminal in binary format;
或or
将所述相同位图的位图数据以位图格式发送到所述预设终端。sending the bitmap data of the same bitmap to the preset terminal in a bitmap format.
本领域技术人员在考虑说明书及实践这里公开的公开后,将容易想到本公开的其它实施方案。本申请旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求指出。Other embodiments of the disclosure will be readily apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, and these modifications, uses or adaptations follow the general principles of the present disclosure and include common knowledge or conventional technical means in the technical field not disclosed in the present disclosure . The specification and examples are to be considered exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限制。It should be understood that the present disclosure is not limited to the precise constructions which have been described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (9)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610210654.6A CN105912398A (en) | 2016-04-06 | 2016-04-06 | Memory detection method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610210654.6A CN105912398A (en) | 2016-04-06 | 2016-04-06 | Memory detection method and device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN105912398A true CN105912398A (en) | 2016-08-31 |
Family
ID=56745464
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610210654.6A Pending CN105912398A (en) | 2016-04-06 | 2016-04-06 | Memory detection method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN105912398A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107480047A (en) * | 2017-07-13 | 2017-12-15 | 珠海金山网络游戏科技有限公司 | A kind of method and device of internal memory auto snapshot |
| CN111639018A (en) * | 2019-03-01 | 2020-09-08 | 阿里巴巴集团控股有限公司 | Memory leak detection method and device |
Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102262582A (en) * | 2010-05-25 | 2011-11-30 | 芯讯通无线科技(上海)有限公司 | Mobile terminal and method for detecting memory leakage thereof |
| CN103218307A (en) * | 2013-04-18 | 2013-07-24 | 海信集团有限公司 | Memory management system and memory management method |
| CN103617129A (en) * | 2013-12-10 | 2014-03-05 | 中科创达软件股份有限公司 | Method and device for processing memory |
| CN103942750A (en) * | 2013-01-17 | 2014-07-23 | 腾讯科技(深圳)有限公司 | Screen image recording method and device |
| US20150067639A1 (en) * | 2013-08-30 | 2015-03-05 | Apple Inc. | Concurrent accesses of dynamically typed object data |
| CN104516817A (en) * | 2012-05-15 | 2015-04-15 | 青岛海信移动通信技术股份有限公司 | Memory leak detection method and device |
| CN105224433A (en) * | 2014-06-23 | 2016-01-06 | 阿里巴巴集团控股有限公司 | A kind of internal memory monitoring method and server |
| CN105373471A (en) * | 2014-08-29 | 2016-03-02 | 腾讯科技(深圳)有限公司 | Detection method and apparatus for memory leak bug |
-
2016
- 2016-04-06 CN CN201610210654.6A patent/CN105912398A/en active Pending
Patent Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102262582A (en) * | 2010-05-25 | 2011-11-30 | 芯讯通无线科技(上海)有限公司 | Mobile terminal and method for detecting memory leakage thereof |
| CN104516817A (en) * | 2012-05-15 | 2015-04-15 | 青岛海信移动通信技术股份有限公司 | Memory leak detection method and device |
| CN103942750A (en) * | 2013-01-17 | 2014-07-23 | 腾讯科技(深圳)有限公司 | Screen image recording method and device |
| CN103218307A (en) * | 2013-04-18 | 2013-07-24 | 海信集团有限公司 | Memory management system and memory management method |
| US20150067639A1 (en) * | 2013-08-30 | 2015-03-05 | Apple Inc. | Concurrent accesses of dynamically typed object data |
| CN103617129A (en) * | 2013-12-10 | 2014-03-05 | 中科创达软件股份有限公司 | Method and device for processing memory |
| CN105224433A (en) * | 2014-06-23 | 2016-01-06 | 阿里巴巴集团控股有限公司 | A kind of internal memory monitoring method and server |
| CN105373471A (en) * | 2014-08-29 | 2016-03-02 | 腾讯科技(深圳)有限公司 | Detection method and apparatus for memory leak bug |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107480047A (en) * | 2017-07-13 | 2017-12-15 | 珠海金山网络游戏科技有限公司 | A kind of method and device of internal memory auto snapshot |
| CN111639018A (en) * | 2019-03-01 | 2020-09-08 | 阿里巴巴集团控股有限公司 | Memory leak detection method and device |
| CN111639018B (en) * | 2019-03-01 | 2023-05-26 | 阿里巴巴集团控股有限公司 | Memory leakage detection method and device |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10649648B2 (en) | Method and apparatus for screen capture processing | |
| WO2016029642A1 (en) | Background application program control method, device and terminal device | |
| CN108509232A (en) | Screen recording method, device and computer readable storage medium | |
| CN106372204A (en) | Push message processing method and device | |
| US20170013456A1 (en) | Method and device for testing a terminal | |
| CN107132949B (en) | Anti-interference method, device, terminal and storage medium | |
| EP3076745A1 (en) | Methods and apparatuses for controlling wireless access point | |
| CN111371837A (en) | Function presenting method, function presenting device, and storage medium | |
| CN107562500A (en) | Debugging apparatus, method and apparatus | |
| RU2665300C2 (en) | Method and device for processing point reporting of touch screen | |
| CN106354504A (en) | Message display method and device thereof | |
| CN110610090A (en) | Information processing method and device, storage medium | |
| CN106528385A (en) | System fluency monitoring method and apparatus, and terminal | |
| CN107391128A (en) | The method and apparatus for monitoring virtual file object model vdom | |
| CN107463372A (en) | The method for updating pages and device of a kind of data-driven | |
| EP3460717A1 (en) | Method, apparatus, terminal, and computer-readable storage medium for processing fingerprints | |
| US10671827B2 (en) | Method and device for fingerprint verification | |
| CN105912202A (en) | Application sharing method and device | |
| CN105912398A (en) | Memory detection method and device | |
| EP3211556A1 (en) | Method and device for verifying fingerprint | |
| CN112083841A (en) | Information input method, device and storage medium | |
| CN108206881A (en) | Mobile terminal reminding method, device and mobile terminal | |
| CN105786561A (en) | Process calling method and apparatus | |
| CN108132885A (en) | Data capture method, device and electronic equipment | |
| CN107526683B (en) | Application program function redundancy detection method, device and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160831 |
|
| RJ01 | Rejection of invention patent application after publication |