WO2019237891A1 - 一种内存优化方法、装置、可读存储介质及移动终端 - Google Patents

一种内存优化方法、装置、可读存储介质及移动终端 Download PDF

Info

Publication number
WO2019237891A1
WO2019237891A1 PCT/CN2019/087751 CN2019087751W WO2019237891A1 WO 2019237891 A1 WO2019237891 A1 WO 2019237891A1 CN 2019087751 W CN2019087751 W CN 2019087751W WO 2019237891 A1 WO2019237891 A1 WO 2019237891A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
application
average
running
optimization method
Prior art date
Application number
PCT/CN2019/087751
Other languages
English (en)
French (fr)
Inventor
马超辉
Original Assignee
奇酷互联网络科技(深圳)有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 奇酷互联网络科技(深圳)有限公司 filed Critical 奇酷互联网络科技(深圳)有限公司
Publication of WO2019237891A1 publication Critical patent/WO2019237891A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation 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/5016Allocation 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 the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation 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/5022Mechanisms to release resources

Definitions

  • the present invention relates to the field of computer technology, and in particular, to a memory optimization method, device, readable storage medium, and mobile terminal.
  • the object of the present invention is to solve the problem that in the prior art, some mobile terminal products cannot automatically clear memory.
  • the present invention provides a memory optimization method, wherein the method includes the following steps:
  • the program operation information After receiving a system power-on signal, obtaining program operation information corresponding to each application program in the use state in each unit timing period, the program operation information includes at least the number of operations, the average operation time, and the average memory occupation value;
  • the corresponding application is cleared according to a preset sorting rule according to a plurality of the weight values to ensure that the remaining memory of the system is not lower than the preset memory .
  • the memory optimization method proposed by the present invention divides the running process of the mobile terminal into multiple unit timing cycles.
  • the system automatically records the running times, average running time, and average memory occupation value corresponding to each application. Because the above-mentioned number of runs, average running time, and average memory footprint are directly related to the memory footprint, the weight value corresponding to the application is calculated based on the above three calculation elements.
  • the remaining memory of the system is lower than the preset memory , Indicating that the memory is overloaded.
  • the corresponding application can be cleaned according to the preset sorting rule according to the weight value of each application, so that the remaining memory of the system is larger than the preset memory, thereby ensuring the normal operation of the mobile terminal.
  • the memory optimization method provided by the present invention can automatically clean up the running memory of the mobile terminal device, and improves the user experience.
  • the program operation information further includes an application program name, an application package name, a single run time, and a single memory occupation value
  • the method for determining the single run time includes the following steps:
  • the single operation duration is calculated and obtained.
  • the memory optimization method wherein the calculation method of the average running time includes the following steps:
  • the memory optimization method wherein the calculation method of the average memory occupation value includes the following steps:
  • the memory optimization method wherein the method of calculating and obtaining a weight value corresponding to each of the application programs includes the following steps:
  • the memory optimization method wherein the calculation method of the unit weight value includes the following steps:
  • the memory optimization method wherein the method for clearing the corresponding application according to a preset sorting rule includes the following steps:
  • the corresponding application is eliminated according to the weight value from small to large.
  • the memory optimization method wherein the method further includes:
  • the invention provides a memory optimization device, wherein the device includes:
  • An operation monitoring module is configured to obtain program operation information corresponding to each application program that is in use in each unit timing period after receiving a system startup signal.
  • the program operation information includes at least the number of operations, the average operation time, and Average memory footprint
  • a weight calculation module configured to calculate a weight value corresponding to each of the applications according to the obtained running times, the average running time, and the average memory occupation value;
  • a memory optimization module configured to, when determining that the remaining system memory is lower than the preset memory, clear the corresponding application program according to a preset sorting rule according to a plurality of the weight values to ensure that the remaining system memory is not low In the preset memory.
  • the invention also proposes a readable storage medium on which a computer program is stored, wherein the computer program implements the memory optimization method as described above when executed by a processor.
  • the readable storage medium wherein the memory optimization method implemented when the computer program is executed by a processor further includes:
  • the present invention also provides a mobile terminal including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the memory optimization method as described above when the computer program is executed .
  • the mobile terminal wherein the memory optimization method implemented when the processor executes the computer program further includes:
  • the mobile terminal wherein the computer program is excluded from a scope of the application program being cleared.
  • FIG. 1 is a flowchart of a memory optimization method according to a first embodiment of the present invention
  • FIG. 2 is a flowchart of a memory optimization method according to a second embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of a memory optimization apparatus according to a third embodiment of the present invention.
  • the present invention proposes a memory optimization method, wherein the method includes the following steps:
  • the program operation information includes at least the number of operations, the average operation time, and the average memory usage .
  • a mobile phone is taken as an example for illustration.
  • the mobile phone system immediately monitors the running application program.
  • the monitoring process is divided into a plurality of unit timing cycles.
  • the monitored application X's program running information in unit timing period T 0 includes: application name AppName, application package name Package Nname, and average running time T in period T 0 . 0 L, the average memory occupancy value M 0 in the period T 0 and the number of running times N 0 of the application X.
  • What needs to be added here is that in each unit timing period, there may be situations where multiple applications are running simultaneously, and the mobile phone system also monitors the program running information of other running applications.
  • the phone After obtaining the application X operating frequency N 0 in the cell timing cycle T 0 in monitoring the length T 0 L and the average memory occupancy value M 0 average operating time, if the phone continues to run, the phone will continue to monitor the next cell timing In the period T 1 , the relevant program operation information of the application program X.
  • the monitored program running information of the application X is: the number of running times N 1 , the average running time T 1 L, and the average memory occupation value M 1 .
  • the monitored program running information of the application X is: the number of running times N 2 , the average running time T 2 L, and the average memory occupation value M 2 .
  • the program running information of the monitored application X is: the number of running times N N , the average running time T N L and the average memory occupation value M N.
  • a weight value corresponding to each application program is calculated according to the monitored information. Specifically, at the end of the timing of the unit timing period T 1 , the changes in the number of running times of the application X, the changes in the average running time, and the changes in the average memory usage are:
  • TLC 1 T 1 LT 0 L
  • the unit weight corresponding to the application X is:
  • WX 1 NC 1 * X + TCL 1 * Y + MC 1 * Z
  • X, Y, and Z are coefficients.
  • the above method can be used to calculate and obtain the unit weight values WX 2 , WX 3 of the application program X within the subsequent multiple unit timing cycles ... WX N. Finally, the calculated multiple unit timing periods are accumulated to obtain the total weight value of the application X. It should be noted here that the same method described above can be used to calculate the total weight of other applications.
  • the mobile phone system memory needs to be cleaned at this time to ensure the smooth running of the mobile phone.
  • the application can be cleaned according to a preset sorting rule.
  • each application is cleaned up in a manner that the total weight value of each application is sequentially reduced until the remaining memory of the system is not less than the preset memory, that is, the normal operation of the mobile phone system can be guaranteed.
  • the memory optimization method proposed by the present invention divides the running process of the mobile terminal into multiple unit timing cycles.
  • the system automatically records the running times, average running time, and average memory occupation value corresponding to each application. Because the above-mentioned number of runs, average running time, and average memory footprint are directly related to the memory footprint, the weight value corresponding to the application is calculated based on the above three calculation elements.
  • the remaining memory of the system is lower than the preset memory , Indicating that the memory is overloaded.
  • the corresponding application can be cleaned according to the preset sorting rule according to the weight value of each application, so that the remaining memory of the system is larger than the preset memory, thereby ensuring the normal operation of the mobile terminal.
  • the memory optimization method provided by the present invention can automatically clean up the running memory of the mobile terminal device, and improves the user experience.
  • This embodiment is described by using a portable tablet as an example. After the user presses the power-on button, the smart tablet starts running various applications.
  • S202 Monitor the running information of the program, including the number of runs, the length of a single run, and the value of a single memory occupation.
  • the tablet system monitors the running information of the running application.
  • the monitoring process is divided into a plurality of unit timing cycles.
  • the program running information of the application program X monitored by the system includes:
  • Time points at which application X is awakened T 0 S 0 , T 0 S 1 , T 0 S 2 , T 0 S 3 ?? T 0 S N
  • Time points at which application X is released T 0 E 0 , T 0 E 1 , T 0 E 2 , T 0 E 3 ... T 0 E N
  • the program operation information of the above-mentioned application program X is all recorded in the file A.
  • the tablet system After the above-mentioned first unit timing period T 0 ends, the second unit timing period T 1 begins.
  • the tablet system also records the following information of the application X into the file A:
  • the program running information of the application program X monitored by the system includes:
  • Time points at which application X is awakened T 1 S 0 , T 1 S 1 , T 1 S 2 , T 1 S 3 ... T 1 S N
  • Time points at which application X is released T 1 E 0 , T 1 E 1 , T 1 E 2 , T 1 E 3 ... T 1 E N
  • the tablet system also records the following information of the application X into the file A:
  • the program running information of the application program X monitored by the system includes:
  • Time points at which application X is awakened T 2 S 0 , T 2 S 1 , T 2 S 2 , T 2 S 3 ... T 2 S N
  • Time points at which application X is released T 2 E 0 , T 2 E 1 , T 2 E 2 , T 2 E 3 ... T 2 E N
  • the program operation information of the application program X monitored by the system includes:
  • Time points at which application X is awakened T N S 0 , T N S 1 , T N S 2 , T N S 3 ... T N S N
  • Time points at which application X is released T N E 0 , T N E 1 , T N E 2 , T N E 3 ... T N E N
  • T 0 L (T 0 L 0 + T 0 L 1 + T 0 L 2 + T 0 L 3 ?? + T 0 L N ) / N 0
  • T 1 L (T 1 L 0 + T 1 L 1 + T 1 L 2 + T 1 L 3 ?? T 1 L N ) / N 1
  • T 2 L (T 2 L 0 + T 2 L 1 + T 2 L 2 + T 2 L 3 ?? T 2 L N ) / N 2
  • T N L (T N L 0 + T N L 1 + T N L 2 + T N L 3 ?? T N L N ) / N N
  • the relevant operating parameter difference of the application X is as follows:
  • TLC 1 T 1 LT 0 L
  • MC 1 M 1 -M 0
  • TLC 2 T 2 LT 1 L
  • TLC N T N LT N-1 L
  • the unit weight corresponding to the application X is:
  • WX 1 NC 1 * X + TLC 1 * Y + MC 1 * Z
  • the unit weight corresponding to the application X is:
  • WX 2 NC 2 * X + TLC 2 * Y + MC 2 * Z
  • the unit weight corresponding to the application X is:
  • WX 3 NC 3 * X + TLC 3 * Y + MC 3 * Z
  • the unit weight corresponding to the application X is:
  • WX N NC N * X + TLC N * Y + MC N * Z
  • X, Y, and Z are coefficients.
  • the multiple unit weight values are accumulated to obtain the total weight value, and the corresponding expression is:
  • WX WX 1 + WX 2 + WX 3 ?? + WX N
  • the tablet system determines that the remaining memory of the system is less than the preset memory, the memory of the tablet system needs to be cleaned at this time to ensure the smoothness of the running of the tablet system. Understandably, when the remaining memory of the system is larger than the preset memory, there is no need to perform memory cleaning at this time.
  • the total weight value corresponding to each application is arranged in a descending order and sequentially cleaned.
  • the total weight value is arranged in descending order, which is: “WeChat”, the corresponding total weight value is 16%; “Alipay”, the corresponding total weight value is 10%; “High German Map”, The corresponding total weight value is 8%; for “Mobile Taobao”, the corresponding total weight value is 7%; for “Ctrip Travel”, the corresponding total weight value is 5%, according to “WeChat", “Alipay”, “Gold Map “,” Mobile Taobao "and” Ctrip Travel "in order.
  • the memory cleaning software embedded in the tablet system itself is not cleaned and does not belong to the cleaned list.
  • users can also manually set the permissions of each application to be automatically cleaned up according to their own application requirements. For some applications that need to run in real time, they are excluded from the cleaning list.
  • a memory optimization device includes an operation monitoring module 11, a weight calculation module 12, and a memory optimization module 13 connected in this order.
  • the operation monitoring module 11 is specifically configured to:
  • the program operation information After receiving a system power-on signal, obtaining program operation information corresponding to each application program in the use state in each unit timing period, the program operation information includes at least the number of operations, the average operation time, and the average memory occupation value;
  • the weight calculation module 12 is specifically configured to:
  • the memory optimization module 13 is specifically configured to:
  • the corresponding application is cleared according to a preset sorting rule according to a plurality of the weight values to ensure that the remaining memory of the system is not lower than the preset memory .
  • the present invention also proposes a readable storage medium on which a computer program is stored, wherein when the program is executed by a processor, the memory optimization method described above is implemented.
  • the present invention also provides a mobile terminal including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the memory optimization method as described above when the program is executed.
  • the program may be stored in a computer-readable storage medium.
  • the storage medium includes: ROM / RAM, magnetic disk, optical disk, and the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephone Function (AREA)
  • Stored Programmes (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

本发明涉及一种内存优化方法、装置、可读存储介质及移动终端,所述方法包括如下步骤:当接收到一系统开机信号之后,获取每个单元计时周期内处于使用状态的每个应用程序对应的程序运行信息;根据获取的运行次数、平均运行时长以及平均内存占用值,计算得到每个应用程序对应的权重值;当判断到系统剩余内存低于预设内存时,则根据多个所述权重值,按照预设排序规则清除对应的应用程序,以保证系统剩余内存不低于预设内存。本发明提出的内存优化方法,可实现对移动终端设备的运行内存的自动清理,提高了用户使用体验。

Description

一种内存优化方法、装置、可读存储介质及移动终端 【技术领域】
本发明涉及计算机技术领域,特别涉及一种内存优化方法、装置、可读存储介质及移动终端。
【背景技术】
随着经济的日益发展以及科技产品的不断更新与普及,移动终端已经成为了人们日常生活中最为常见的电子设备,为人们的工作以及生活提供了极大的便利。
目前,各类智能操作系统在诸如手机、平板电脑、车载终端上的应用,使得移动终端基于各类应用程序的功能也越来越丰富,随之而来的是对运行内存需求提出了更高的要求。近年来,为移动终端配置更高内存的硬件处理芯片已成为了一种大趋势。此外,为了保证移动终端在运行时,应用程序运行的流畅性,并有效利用移动终端的内存,常需要对移动终端进行内存优化设置。
然而,现有的部分移动终端产品,当运行内存占用过多时,无法实现内存自动清理的功能,影响了产品的实际应用体验。
【发明内容】
基于此,本发明的目的是为了解决现有技术中,部分移动终端产品无法实现内存自动清理的问题。
本发明提出一种内存优化方法,其中,所述方法包括如下步骤:
当接收到一系统开机信号之后,获取每个单元计时周期内处于使用状态的每个应用程序对应的程序运行信息,所述程序运行信息至少包括运行次数、平均运行时长以及平均内存占用值;
根据获取的所述运行次数、所述平均运行时长以及所述平均内存占用值,计算得到每个所述应用程序对应的权重值;
当判断到系统剩余内存低于预设内存时,则根据多个所述权重值,按照预设排序规则清除对应的所述应用程序,以保证所述系统剩余内存不低于所述预设内存。
本发明提出的内存优化方法,将移动终端运行过程划分为多个单元计时周 期,当各应用程序在运行时,系统会自动记录每个应用程序对应的运行次数、平均运行时长以及平均内存占用值,由于上述的运行次数、平均运行时长以及平均内存占用值,直接与内存占用相关,因此基于上述的三个计算元素计算得到应用程序对应的权重值,当系统的剩余内存低于预设内存时,说明内存过载,此时可根据各应用程序的权重值,按照预设排序规则对相应的应用程序进行清理,以使得系统剩余内存大于预设内存,从而保证移动终端的正常运行。本发明提出的内存优化方法,可实现对移动终端设备的运行内存的自动清理,提高了用户使用体验。
所述内存优化方法,其中,所述程序运行信息还包括应用程序名称、应用包名称、单次运行时长以及单次内存占用值,其中所述单次运行时长的确定方法包括如下步骤:
获取所述应用程序在任一所述单元计时周期内的被唤醒时间点以及与所述被唤醒时间点相邻的被释放时间点,其中所述被唤醒时间点为所述应用程序被激活时对应的时间,所述被释放时间点为所述应用程序被关闭时对应的时间;
根据所述被唤醒时间点以及所述被释放时间点,计算得到所述单次运行时长。
所述内存优化方法,其中,所述平均运行时长的计算方法包括如下步骤:
将其中一所述单元计时周期内的多个所述单次运行时长进行累加,以得到一单元总运行时长;
将所述单元总运行时长除以所述单元计时周期内的所述运行次数以得到所述平均运行时长。
所述内存优化方法,其中,所述平均内存占用值的计算方法包括如下步骤:
将其中一所述单元计时周期内的多个所述单次内存占用值进行累加,以得到一单元内存占用总值;
将所述单元内存占用总值除以所述单元计时周期内的所述运行次数以得到所述平均内存占用值。
所述内存优化方法,其中,所述计算得到每个所述应用程序对应的权重值的方法包括如下步骤:
将每个所述单元计时周期内对应的单元权重值进行累加以得到所述权重值,其中所述单元权重值为在每个所述单元计时周期内运行的单个应用程序的内存贡献比重。
所述内存优化方法,其中,所述单元权重值的计算方法包括如下步骤:
当监测到每个所述单元计时周期结束时,将当前单元计时周期与相邻的上一个单元计时周期内的所述运行次数、所述平均运行时长以及所述平均内存占用值分别进行作差,以分别得到运行次数差值、平均运行时长差值以及平均内存占用差值;
根据所述运行次数差值、所述平均运行时长差值以及所述平均内存占用差值计算以得到所述单元权重值。
所述内存优化方法,其中,所述按照预设排序规则清除对应的所述应用程序的方法包括如下步骤:
将每个所述应用程序对应的所述权重值,按照所述权重值由小到大的方式进行排列以得到一应用程序列表;
在所述应用程序列表中,按照所述权重值由小到大的方式消除对应的所述应用程序。
所述内存优化方法,其中,所述方法还包括:
将不具有被自动清理权限的所述应用程序排除在所述应用程序列表外。
本发明提出一种内存优化装置,其中,所述装置包括:
运行监测模块,用于当接收到一系统开机信号之后,获取每个单元计时周期内处于使用状态的每个应用程序对应的程序运行信息,所述程序运行信息至少包括运行次数、平均运行时长以及平均内存占用值;
权重计算模块,用于根据获取的所述运行次数、所述平均运行时长以及所述平均内存占用值,计算得到每个所述应用程序对应的权重值;
内存优化模块,用于当判断到系统剩余内存低于预设内存时,则根据多个所述权重值,按照预设排序规则清除对应的所述应用程序,以保证所述系统剩余内存不低于所述预设内存。
本发明还提出一种可读存储介质,其上存储有计算机程序,其中,所述计算机程序被处理器执行时实现如上所述的内存优化方法。
所述可读存储介质,其中,所述计算机程序被处理器执行时实现的所述内存优化方法还包括:
将不具有被自动清理权限的所述应用程序排除在被清除的所述应用程序的范围外。
所述可读存储介质,其中,所述计算机程序排除在被清除的所述应用程序 的范围外。
本发明还提出一种移动终端,包括存储器、处理器以及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现如上所述的内存优化方法。
所述移动终端,其中,所述处理器执行所述计算机程序时实现的所述内存优化方法还包括:
将不具有被自动清理权限的所述应用程序排除在被清除的所述应用程序的范围外。
所述移动终端,其中,所述计算机程序排除在被清除的所述应用程序的范围外。
本公开的其他特征和优点将在随后的说明书中阐述,或者,部分特征和优点可以从说明书推知或毫无疑义地确定,或者通过实施本公开的上述技术即可得知。
为使本发明的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。
【附图说明】
为了更清楚地说明本发明具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明第一实施例提出的内存优化方法的流程图;
图2为本发明第二实施例提出的内存优化方法的流程图;
图3为本发明第三实施例提出的内存优化装置的结构示意图。
【具体实施方式】
为了便于理解本发明,下面将参照相关附图对本发明进行更全面的描述。附图中给出了本发明的首选实施例。但是,本发明可以以许多不同的形式来实现,并不限于本文所描述的实施例。相反地,提供这些实施例的目的是使对本发明的公开内容更加透彻全面。
除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技术 领域的技术人员通常理解的含义相同。本文中在本发明的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本发明。本文所使用的术语“及/或”包括一个或多个相关的所列项目的任意的和所有的组合。
现有的部分移动终端产品,当运行内存占用过多时,无法实现内存自动清理的功能,影响了产品的实际应用体验。
为了解决这一技术问题,本发明提出一种内存优化方法,其中,该方法包括如下步骤:
S101,当接收到一系统开机信号之后,获取每个单元计时周期内处于使用状态的每个应用程序对应的程序运行信息,所述程序运行信息至少包括运行次数、平均运行时长以及平均内存占用值。
本实施例以手机为例进行举例说明,当手机开机运行后,手机系统立即对处于运行状态的应用程序进行监测。在本实施例中,监测过程是分为多个单元计时周期进行的。以应用程序X为例进行举例说明,所监测到的应用程序X,在单元计时周期T 0内的程序运行信息包括:应用名称AppName、应用包名Package Nname、周期T 0内的平均运行时长T 0L、周期T 0内的平均内存占用值M 0以及应用程序X的运行次数N 0。在此需要补充说明的是,在每个单元计时周期内,可能存在多个应用程序同时运行的情况,手机系统也同样监测其它处于运行状态的应用程序的程序运行信息。
S102,根据获取的所述运行次数、所述平均运行时长以及所述平均内存占用值,计算得到每个所述应用程序对应的权重值。
在监测获取了应用程序X在单元计时周期T 0内的运行次数N 0、平均运行时长T 0L以及平均内存占用值M 0之后,如果手机继续运行,则手机系统会继续监测下一个单元计时周期T 1内,该应用程序X的相关程序运行信息。
例如,在单元计时周期T 1内,所监测到的应用程序X的程序运行信息为:运行次数N 1,平均运行时长T 1L以及平均内存占用值M 1。若手机系统继续运行,则在单元计时周期T 2内,所监测到的应用程序X的程序运行信息为:运行次数N 2,平均运行时长T 2L以及平均内存占用值M 2。同理,可以类推至第N个单元计时周期T N,所监测到的应用程序X的程序运行信息为:运行次数N N,平均运行时长T NL以及平均内存占用值M N
在监测到应用程序X的程序运行信息之后,根据所监测的上述信息计算得到每个应用程序对应的权重值。具体的,在单元计时周期T 1计时结束时,应用 程序X的运行次数变化、平均运行时长变化以及平均内存占用值变化分别为:
运行次数变化NC 1=N 1-N 0
平均运行时长变化TLC 1=T 1L-T 0L
平均内存占用值变化MC 1=M 1-M 0
因此在单元计时周期T1计时结束时,应用程序X对应的单元权重值为:
WX 1=NC 1*X+TCL 1*Y+MC 1*Z
其中,上述的X、Y与Z均为系数。
在此需要说明的是,对于后续的多个单元计时周期,可采用上述的方法计算得到应用程序X的在后续多个单元计时周期内的单元权重值WX 2、WX 3......WX N。最终将所计算得到的多个单元计时周期进行累加便得到该应用程序X的总权重值。在此需要指出的是,采用上述同样的方法可计算得到其它应用程序的总权重值。
S103,当判断到系统剩余内存低于预设内存时,则根据多个所述权重值,按照预设排序规则清除对应的所述应用程序,以保证所述系统剩余内存不低于所述预设内存。
当手机进行运行时,若手机系统判断到系统剩余内存低于预设内存,则此时需要对手机系统内存进行清理,以保证手机运行的流畅性。如上所述,由于已经计算得到了各应用程序在运行时对应的内存占用的总权重值,因此可按照预设排序规则对应用程序进行清理。在本实施例中,按照各应用程序的总权重值依次减小的方式对各应用程序进行清理,直至系统剩余内存不低于预设内存,也即能保证手机系统的正常运行。
本发明提出的内存优化方法,将移动终端运行过程划分为多个单元计时周期,当各应用程序在运行时,系统会自动记录每个应用程序对应的运行次数、平均运行时长以及平均内存占用值,由于上述的运行次数、平均运行时长以及平均内存占用值,直接与内存占用相关,因此基于上述的三个计算元素计算得到应用程序对应的权重值,当系统的剩余内存低于预设内存时,说明内存过载,此时可根据各应用程序的权重值,按照预设排序规则对相应的应用程序进行清理,以使得系统剩余内存大于预设内存,从而保证移动终端的正常运行。本发明提出的内存优化方法,可实现对移动终端设备的运行内存的自动清理,提高了用户使用体验。
下面以一个具体的实例对本发明的技术方案进行更加详细地阐述。请参阅 图2,对于本发明第二实施例提出的内存优化方法,其具体实施方式如下所述:
S201,接收到系统开机信号。
本实施例以一便携平板为例进行说明。用户在按下开机键开机后,智能平板便开始运行各种应用程序。
S202,监测程序运行信息,包括运行次数、单次运行时长以及单次内存占用值。
当智能平板运行时,平板系统会监测运行的应用程序的运行信息。其中,监测过程是分为多个单元计时周期进行的。
(1)在单元计时周期T 0内,系统监测到的应用程序X的程序运行信息包括:
应用名称:AppName
应用包名:PackageNname
应用程序X被唤醒的各时间点:T 0S 0、T 0S 1、T 0S 2、T 0S 3......T 0S N
应用程序X被释放的各时间点:T 0E 0、T 0E 1、T 0E 2、T 0E 3......T 0E N
应用程序X单次运行时长:T 0L 0、T 0L 1、T 0L 2、T 0L 3......T 0L N
应用程序X的运行次数:N 0
应用程序X单次运行时的内存占用值:M 00、M 01、M 02、M 03......M 0N
在单元计时周期T 0内,上述应用程序X的程序运行信息均被记录到文件A中。
在上述的第一个单元计时周期T 0结束后,即开始第二个单元计时周期T 1。平板系统同样会将应用程序X的如下信息记录到文件A内:
(2)在单元计时周期T 1内,系统监测到的应用程序X的程序运行信息包括:
应用名称:AppName
应用包名:PackageNname
应用程序X被唤醒的各时间点:T 1S 0、T 1S 1、T 1S 2、T 1S 3......T 1S N
应用程序X被释放的各时间点:T 1E 0、T 1E 1、T 1E 2、T 1E 3......T 1E N
应用程序X单次运行时长:T 1L 0、T 1L 1、T 1L 2、T 1L 3......T 1L N
应用程序X的运行次数:N 1
应用程序X单次运行时的内存占用值:M 10、M 11、M 12、M 13......M 1N
在上述的第二个单元计时周期T 1结束后,即开始第三个单元计时周期T 2。 平板系统同样会将应用程序X的如下信息记录到文件A内:
(3)在单元计时周期T 2内,系统监测到的应用程序X的程序运行信息包括:
应用名称:AppName
应用包名:PackageNname
应用程序X被唤醒的各时间点:T 2S 0、T 2S 1、T 2S 2、T 2S 3......T 2S N
应用程序X被释放的各时间点:T 2E 0、T 2E 1、T 2E 2、T 2E 3......T 2E N
应用程序X单次运行时长:T 2L 0、T 2L 1、T 2L 2、T 2L 3......T 2L N
应用程序X的运行次数:N 2
应用程序X单次运行时的内存占用值:M 20、M 21、M 22、M 23......M 2N
(4)在单元计时周期T N内,系统监测到的应用程序X的程序运行信息包括:
应用名称:AppName
应用包名:PackageNname
应用程序X被唤醒的各时间点:T NS 0、T NS 1、T NS 2、T NS 3......T NS N
应用程序X被释放的各时间点:T NE 0、T NE 1、T NE 2、T NE 3......T NE N
应用程序X单次运行时长:T NL 0、T NL 1、T NL 2、T NL 3......T NL N
应用程序X的运行次数:N N
应用程序X单次运行时的内存占用值:M N0、M N1、M N2、M N3......M NN
S203,计算得到平均运行时长以及平均内存占用值。
(1)在单元计时周期T 0内:
应用程序X的平均运行时长:T 0L=(T 0L 0+T 0L 1+T 0L 2+T 0L 3......+T 0L N)/N 0
应用程序X的平均内存占用值:M 0=(M 00+M 01+M 02+M 03...M 0N)/N 0
(2)在单元计时周期T 1内:
应用程序X的平均运行时长:T 1L=(T 1L 0+T 1L 1+T 1L 2+T 1L 3......T 1L N)/N 1
应用程序X的平均内存占用值:M 1=(M 10+M 11+M 12+M 13...M 1N)/N 1
(3)在单元计时周期T 2内:
应用程序X的平均运行时长:T 2L=(T 2L 0+T 2L 1+T 2L 2+T 2L 3......T 2L N)/N 2
应用程序X的平均内存占用值:M 2=(M 20+M 21+M 22+M 23...M 2N)/N 2
(4)在单元计时周期T N内:
应用程序X的平均运行时长:T NL=(T NL 0+T NL 1+T NL 2+T NL 3......T NL N)/N N
应用程序X的平均内存占用值:M N=(M N0+M N1+M N2+M N3...M NN)/N N
S204,计算得到每个应用程序的权重值。
在单元计时周期T 1结束时,将单元计时周期T 1与单元计时周期T 0之间,对应的应用程序X的次数差值,平均运行时长差值,平均内存占用差值记录到文件B中。
具体的,当单元计时周期T 1结束时,应用程序X的相关运行参数差值如下:
次数差值NC 1=N 1-N 0
平均运行时长差值TLC 1=T 1L-T 0L
平均内存占用差值MC 1=M 1-M 0
当单元计时周期T 2结束时,应用程序X的相关运行参数差值如下:
次数差值NC 2=N 2-N 1
平均运行时长差值TLC 2=T 2L-T 1L
平均内存占用差值MC 2=M 2-M 1
当单元计时周期T N结束时,应用程序X的相关运行参数差值如下:
次数差值NC N=N N-N N-1
平均运行时长差值TLC N=T NL-T N-1L
平均内存占用差值MC N=M N-M N-1
在单元计时周期T 1结束时,应用程序X对应的单元权重值为:
WX 1=NC 1*X+TLC 1*Y+MC 1*Z
在单元计时周期T 2结束时,应用程序X对应的单元权重值为:
WX 2=NC 2*X+TLC 2*Y+MC 2*Z
在单元计时周期T 3结束时,应用程序X对应的单元权重值为:
WX 3=NC 3*X+TLC 3*Y+MC 3*Z
在单元计时周期T N结束时,应用程序X对应的单元权重值为:
WX N=NC N*X+TLC N*Y+MC N*Z
其中,上述的X、Y与Z均为系数。
在计算得到了应用程序X在每个单元计时周期内对应的单元权重值之后,将多个单元权重值进行累加得到总权重值,对应的表达式为:
WX=WX 1+WX 2+WX 3......+WX N
在此需要说明的是,可采用如上所述的方法计算得到任一处于运行状态的应用程序的总权重值。
S205,系统剩余内存是否小于预设内存。
在智能平板运行的过程中,若平板系统判断到系统剩余内存小于预设内存,则此时需要对该平板系统进行内存清理,以保证平板系统运行时的流畅性。可以理解的,当系统剩余内存大于预设内存,则此时还无须进行内存清理。
S206,自动清理对应的应用程序。
在进行内存清理时,在本实施例中是按照各应用程序对应的总权重值的大小,按照降序的方式进行排列,依次进行清理的。例如,按照总权重值由大到小的顺序进行排列,依次为:“微信”,对应的总权重值为16%;“支付宝”,对应的总权重值为10%;“高德地图”,对应的总权重值为8%;“手机淘宝”,对应的总权重值为7%;“携程旅行”,对应的总权重值为5%,则按照“微信”、“支付宝”、“高德地图”、“手机淘宝”以及“携程旅行”的顺序进行清理。
在此还需要补充说明的是,平板系统内嵌的内存清理软件本身不被清理,不属于被清理列表内。与此同时,用户也可以根据自身应用需求,手动设置各应用程序的被自动清理权限,对于部分需实时运行的应用程序,则排除在清理列表外。
请参阅图3,对于本发明第三实施例提出的内存优化装置,其包括依次连接的运行监测模块11、权重计算模块12以及内存优化模块13;
其中所述运行监测模块11具体用于:
当接收到一系统开机信号之后,获取每个单元计时周期内处于使用状态的每个应用程序对应的程序运行信息,所述程序运行信息至少包括运行次数、平均运行时长以及平均内存占用值;
所述权重计算模块12具体用于:
根据获取的所述运行次数、所述平均运行时长以及所述平均内存占用值,计算得到每个所述应用程序对应的权重值;
所述内存优化模块13具体用于:
当判断到系统剩余内存低于预设内存时,则根据多个所述权重值,按照预设排序规则清除对应的所述应用程序,以保证所述系统剩余内存不低于所述预设内存。
本发明还提出一种可读存储介质,其上存储有计算机程序,其中,所述程 序被处理器执行时实现如上所述的内存优化方法。
本发明还提出一种移动终端,包括存储器、处理器以及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述程序时实现如上所述的内存优化方法。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成。所述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,包括上述方法所述的步骤。所述的存储介质,包括:ROM/RAM、磁碟、光盘等。
最后应说明的是:以上所述实施例,仅为本发明的具体实施方式,用以说明本发明的技术方案,而非对其限制,本发明的保护范围并不局限于此,尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本发明实施例技术方案的精神和范围,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。

Claims (15)

  1. 一种内存优化方法,其中,所述方法包括如下步骤:
    当接收到一系统开机信号之后,获取每个单元计时周期内处于使用状态的每个应用程序对应的程序运行信息,所述程序运行信息至少包括运行次数、平均运行时长以及平均内存占用值;
    根据获取的所述运行次数、所述平均运行时长以及所述平均内存占用值,计算得到每个所述应用程序对应的权重值;
    当判断到系统剩余内存低于预设内存时,则根据多个所述权重值,按照预设排序规则清除对应的所述应用程序,以保证所述系统剩余内存不低于所述预设内存。
  2. 根据权利要求1所述的内存优化方法,其中,所述程序运行信息还包括应用程序名称、应用包名称、单次运行时长以及单次内存占用值,其中所述单次运行时长的确定方法包括如下步骤:
    获取所述应用程序在任一所述单元计时周期内的被唤醒时间点以及与所述被唤醒时间点相邻的被释放时间点,其中所述被唤醒时间点为所述应用程序被激活时对应的时间,所述被释放时间点为所述应用程序被关闭时对应的时间;
    根据所述被唤醒时间点以及所述被释放时间点,计算得到所述单次运行时长。
  3. 根据权利要求2所述的内存优化方法,其中,所述平均运行时长的计算方法包括如下步骤:
    将其中一所述单元计时周期内的多个所述单次运行时长进行累加,以得到一单元总运行时长;
    将所述单元总运行时长除以所述单元计时周期内的所述运行次数以得到所述平均运行时长。
  4. 根据权利要求2所述的内存优化方法,其中,所述平均内存占用值的计算方法包括如下步骤:
    将其中一所述单元计时周期内的多个所述单次内存占用值进行累加,以得到一单元内存占用总值;
    将所述单元内存占用总值除以所述单元计时周期内的所述运行次数以得到所述平均内存占用值。
  5. 根据权利要求2所述的内存优化方法,其中,所述计算得到每个所述应用程序对应的权重值的方法包括如下步骤:
    将每个所述单元计时周期内对应的单元权重值进行累加以得到所述权重值,其中所述单元权重值为在每个所述单元计时周期内运行的单个应用程序的内存贡献比重。
  6. 根据权利要求5所述的内存优化方法,其中,所述单元权重值的计算方法包括如下步骤:
    当监测到每个所述单元计时周期结束时,将当前单元计时周期与相邻的上一个单元计时周期内的所述运行次数、所述平均运行时长以及所述平均内存占用值分别进行作差,以分别得到运行次数差值、平均运行时长差值以及平均内存占用差值;
    根据所述运行次数差值、所述平均运行时长差值以及所述平均内存占用差值计算以得到所述单元权重值。
  7. 根据权利要求5所述的内存优化方法,其中,所述按照预设排序规则清除对应的所述应用程序的方法包括如下步骤:
    将每个所述应用程序对应的所述权重值,按照所述权重值由大到小的方式进行排列以得到一应用程序列表;
    在所述应用程序列表中,按照所述权重值由大到小的方式消除对应的所述应用程序。
  8. 根据权利要求7所述的内存优化方法,其中,所述方法还包括:
    将不具有被自动清理权限的所述应用程序排除在所述应用程序列表外。
  9. 一种内存优化装置,其中,所述装置包括:
    运行监测模块,用于当接收到一系统开机信号之后,获取每个单元计时周期内处于使用状态的每个应用程序对应的程序运行信息,所述程序运行信息至少包括运行次数、平均运行时长以及平均内存占用值;
    权重计算模块,用于根据获取的所述运行次数、所述平均运行时长以及所述平均内存占用值,计算得到每个所述应用程序对应的权重值;
    内存优化模块,用于当判断到系统剩余内存低于预设内存时,则根据多个所述权重值,按照预设排序规则清除对应的所述应用程序,以保证所述系统剩余内存不低于所述预设内存。
  10. 一种可读存储介质,其上存储有计算机程序,其中,所述计算机程序被 处理器执行时实现上述权利要求1至7任意一项所述的内存优化方法。
  11. 根据权利要求10所述的可读存储介质,其中,所述计算机程序被处理器执行时实现的所述内存优化方法还包括:
    将不具有被自动清理权限的所述应用程序排除在被清除的所述应用程序的范围外。
  12. 根据权利要求10所述的可读存储介质,其中,所述计算机程序排除在被清除的所述应用程序的范围外。
  13. 一种移动终端,包括存储器、处理器以及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现如权利要求1至7任意一项所述的内存优化方法。
  14. 根据权利要求13所述的移动终端,其中,所述处理器执行所述计算机程序时实现的所述内存优化方法还包括:
    将不具有被自动清理权限的所述应用程序排除在被清除的所述应用程序的范围外。
  15. 根据权利要求13所述的移动终端,其中,所述计算机程序排除在被清除的所述应用程序的范围外。
PCT/CN2019/087751 2018-06-13 2019-05-21 一种内存优化方法、装置、可读存储介质及移动终端 WO2019237891A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810610159.3A CN108804231B (zh) 2018-06-13 2018-06-13 一种内存优化方法、装置、可读存储介质及移动终端
CN201810610159.3 2018-06-13

Publications (1)

Publication Number Publication Date
WO2019237891A1 true WO2019237891A1 (zh) 2019-12-19

Family

ID=64085928

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/087751 WO2019237891A1 (zh) 2018-06-13 2019-05-21 一种内存优化方法、装置、可读存储介质及移动终端

Country Status (2)

Country Link
CN (1) CN108804231B (zh)
WO (1) WO2019237891A1 (zh)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108804231B (zh) * 2018-06-13 2020-10-30 奇酷互联网络科技(深圳)有限公司 一种内存优化方法、装置、可读存储介质及移动终端
CN109753316A (zh) * 2018-11-22 2019-05-14 惠州Tcl移动通信有限公司 智能终端及其控制方法、具有存储功能的装置
CN110321224B (zh) * 2019-07-04 2022-05-24 深圳市康冠科技股份有限公司 终端内存清理方法、装置及计算机可读存储介质
CN110737523A (zh) * 2019-10-18 2020-01-31 湖南快乐阳光互动娱乐传媒有限公司 一种通过内存清理提升应用启动速度的方法及终端
CN111078407B (zh) * 2019-12-10 2022-11-01 Oppo(重庆)智能科技有限公司 内存管理的方法、装置、存储介质及电子设备
CN111104180B (zh) * 2019-12-11 2021-08-03 惠州Tcl移动通信有限公司 应用程序优化方法、装置、存储介质及电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103324575A (zh) * 2012-03-23 2013-09-25 腾讯科技(深圳)有限公司 清理内存的方法和移动终端
CN103927230A (zh) * 2014-03-25 2014-07-16 优视科技有限公司 一种内存使用状况的反馈方法及装置
CN105354093A (zh) * 2015-12-09 2016-02-24 广东欧珀移动通信有限公司 内存管理方法及移动终端
CN108804231A (zh) * 2018-06-13 2018-11-13 奇酷互联网络科技(深圳)有限公司 一种内存优化方法、装置、可读存储介质及移动终端

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103324575A (zh) * 2012-03-23 2013-09-25 腾讯科技(深圳)有限公司 清理内存的方法和移动终端
CN103927230A (zh) * 2014-03-25 2014-07-16 优视科技有限公司 一种内存使用状况的反馈方法及装置
CN105354093A (zh) * 2015-12-09 2016-02-24 广东欧珀移动通信有限公司 内存管理方法及移动终端
CN108804231A (zh) * 2018-06-13 2018-11-13 奇酷互联网络科技(深圳)有限公司 一种内存优化方法、装置、可读存储介质及移动终端

Also Published As

Publication number Publication date
CN108804231B (zh) 2020-10-30
CN108804231A (zh) 2018-11-13

Similar Documents

Publication Publication Date Title
WO2019237891A1 (zh) 一种内存优化方法、装置、可读存储介质及移动终端
CN109783224B (zh) 基于负载调配的任务分配方法、装置及终端设备
CN109740732B (zh) 神经网络处理器、卷积神经网络数据复用方法及相关设备
CN107770088B (zh) 一种流量控制方法及装置
WO2017167120A1 (zh) 一种管理应用程序的方法及装置
CN109271252B (zh) 一种调整线程数的方法及装置
CN102597912B (zh) 用于平台功率节省的协调设备和应用程序中断事件
CN104516475A (zh) 用于管理多核片上系统上的全局芯片功率的方法和装置
CN109324902B (zh) 一种调整移动终端工作频率的方法、移动终端及存储介质
KR20140002027A (ko) 휴대용 컴퓨팅 디바이스의 멀티코어 프로세서에서 다수의 코어들로의 전력을 동적으로 제어하는 방법 및 시스템
CN107402808B (zh) 进程管理方法、装置、存储介质及电子设备
CN105786552B (zh) 一种内存清理方法和电子设备
CN104580721A (zh) 一种终端闹钟实现方法
CN110737606B (zh) 内存回收处理方法、装置、电子设备以及存储介质
CN105022668B (zh) 一种作业调度方法及系统
CN105389082A (zh) 应用于移动终端的提醒方法和提醒装置
CN104536739A (zh) 一种唤醒终端系统的方法
CN105281965B (zh) 基于ios系统的流量获取方法和装置
CN109840141A (zh) 基于云监控的线程控制方法、装置、电子设备及存储介质
CN107291540A (zh) 后台应用程序的处理方法、装置及移动终端
CN114416320A (zh) 一种任务处理方法、装置、设备以及存储介质
CN112764959B (zh) 应用程序卡死问题的监测方法、装置、设备及存储介质
CN106503543A (zh) 一种管理应用程序的方法和装置
KR101890046B1 (ko) 전력 소비 감소를 위한 동시적 네트워크 애플리케이션 스케줄링
CN113064677A (zh) 应用运行方法及装置、存储介质及电子装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19819742

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19819742

Country of ref document: EP

Kind code of ref document: A1