CN108228341B - Memory recovery method and device, terminal equipment and computer readable storage medium - Google Patents

Memory recovery method and device, terminal equipment and computer readable storage medium Download PDF

Info

Publication number
CN108228341B
CN108228341B CN201710668172.XA CN201710668172A CN108228341B CN 108228341 B CN108228341 B CN 108228341B CN 201710668172 A CN201710668172 A CN 201710668172A CN 108228341 B CN108228341 B CN 108228341B
Authority
CN
China
Prior art keywords
target
application program
memory
physical page
value
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.)
Active
Application number
CN201710668172.XA
Other languages
Chinese (zh)
Other versions
CN108228341A (en
Inventor
陈乾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Meizu Technology Co Ltd
Original Assignee
Meizu Technology Co Ltd
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 Meizu Technology Co Ltd filed Critical Meizu Technology Co Ltd
Priority to CN201710668172.XA priority Critical patent/CN108228341B/en
Publication of CN108228341A publication Critical patent/CN108228341A/en
Application granted granted Critical
Publication of CN108228341B publication Critical patent/CN108228341B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Abstract

The invention provides a memory recovery method and device, terminal equipment and a computer readable storage medium, wherein the method comprises the steps of obtaining a running target application program, and judging whether the target application program is a memory recovery protection application program; if so, executing the memory recovery operation of no more than a first preset number of times on the target application program within a preset time length; otherwise, executing the memory recovery operation not less than a second preset number of times or closing the target application program within the preset time length, wherein the first preset number of times is less than or equal to the second preset number of times. The device is used for realizing the memory recovery method. The terminal equipment provided by the invention is provided with a processor and a memory, and the memory recovery method can be realized when the processor executes a computer program. The computer-readable storage medium of the present invention has stored thereon a computer program for implementing the above-described method. The invention can adopt different memory recovery methods aiming at different types of application programs.

Description

Memory recovery method and device, terminal equipment and computer readable storage medium
Technical Field
The present invention relates to the field of control of electronic devices, and in particular, to a method for implementing memory recovery on a terminal device and an apparatus for implementing the method, and also relates to a terminal device and a computer-readable storage medium for implementing the method.
Background
Terminal devices such as smart phones and tablet computers become electronic devices which are most frequently used in daily life of people, people like to install various application programs on the smart electronic devices, and a large number of application programs are simultaneously operated on the terminal devices. In an operating system of a terminal device, a large amount of data is usually cached in a memory in order to increase the speed of performing read/write operations on a disk. Before using the memory, the process needs to apply for and start to occupy the memory, and the memory is timely recycled after the memory is used. Because a user frequently changes applications during the process of using a terminal application, in order to reduce the waiting time of the user, the operating system usually reserves the memory occupied by the application process for transferring to the background. However, when the background applications are excessive and the memory is occupied in a large amount and cannot be recycled, the operating system may be abnormally operated due to insufficient memory allocation.
In order to avoid system exception caused by insufficient memory allocation, the operating system introduces a recovery mechanism for the memory. For example, when the memory is insufficient, the system may close some background processes to reclaim the memory occupied by the background processes. However, when the user needs to use the application programs corresponding to the processes, the processes need to be completely reloaded, which takes a long time and reduces user experience. Therefore, the prior art proposes a method for performing memory reclamation without closing the process. The LRU list is used least recently, the physical pages are arranged according to the recent use condition, and when the memory is insufficient, the system preferentially recycles the physical pages in the INACTIVE _ ANON list and the INACTIVE _ FILE list. ANON stands for anonymous mapping, no backing store, FILE stands for FILE mapping, and INACTIVE stands for INACTIVE state. When the process needs to use the content on the recycled physical page, the corresponding content is loaded from the disk, so that the time consumption is reduced. However, physical pages occupied by an application process running in the foreground or an application process running in the background and having a high priority may also be in the INACTIVE _ ANON and INACTIVE _ FILE linked lists, and recycling the physical pages in the two linked lists may affect normal running of the two types of applications, thereby reducing user experience.
In order to ensure normal operation of foreground application process and background application process with high priority, the prior art proposes a method for recovering memory of a process. However, in the existing method for recovering the memory of the process, the recovered target physical page only aims at the target physical page which is not used by the target process, and the target physical page is mainly a physical page of the target process in two linked lists, namely INACTIVE _ ANON and INACTIVE _ FILE, that is, a physical page in an INACTIVE state.
In addition, if memory recovery operation is performed on the process of the application program frequently used by the user, the application program is frequently loaded and reloaded, so that the application program runs slowly, and user experience is affected.
Disclosure of Invention
The first objective of the present invention is to provide a memory recovery method for distinguishing different types of application programs and adopting different memory recovery modes.
A second object of the present invention is to provide a memory recovery apparatus that avoids performing a memory recovery operation on frequently used applications.
The third objective of the present invention is to provide a terminal device capable of implementing the memory recovery method.
A fourth object of the present invention is to provide a computer-readable storage medium capable of implementing the memory reclamation method when being read and executed by a processor.
In order to achieve the first object, the memory recovery method provided by the present invention is applied to a terminal device, and the method includes acquiring a running target application program, and determining whether the target application program is a memory recovery protection application program; if the target application program is determined to be the memory recovery protection application program, performing memory recovery operation on the target application program for no more than a first preset number of times within a preset time length; if the target application program is determined not to be the memory recovery protection application program, performing memory recovery operation not less than a second preset number of times on the target application program within a preset time length or closing the target application program; the first preset times is less than or equal to the second preset times.
According to the scheme, different recovery modes are adopted for different application programs, for example, a mode with less recovery times is adopted for the memory recovery protection application program, and for the application program which is not the memory recovery protection application program, such as the application program with lower use frequency, the operation of memory recovery for multiple times can be adopted to release more modes to release more memories.
Preferably, the determining that the target application is the memory reclamation protection application includes: acquiring the operating frequency of a target application program, and determining that the operating frequency of the target application program is higher than a preset operating frequency; or, determining that the target application program is an application program in a preset memory recovery protection list; or, determining that the target application program is the preset type of application program.
Therefore, the memory recovery is performed by using a mode with a small recovery frequency for the application programs with high running frequency, the application programs in the preset memory recovery protection list and the application programs of the preset types, so that the application programs are prevented from being frequently executed memory recovery operation to influence the running speed of the application programs.
The method comprises the steps of obtaining a memory value occupied by a target application program after the target application program is determined not to be a memory recovery protection application program, judging whether the memory value occupied by the target application program is larger than a preset memory value or not, if so, executing memory recovery operation on the target application program for not less than a second preset number of times within a preset time length, and if not, closing the target application program.
Therefore, for the application program occupying less memory value, the operation of executing memory recovery on the application program is not adopted, but the application program is directly closed, so that more memories are recovered.
Preferably, the second preset number is more than two times; executing the memory recovery operation not less than a second preset number of times on the target application program within the preset time span comprises the following steps: after the memory recovery operation is executed once, the next memory recovery operation is executed after a first interval time.
Preferably, the executing, within the preset time duration, the memory reclamation operation on the target application program for no more than a first preset number of times includes: executing more than two times of memory recovery operation on the target application program within a preset time length, and executing the next memory recovery operation after a second interval time after executing the memory recovery operation for one time; the second interval time is greater than the first interval time.
Therefore, for the application program with the memory recovery protection function, the time interval for executing the memory recovery operation for multiple times within the preset time length is larger than the time interval for executing the memory recovery operation for two times by the application program with the non-memory recovery protection function, so that the times for recovering and storing the memory of the application program by the memory are reduced.
Further, the executing the memory recovery operation on the target application program includes: acquiring a target process in which a target application program is running, and acquiring a target physical page corresponding to the target process; reading the value of the activity of the target physical page, wherein the activity of the target physical page is used for marking the activity degree of the target physical page, and the value of the activity degree of the target physical page is positively correlated with the activity degree of the target physical page; if the value of the activity degree of the target physical page is higher than the recovery standard and the physical page with the activity degree value higher than the recovery standard is in an active state, reducing the activity degree of the target physical page; reading the value of the activity of the target physical page again; and if the value of the activity of the target physical page is not higher than the recovery standard, recovering the target physical page.
According to the scheme, after the target physical page corresponding to the target process is obtained, if the value of the activity degree of the target physical page is higher than the recovery standard, the activity degree of the target physical page can be reduced, and the target physical page is recovered when the activity degree of the target physical page is not higher than the recovery standard. Therefore, even if the target physical page is the physical page in the active state, the target physical page can be recovered by the method, and compared with the prior art, the method greatly expands the objects of memory recovery and improves the memory recovery efficiency.
Further, after reducing the activity of the target physical page, before reading the value of the activity of the target physical page, starting a timer; and triggering the step of reading the value of the activity degree of the target physical page when the time length recorded by the timer reaches the preset time length.
Further, before the timer is started, a preset time length is set according to the memory occupancy rate, and the preset time length is negatively related to the memory occupancy rate; or, setting a preset time length according to the priority of the target process, wherein the preset time length is positively correlated with the priority of the target process.
Further, the selectable values of the activity level include at least a first value, a second value, and a third value, the first value being no higher than the reclamation criterion, the second value being lower than the third value and higher than the reclamation criterion.
Further, reducing the liveness of the target physical page comprises: when the activity of the target physical page is a third value, setting the activity of the target physical page to be a second value; and when the activity of the target physical page is the second value, setting the activity of the target physical page to be the first value.
Further, reducing the liveness of the target physical page comprises: when the target physical page is an anonymous page, reducing the activity of the target physical page according to a first amplitude; when the target physical page is a file page, reducing the activity of the target physical page according to a second amplitude; the first amplitude is lower than the second amplitude.
In order to achieve the second object, the memory recovery apparatus provided by the present invention is applied to a terminal device, and the apparatus includes an obtaining module, configured to obtain a running target application; the judging module is used for judging whether the target application program is a memory recovery protection application program or not; the memory recovery module is used for executing memory recovery operation not more than a first preset number of times on the target application program within a preset time length when the target application program is determined to be a memory recovery protection application program; when the target application program is determined not to be the memory recovery protection application program, performing memory recovery operation on the target application program for not less than a second preset number of times within a preset time length or closing the target application program; wherein the first preset times is less than the second preset times.
Preferably, the judging module is specifically configured to: acquiring the running frequency of a target application program, and judging whether the running frequency of the target application program is higher than a preset running frequency; or, judging whether the target application program is an application program in a preset memory recovery protection list or not; or judging whether the target application program is the preset type application program.
Further, the memory recycling module includes: the acquisition module is used for acquiring a target physical page corresponding to a target process; the first reading module is used for reading the value of the activity of the target physical page, the activity of the target physical page is used for marking the activity degree of the target physical page, and the value of the activity degree of the target physical page is positively correlated with the activity degree of the target physical page; the reducing module is used for reducing the activity of the target physical page when the value of the activity of the target physical page is higher than the recycling standard, and the physical page with the activity value higher than the recycling standard is in an active state; the second reading module is used for reading the value of the activity of the target physical page again after the activity of the target physical page is reduced by the reducing module; and the recovery module is used for recovering the target physical page when the value of the activity of the target physical page is not higher than the recovery standard.
Further, the memory recovery module further comprises a first setting module, which is used for setting a preset time length according to the memory occupancy rate before the timing module starts the timer, wherein the preset time length is negatively related to the memory occupancy rate; or the second setting module is configured to set a preset duration according to the priority of the target process before the timer module starts the timer, where the preset duration is positively correlated with the priority of the target process.
Further, the selectable values of the activity level include at least a first value, a second value, and a third value, the first value being no higher than the reclamation criterion, the second value being lower than the third value and higher than the reclamation criterion.
Further, the lowering module includes: the setting unit is used for setting the activity of the target physical page to be a second value when the activity of the target physical page is a third value; and when the activity of the target physical page is the second value, setting the activity of the target physical page to be the first value.
Further, the lowering module includes: the reducing unit is used for reducing the activity of the target physical page according to a first amplitude when the target physical page is an anonymous page; when the target physical page is a file page, reducing the activity of the target physical page according to a second amplitude; the first amplitude is lower than the second amplitude.
In order to achieve the third object, the terminal device provided by the present invention includes a processor, and the processor is configured to implement the steps of the memory reclamation method when executing the computer program stored in the memory.
To achieve the fourth objective, the present invention provides a computer-readable storage medium having a computer program stored thereon, where the computer program is executed by a processor to implement the steps of the memory recovery method.
Drawings
Fig. 1 is a flowchart of a memory reclamation method according to an embodiment of the present invention.
Fig. 2 is a flowchart illustrating a memory reclamation operation performed on a non-memory reclamation protection application according to an embodiment of the memory reclamation method.
Fig. 3 is a flowchart illustrating a memory reclamation operation performed on a memory reclamation protection target application according to an embodiment of the memory reclamation method.
Fig. 4 is a flowchart of a first method for memory reclamation of a target process of a target application according to an embodiment of the memory reclamation method of the present invention.
Fig. 5 is a flowchart of a second method for memory reclamation of a target process of a target application according to an embodiment of the memory reclamation method of the present invention.
Fig. 6 is a flowchart of a third method for memory reclamation of a target process of a target application according to an embodiment of the memory reclamation method of the present invention.
Fig. 7 is a flowchart of a fourth manner of memory reclamation for a target process of a target application according to the embodiment of the memory reclamation method in the present invention.
Fig. 8 is a block diagram of a configuration of an embodiment of a terminal device control apparatus of the present invention.
Fig. 9 is a block diagram of a memory reclamation module according to an embodiment of the terminal device control apparatus of the present invention.
Fig. 10 is a block diagram of another configuration of the memory recovery module according to the embodiment of the terminal device control apparatus of the present invention.
Fig. 11 is a block diagram of a terminal device according to an embodiment of the present invention.
The invention is further explained with reference to the drawings and the embodiments.
Detailed Description
The memory recovery method is applied to terminal equipment such as a smart phone or a tablet personal computer and the like and is used for recovering the memory occupied by the application program. The memory recovery device provided by the invention runs on the terminal equipment and is used for realizing the memory recovery method.
Because a user often changes a used application program during the process of using the application program, for example, when watching a video using video playing software, the chat application may need to be frequently switched to the foreground, and in order to reduce the waiting time of the user, the operating system usually reserves the memory occupied by the application process that is transferred to the background. However, when the number of applications running in the background is too large, and the memory of the terminal device is largely occupied and cannot be released, the operating system may run abnormally due to insufficient memory allocation.
The terminal device may perform memory recovery by closing the application program, or may perform memory recovery by performing memory recovery on the process of the application program without closing the application program. However, some application programs are frequently used by the user, and if memory recovery operations are frequently performed on the application programs, the user needs to reload the process when running the application program in the foreground again, so that the running of the application program is slow, and the user experience is affected. Therefore, different types of applications need to be subject to different memory recycling methods.
The differentiated memory recovery method for different types of application programs provided by the invention is shown in fig. 1, and comprises the following steps:
in step S101, an application program that is running is acquired.
When the current available memory amount of the terminal device is low or the terminal device runs slowly, the operating system may actively send an instruction of the memory recovery operation, that is, the memory recovery is performed for one or more application programs, and at this time, a target application program that is running needs to be acquired. For example, list information of the running applications is acquired by the task manager, and the running applications are acquired from the list information. The application program acquired in step S101 may be a foreground-running application program or an application program that runs in the background.
Step S102, determining whether the target application is a memory recycling protection application, if so, proceeding to step S103, otherwise, proceeding to step S104.
After the target application program is obtained, the type of the target application program is judged, that is, whether the target application program is a memory recovery protection application program is judged. In this embodiment, the memory recovery protection application is an application that needs to perform a smaller number of times of memory recovery operations or does not perform the memory recovery operations, and specifically, the memory recovery protection application may be an application that is preferred by a user, an application in a preset white list, or an application of a preset type.
One case of the memory reclamation protection application is an application with a high user preference, for example, the user preference for an application may be determined by the mnemonid onemini application, and if the user preference is higher than a preset threshold, it indicates that the user prefers the application very much, and the application is a memory reclamation protection application.
One way to determine the user's preference is to calculate the running frequency of the target application, in this embodiment, the running frequency of the target application is the running frequency of the target application in a unit time, and the running frequency is higher when the running frequency of the target application in the unit time is higher, and conversely, the running frequency is lower when the running frequency of the target application in the unit time is lower. Specifically, the running times may be times of the target application program running in the foreground, that is, times of the target application program running in the foreground once when the target application program is shifted from the background to the foreground.
Of course, the operation frequency may also be the number of times that the target application executes the received user operation instruction in the unit time, for example, the number of times that the target application executes the received user operation instruction in the unit time, the number of times that the voice control instruction is received, and the like, where the greater the number of times of the user operation instruction received in the unit time, the higher the operation frequency of the target application is, and conversely, the fewer the number of times of the user operation instruction received in the unit time, the lower the operation frequency of the target application is.
A third way to determine the running frequency of the target application is to calculate the running time length of the target application foreground in unit time, wherein the longer the running time length of the target application foreground in unit time is, the higher the running frequency of the target application is, and conversely, the shorter the running time length of the target application foreground in unit time is, the lower the running frequency of the target application is.
When the running frequency of the target application program is higher than the preset running frequency, the target application program is determined to be a memory recovery protection application program, and if the running frequency of the target application program is lower than the preset running frequency, the target application program is determined not to be the memory recovery protection application program.
In addition, the memory reclamation protection application may also be an application in a preset memory reclamation protection list, for example, a white list is preset, where the white list is a list of the memory reclamation protection application, and if the target application is an application in the memory reclamation protection application list, it is determined that the target application is a memory reclamation protection application.
In addition, the memory recycling protection application program can also be a preset type of application program, for example, a game type application program. Because the memory of the application program of the game class cannot be effectively released during the memory recovery operation, the memory recovery operation can be performed on the application program of the game class as little as possible, that is, the application program of the game class is determined as the application program of the preset type. Of course, the preset type of application program may also include an instant messaging application program, a web browsing application program, and the like.
In step S102, if it is determined that the operating frequency of the target application is higher than the preset operating frequency, or it is determined that the target application is an application in a preset memory recovery protection list, or it is determined that the target application is an application of a preset type, it may be determined that the target application is a memory recovery protection application.
Step S103, performing a memory reclamation operation on the target application within a preset time period, where the memory reclamation operation is not more than a first preset number of times.
If the target application program is determined to be the memory reclamation protection application program, the memory reclamation operation is performed for a large number of times, so that the number of times of performing the memory reclamation operation on the target application program needs to be limited. For example, if the preset time duration is three minutes and the first preset number of times is one, the memory reclamation operation can be executed at most once within three minutes for the application program with the memory reclamation protection, or even the memory reclamation operation is not executed. It is understood that, in the limit case, the first preset number is zero, that is, the memory reclamation operation is not performed on the memory reclamation protection application.
Or, if it is determined that the target application is the memory reclamation protection application, the priority of the target application for performing the memory reclamation operation is reduced, so that when the memory reclamation operation is performed on the application, the memory reclamation operation is performed on the memory reclamation protection application as little as possible, and more memory reclamation operations are performed on the application which is not protected by the memory reclamation.
Of course, the preset time length and the first preset number may be adjusted according to actual needs, for example, the system defaults that the preset time length is five minutes and the first preset number is two times, and the user may modify the preset time length and the first preset number according to actual needs, for example, modify the preset time length to eight minutes and the first preset number to three times. In addition, the system may also determine the first preset times according to actual situations of different application programs, and it can be understood that each application program corresponds to one first preset time, and the first preset times corresponding to different application programs may be different.
Step S104, determining whether the memory value occupied by the target application program is greater than a preset memory value, if so, turning to step S105, otherwise, turning to step S105.
In step S102, if it is determined that the target application is not the memory reclamation protection application, it indicates that a greater number of memory reclamation operations may be performed on the target application, or the target application is directly closed. Of course, the standard for closing the target application program needs to be determined, and therefore, in this embodiment, whether to perform the memory reclamation operation on the target application program or to close the application program is determined by the memory value occupied by the target application program.
Therefore, in step S104, the memory value occupied by the target application program is calculated. Specifically, the process in which the target application is running is obtained, for example, a process list of the target application is obtained, and all processes in which the application is currently running are obtained from the process list. Then, the memory information occupied by each process can be obtained through the getProcessMemoryInfo of the Activity Manager of the operating system. Because the process identification number PID of each process is already acquired when the process list is acquired, the memory information occupied by each process can be acquired according to the process identification number PID of the process. The memory occupied by each process of the target application program is added, so that the memory value occupied by the target application program can be obtained.
The operating system defaults to a predetermined memory value, such as 100M. Of course, the user may also adjust the preset memory value as needed, for example, to 150M or 200M.
Step S105, performing a memory reclamation operation not less than a second preset number of times on the target application within a preset time duration.
In step S104, if it is determined that the memory value occupied by the target application is greater than the preset memory value, which indicates that the target application occupies a large amount of memory resources, the memory resources occupied by the target application may be released in a manner of performing a memory release operation for multiple times. Specifically, the memory recovery operation is executed for a plurality of times within a preset time period. The preset time length of step S105 is the same as the preset time length of step S103, such as three minutes or five minutes.
And the number of memory recovery operations executed within the preset time length is not less than a second preset number, such as two or three. In this embodiment, the second predetermined number is a value greater than or equal to the first predetermined number, for example, if the first predetermined number is two, the second predetermined number is two or three, or even more. In this way, it can be ensured that the number of times of memory recovery performed on the non-memory recovery protection application is greater than the number of times of memory recovery performed on the memory recovery protection application within the same time period.
And step S106, closing the target application program.
If it is determined in step S104 that the memory value occupied by the target application is smaller than the preset memory value, it indicates that the target application is not the memory reclamation protection application, and the occupied memory value is smaller, so that the memory reclamation operation can be performed on the target application more effectively by closing the target application. When the target application program is closed, the memory occupied by the target application program is completely released.
Therefore, for the application programs with higher user preference degree, the application programs in the preset white list and the application programs of the preset types, the memory recovery operation can be executed as less as possible, and the time for loading the processes of the application programs can be reduced. For other application programs, the memory recovery operation can be executed for many times, so that the memory occupied by the application program is more effectively recovered.
Of course, if the memory reclamation operation is continuously performed when the memory reclamation operation is performed on the target application, the amount of memory reclaimed when the memory reclamation operation is performed for the second time may be very small because the time of two adjacent memory reclamation operations is too short, and therefore, the execution time of two adjacent memory reclamation operations needs to be set, and fig. 2 illustrates a method.
In step S201, it is determined that the target application is not the memory reclamation protection application and the occupied memory value is greater than the preset memory value.
Since fig. 2 is a memory reclamation operation performed for a non-memory reclamation protection application, it is first determined that the target application is not a memory reclamation protection application. In addition, it is also necessary to determine that the memory occupied by the target application is greater than the preset memory value, because the application with the smaller memory occupied is directly closed instead of performing the memory recycling operation.
In step S202, a memory reclamation operation is performed.
After determining that multiple memory reclamation operations need to be performed on the target application, one memory reclamation operation may be performed on the target application. There are many ways to execute the memory reclamation operation, and a common way is to obtain a target process in which a target application is running, such as obtaining a process list of the target application, and obtaining an executing target process from the process list. And then acquiring a physical page corresponding to the target process, identifying an inactive physical page in the physical page, and recycling the inactive physical page.
However, if only the inactive physical page is recycled, the memory recycling efficiency is low, which often results in insufficient memory recycling, and therefore, the present invention also provides a method for memory recycling of the active physical page, and a specific recycling method will be discussed in detail below.
In step S203, a timer is started.
After one memory reclamation operation is executed, timing is started, and the timing time is a first interval time, namely the time between two memory reclamation operations. In this embodiment, for an application that is not a memory reclamation protection application, the interval between two adjacent memory reclamation operations may be set to be shorter, for example, 60 seconds or 90 seconds. Of course, the user may set the length of the first interval time by himself.
Step S204, determining whether the first interval time is reached, if so, executing step S205, otherwise, continuing to execute step S204.
After the timer is started, it is necessary to determine whether the current timing time reaches the first interval time, for example, determine whether the timing time reaches 60 seconds or 90 seconds, and if the first interval time is not reached, continue to wait.
Step S205, determining whether the preset time length is reached, if yes, ending the process, otherwise, returning to step S202.
If the current timing time reaches the first interval time, it is further required to determine whether the preset time length is reached, if the preset time length is reached, the memory recovery operation is not required to be executed again, and if the preset time length is not reached, the memory recovery operation is further required to be executed for multiple times, that is, the step S202 is executed again until the preset time length is reached.
Therefore, by setting the first interval time, it can be ensured that multiple memory recovery operations are not continuously executed in a very short time, which is beneficial to recovering more memories of the application program.
Of course, for the memory reclamation protection application, the time interval between two consecutive memory reclamation operations also needs to be limited, and fig. 3 shows a flow of the memory reclamation operation performed on the memory reclamation protection application. Of course, the flow of fig. 3 is executed on the premise that the number of times of memory recovery performed by the memory recovery protection application is more than two.
Step S301, it is determined that the target application is a memory reclamation protection application.
For example, in step S102 of fig. 1, the determination result as to whether the target application is the memory reclamation protection application is yes.
In step S302, a memory reclamation operation is performed.
After determining that multiple memory reclamation operations need to be performed on the target application, one memory reclamation operation may be performed on the target application. There are many ways to execute memory recovery operation, and a common way is to acquire a target process in which a target application program is running and recover an inactive physical page in a physical page corresponding to the target process. Of course, the present embodiment also performs memory reclamation on the active physical page, and a specific reclamation method will be discussed in detail below.
In step S303, a timer is started.
After one memory reclamation operation is performed, timing is started, and the timing time is a second interval time, namely the time between two memory reclamation operations. In this embodiment, for the memory reclamation protection application, the interval time between two adjacent memory reclamation operations may be set to be longer, for example, 120 seconds or 180 seconds. Of course, the user can set the length of the second interval time by himself.
It should be noted that, in this embodiment, the length of the second interval is greater than the first interval, so as to make the interval between two memory recovery operations of the memory recovery protection application longer, thereby reducing the number of times of performing memory recovery within the preset time.
In step 3204, it is determined whether the second interval time is reached, if so, step S305 is executed, otherwise, step S304 is continuously executed.
After the timer is started, it is necessary to determine whether the current timing time reaches the second interval time, for example, whether the timing time reaches 120 seconds or 180 seconds, and if the timing time does not reach the second interval time, the timer will continue to wait.
Step S305, determining whether the preset time length is reached, if yes, ending the process, otherwise, returning to step S302.
If the current timing time reaches the second interval time, it is further required to determine whether the preset time length is reached, if the preset time length is reached, the memory reclamation operation is not required to be executed again, and if the preset time length is not reached yet, the memory reclamation operation is further required to be executed for a plurality of times, that is, the step S302 is executed again until the preset time length is reached.
It can be seen that, in this embodiment, the operation of executing the memory recovery on the application is executed separately for multiple times, and there is a certain time interval between two adjacent memory recovery operations, so that multiple recovery operations can be avoided from being executed continuously, on one hand, the operation of this embodiment is beneficial to improving the performance of the terminal device in view of performance considerations, on the other hand, because the application is actively generating new pages in the background, if the page aging is performed in a very short time, the memory recovery of the application is completed quickly by executing multiple memory recovery operations continuously, and then the newly generated physical page cannot be recovered, the memory recovery can be realized only depending on the kswapd process of the system, but the quality of the memory recovery is affected.
The memory recovery operation performed on the target application program in the invention firstly obtains the target process currently running by the target application program, for example, obtains the process list of the target application program, thereby determining the target process currently running by the target application program, and then performs the memory recovery operation on each target process respectively. The memory recovery operation is mainly performed on physical pages, and there are many angles for judging the value of data stored in the physical pages, in the prior art, the value of data stored in the physical pages is generally evaluated according to the activity level (or activity level) of the physical pages, and the higher the activity level of the physical pages is, the higher the value of data stored in the physical pages is generally considered by a system to be. In order to compare the activity of physical pages, the prior art introduces a least recently used linked list LRU which is arranged according to the recent usage, and the least used linked list exists at the end. Physical pages in the 4 linked lists of INACTIVE _ ANON, ACTIVE _ ANON, INACTIVE _ FILE and ACTIVE _ FILE can be recycled, ANON represents anonymous mapping, FILE represents FILE mapping, INACTIVE represents INACTIVE state, ACTIVE represents ACTIVE state, and physical pages in the ACTIVE linked list have higher activity than physical pages in the INACTIVE state, that is, physical pages in the ACTIVE state have higher activity than physical pages in the INACTIVE state. When the memory is insufficient, the system preferentially recycles the physical pages in the INACTIVE _ ANON and INACTIVE _ FILE linked lists in the LRU, and when the process needs to use the contents on the recycled physical pages, the corresponding contents need to be loaded from the disk.
However, physical pages occupied by the foreground-running application process or the background-running application process with a high priority may also be in INACTIVE _ ANON and INACTIVE _ FILE, and the physical pages corresponding to the foreground-running process and the background-running process with a high priority in the two linked lists are recycled, so that the number of times of reading and writing of the system disk can be increased to a greater extent, the waiting time of a user is increased, and the user experience is reduced.
It can be seen that the application process should also be used as a weight for evaluating the value of the physical page. Therefore, the prior art proposes a method for performing memory recovery on a process, which includes first selecting a target process as a memory recovery object, acquiring a physical page of the target process, then searching a target physical page that is not used by the target process and recovering the target physical page, where the target physical page that is not used by the target process mainly refers to a physical page in an inactive state.
In the actual scene test, all physical pages occupied by a process which falls back to the background for one minute are recycled, wherein the physical pages of the process in the INACTIVE _ ANON and INACTIVE _ FILE linked list only occupy 5% of the proportion of all the physical pages, and most of the physical pages are the physical pages of the process in the ACTIVE _ ANON and ACTIVE _ FILE linked list. Therefore, the existing method for recovering the memory of the process has low recovery efficiency.
In order to improve the recycling efficiency, the physical pages in the ACTIVE _ ANON and ACTIVE _ FILE linked lists need to be selectively recycled, and preferably, the physical pages with lower value or lower activity are recycled. Therefore, in this embodiment, when performing memory recovery on a target of a target application, the steps shown in fig. 4 are adopted:
step S401, a target physical page corresponding to the target process is acquired.
The method for acquiring the physical page corresponding to the process may find the virtual memory space VMA of the process according to the process identification number PID, may find the physical page corresponding to the process by traversing the VMA, and may also find the physical page corresponding to the process by other methods, which is not specifically limited herein. The target physical page may be all physical pages corresponding to the target process, or may be a part of physical pages corresponding to the target process. The recovery of the target process may be performed in a serial manner, that is, only one physical page is selected as the target physical page for each recovery, and the recovery process of the present invention is executed, or may be performed in a parallel manner, that is, a plurality of physical pages are simultaneously selected as the target physical pages, and the recovery process of the present invention is executed simultaneously on the plurality of physical pages.
In step S402, the value of the activity of the target physical page is read.
After a target physical page corresponding to a target process is obtained, a value of activity of the target physical page can be read, the activity of the target physical page is used for marking the activity degree of the target physical page, and the value of activity of the target physical page is positively correlated with the activity degree of the target physical page, that is, the higher the activity degree of the physical page is, the larger the value of activity is. And, the selectable value of the activity of the physical page should be not less than two.
It should be noted that the value of the activity may be a numerical value, and in this case, the value of the activity may be determined according to the numerical value, but the value of the activity should not be limited to the numerical value, as long as the level of the different value can be determined according to a preset comparison standard.
In step S403, if the value of the activity level of the target physical page is higher than the recovery standard, the activity level of the target physical page is decreased, and the physical page with the activity level higher than the recovery standard is in an active state.
After reading the value of the activity of the target physical page, it may be determined whether the value of the activity of the target physical page is higher than a reclamation criterion, where the physical page with the value of the activity higher than the reclamation criterion is in an active state, and the reclamation criterion may be regarded as a boundary value between the activity of the physical page in the active state and the activity of the physical page in the inactive state. If the value of the activity of the target physical page is determined to be higher than the recycle criterion, the activity of the target physical page may be reduced, and if the value of the activity of the target physical page is determined to be not higher than the recycle criterion, other operations, such as recycling the target physical page, may be performed.
In step S404, the value of the activity of the target physical page is read again.
After step S403, the value of the liveness of the target physical page may be read. If the target physical page read in step S403 is accessed before step S404, the value of the activity of the target physical page is increased. If the target physical page read in step S403 has not been accessed prior to step S404, the value of the target physical page' S liveness will remain the value after the operation of step S403, i.e., after being reduced in liveness.
In step S405, if the value of the activity of the target physical page is not higher than the recycle standard, the target physical page is recycled.
After reading the value of the activity of the target physical page again, whether the value of the activity of the target physical page is higher than the recovery standard or not can be judged, and if the value of the activity of the target physical page is not higher than the recovery standard, the target physical page is recovered. If the value of the activity of the target physical page is not higher than the recovery standard, it indicates that the target physical page is in the inactive state, and there are many methods for recovering the physical page in the inactive state in the prior art, so this embodiment does not repeat the recovery method for the physical page in the inactive state.
In this embodiment, the active page is actively aged, for example, the activity of the active page is actively reduced to realize the active page recycling. Certainly, in the process of actively aging the target physical page, the kswapd process of the system can be fully utilized to age the target physical page, for example, when the target physical page is reduced, the kswapd process can be called, and the activity of the target physical page is reduced by using the kswapd process, so that system resources can be fully utilized, and a more ideal result is achieved.
Of course, in the first memory reclamation manner, if the time interval between step S403 and step S404 is extremely short, and under the limit, it can be understood that after the activity of the target physical page is reduced in step S403, step S404 is directly executed to read the value of the activity of the target physical page, and if there are only two selectable values of the activity, in this way, almost all physical pages corresponding to the target process in the active state are reclaimed, which is equivalent to the system automatically closing the target process, and the waiting time of the user is increased. Therefore, it is necessary to add a regret mechanism in the first embodiment, for example, to set an appropriate time interval between step S403 and step S404 as a regret duration, and if a target physical page is accessed within the set time interval, the value of its liveness rises, so that the possibility of being reclaimed is reduced, which is advantageous for preventing a physical page with a high liveness from being reclaimed. Based on the above concept, a flowchart of a second method of the method for recovering the target process memory of the target application according to the present invention is shown in fig. 5.
Step S501, a target physical page corresponding to a target process is obtained.
Step S502, a preset time length is set according to the priority of the target process, and the preset time length is positively correlated with the priority of the target process.
The repentance duration may also be referred to as a preset duration, which may be a default fixed duration of the system, preferably, after determining to recover the target process, the priority of the target process may be read, and the preset duration may be set according to the priority of the target process, so that the preset duration is positively correlated with the priority of the target process, that is, the higher the priority is, the longer the preset duration is set for the process.
Or, a preset duration may be set according to the memory occupancy rate, where the preset duration is negatively related to the memory occupancy rate, that is, the higher the memory occupancy rate is, the shorter the preset duration is, the higher the recovery efficiency is, so as to recover more memories as soon as possible.
Step S503, reading the value of the activity of the target physical page, wherein the activity of the target physical page is used for marking the activity degree of the target physical page, and the value of the activity degree of the target physical page is positively correlated with the activity degree of the target physical page.
Step S504 is to determine whether the value of the activity of the target physical page is higher than the recovery criterion, if so, step S505 is executed, and if not, step S507 is executed.
After reading the value of the activity of the target physical page, it may be determined whether the value of the activity of the target physical page is higher than a recycling criterion, and a physical page with the activity higher than the recycling criterion is in an active state, if so, step S505 is executed, and if not, step S507 is executed.
And step S505, reducing the activity of the target physical page.
If the value of the activity of the target physical page is judged to be higher than the recycling standard, the activity of the target physical page can be reduced.
In step S506, a timer is started.
After the activity of the target physical page is reduced, a timer can be started and the duration can be recorded. When the time length recorded by the timer reaches the preset time length, the repeated execution of steps S503 to S504 may be repeated only once, that is, if it is still determined that the value of the activity of the target physical page is higher than the recovery criterion when step S504 is repeatedly executed for the first time, step S505 is not executed again, but the recovery process for the target physical page is directly exited, that is, only one recovery attempt is performed on the physical page in the active state. In order to improve the reclamation efficiency and reclaim more memory, it is preferable that two or more reclamation attempts are performed on the active physical page, that is, the steps S503 to S504 may be repeatedly performed twice or more.
The number of repetitions may be preset to a certain limited value, and the actual scenario test result shows that the recovery efficiency of the first three recovery attempts is higher, and the recovery efficiency of the fourth and subsequent recovery attempts is very low, so the number of repetitions may be set to three. In addition, the repetition times can also be set according to the memory occupancy rate, and the higher the memory occupancy rate is, the more the recovery times are. Alternatively, in practical use, the number of repetitions may be set according to other considerations, which is not limited in this embodiment.
It should be noted that the execution sequence of step S502 in the embodiment of the present invention is not limited to the sequence described above, and since the preset time length is used for step S506, the execution is only required before step S506, and the specific timing sequence is not limited.
In step S507, the target physical page is recycled.
If it is determined in step S508 that the value of the liveness of the target physical page is not higher than the recycle standard, the target physical page is recycled.
The repentance mechanism provided by the invention can prevent the physical page with higher activity from being recovered as much as possible by setting a proper time interval as the repentance duration as in the second implementation method, and can also set two or more than two optional values for the activity higher than the recovery standard, so that the physical page with higher activity is less easy to be recovered in the recovery attempt. Therefore, the flow of the third embodiment of the method for performing memory reclamation on the target process of the target application program according to the present invention is shown in fig. 6.
Step S601, setting selectable values of physical page liveness, including a first value, a second value, a third value, and a fourth value.
Optional values for setting physical page liveness may include, for example, a first value, a second value, a third value, and a fourth value, where the first value is not higher than the reclamation criteria, the second value is lower than the third value and higher than the reclamation criteria, and the third value is lower than the fourth value. Alternatively, it can be said that each selectable value represents the number of levels of activity of a physical page, and the higher the value, the higher the number of levels of activity.
By way of example, the activity level of a physical page may be evaluated by setting a flag bit, assuming that two flag bits are set, and the selectable values of each flag bit are 0 and 1, and the value of the activity may be represented by (a first flag bit value, a second flag bit value), then the selectable values of the activity include (0, 0), (0, 1), (1, 0) and (1, 1), and the comparison criterion (0, 0) is preset such that (0, 0) is lower than (1, 0) is lower than (0, 1) is lower than (1, 1), that is, (0, 0), (1, 0), (0, 1) is raised stepwise.
In actual use, a range of optional values may also be set without specifically setting individual values.
Step S602, a target physical page corresponding to the target process is obtained.
In step S603, the value of the activity of the target physical page is read.
Steps S602 to S603 are respectively the same as steps S401 to S402 in the first embodiment, and are not described again here.
In step S604, it is determined whether the value of the activity of the target physical page is higher than the recycle criterion, if so, step S605 is executed, and if not, step S607 is executed.
After reading the value of the activity of the target physical page, it may be determined whether the value of the activity of the target physical page is higher than the recycling criterion, and the physical page with the activity higher than the recycling criterion is in an active state, if so, step S605 is executed, and if not, step S607 is executed.
Step S605 reduces the activity of the target physical page by the first margin.
If it is determined that the value of the activity of the target physical page is higher than the reclamation criterion, the activity of the target physical page may be decreased by a first magnitude, which may be one step per time in the embodiment of the present invention.
In step S606, a timer is started.
A preset duration may be set as the repentance duration, and please refer to the second embodiment for the setting of the preset duration, which is not described in this embodiment again.
When the time length recorded by the timer reaches the preset time length, the steps S603 to S604 are repeatedly executed. If it is determined that the value of the activity level of the target physical page is higher than the eviction criterion when step S604 is repeatedly executed for the first time, step S605 is not executed again, and the eviction process of the target physical page is directly exited, that is, only one eviction attempt is performed on the physical page in the active state. In order to improve the reclamation efficiency and reclaim more memory, it is preferable that two or more reclamation attempts are performed on the active physical page, that is, the steps S603 to S604 may be repeatedly performed twice or more.
The number of times of repetition can be preset, and the actual scene test result shows that the recovery efficiency of the previous recovery attempt is higher, and the recovery efficiency of the fourth and later recovery attempts is very low, so the number of times of repetition can be set to three. In addition, the repetition times can also be set according to the memory occupancy rate, and the higher the memory occupancy rate is, the more the recovery times are. Alternatively, in practical use, the number of repetitions may be set according to other considerations, and is not limited herein.
In step S607, the target physical page is collected.
And if the value of the activity of the target physical page is not higher than the recovery standard, recovering the target physical page.
In the following, according to the method provided by the third embodiment, by way of example, the different cases of the value of the first read activity are assumed that the maximum number of times of repeated execution of steps S603 to S604 is set to 3:
if during a reclamation attempt, the target physical page is not accessed and the value of its liveness is not increased, then:
if the value of the activity of the target physical page is read for the first time as the fourth value, after step S605 is executed, the value of the activity of the target physical page is set to the third value, then steps S603 to S604 are repeatedly executed for the first time, since the value of the activity is still higher than the recovery standard, the value of the activity is continuously decreased by one step and set to the second value, then steps S603 to S604 are repeatedly executed for the second time, since the value of the activity is still higher than the recovery standard, the value of the activity is continuously decreased by one step and set to the first value, then steps S603 to S604 are repeatedly executed for the third time, and since the value of the activity is not higher than the recovery standard, the target physical page is recovered. If the value of the activity of the first read target physical page is the fourth value, the physical page needs to be recycled by repeating the steps S603 to S604 at least three times.
If the value of the activity of the target physical page is read for the first time to be the third value, after the step S605 is executed, the value of the activity of the target physical page is set to be the second value, then the steps S603 to S604 are repeatedly executed for the first time, because the value of the activity is still higher than the recovery standard, the value of the activity is continuously decreased by one level to be set to be the first value, then the steps S603 to S604 are repeatedly executed for the second time, and because the value of the activity is not higher than the recovery standard, the target physical page is recovered. If the value of the activity of the first read target physical page is the third value, the physical page needs to repeat the steps S603 to S604 at least twice to be recycled.
If the value of the activity of the first read target physical page is the second value, after step S605 is executed, the value of the activity of the target physical page is set to the first value, and then steps S603 to S604 are repeated for the first time, and the target physical page is recycled because the value of the activity is not higher than the recycling standard. If the value of the activity of the first read target physical page is the second value, the physical page needs to be recycled by repeating the steps S603 to S604 at least once.
If the value of the activity of the target physical page is read for the first time and is the first value, the target physical page is recycled because the value of the activity is not higher than the recycling standard. If the value of the activity of the first read target physical page is the first value, the physical page can be recycled without repeatedly performing steps S603 to S604.
Therefore, before the recovery step of the present invention is executed, the physical page with higher activity value is less likely to be recovered, that is, the present invention can preferentially recover the physical page with lower activity, and realize the fine classification and recovery of the physical page in the active state.
Second, assuming that the target physical page is accessed during the eviction attempt, the value of its activity increases, and the system needs more eviction attempts to evict the target physical page than in the first case. In practical application, a system usually performs a limited number of recovery attempts on a physical page, and if the value of the activity of a target physical page is still higher than a recovery standard after the limited number of recovery attempts, it indicates that the activity of the target physical page is very high, and the target process is a higher-value physical page, and the system does not recover the target physical page, so that a more reasonable balance is obtained between a process running effect and sufficient memory resources.
Further, the ACTIVE physical pages for which the target process needs to perform a reclamation attempt include a physical page of the target process in the ACTIVE _ ANON linked list (i.e., an anonymous page in the ACTIVE state) and a corresponding physical page of the ACTIVE _ FILE linked list (i.e., a FILE page in the ACTIVE state). The recovery mode of the anonymous page is page exchange, the recovery consumes long time and the efficiency is low; the recovery mode of the file page is page discarding or page writing back, the recovery time is short, and the efficiency is high. Therefore, compared with the anonymous page in the active state, the method can reduce the difficulty of recovering the file page in the active state, improve the recovery probability of the file page, and recover more file pages so as to improve the overall recovery efficiency of the active physical page.
The difficulty of recovering the anonymous page in the active state is increased by adopting various methods, for example, the repentance duration of the anonymous page can be increased, for example, the optional value of the liveness can be reduced, or the reduction range of the liveness can also be increased. Here, we illustrate the third embodiment, and if the third embodiment is used for recovering anonymous pages, please refer to fig. 7, the fourth embodiment of the present invention for recovering memory of a target process of a target application includes the following steps:
step S701, setting selectable values of the physical page liveness, including a first value, a second value, a third value, and a fourth value.
Optional values for setting physical page liveness may include, for example, a first value, a second value, a third value, and a fourth value, where the first value is not higher than the reclamation criteria, the second value is lower than the third value and higher than the reclamation criteria, and the third value is lower than the fourth value. Alternatively, it can be said that each selectable value represents the number of levels of activity of a physical page, and the higher the value, the higher the number of levels of activity.
By way of example, the activity level of a physical page may be evaluated by setting a flag bit, assuming that two flag bits are set, and the selectable values of each flag bit are 0 and 1, and the value of the activity may be represented by (a first flag bit value, a second flag bit value), then the selectable values of the activity include (0, 0), (0, 1), (1, 0) and (1, 1), and the comparison criterion (0, 0) is preset such that (0, 0) is lower than (1, 0) is lower than (0, 1) is lower than (1, 1), that is, (0, 0), (1, 0), (0, 1) is raised stepwise.
Step S702, a target physical page corresponding to the target process is obtained.
In step S703, the value of the activity of the target physical page is read.
Steps S702 to S703 are the same as steps S401 to S402 in the first embodiment, and are not described again here.
In step S704, it is determined whether the value of the activity of the target physical page is higher than the recovery criterion, if so, step S705 is executed, and if not, step S707 is executed.
After reading the value of the activity of the target physical page, it may be determined whether the value of the activity of the target physical page is higher than the reclamation criterion, and the physical page with the value of the activity higher than the reclamation criterion is in an active state, if so, step S705 is performed, and if not, step S707 is performed.
In step S705, if the type of the target physical page is a file page, the activity of the target physical page is reduced according to the second amplitude.
After the target physical page corresponding to the target process is obtained, before the activity of the target physical page is reduced, the reduction amplitude of the activity can be set according to the type of the target physical page. When the target physical page is an anonymous page, reducing the activity of the target physical page according to a first amplitude; and when the target physical page is a file page, reducing the activity of the target physical page according to a second amplitude, wherein the first amplitude is lower than the second amplitude. In the third embodiment, the first amplitude is reduced by one step, and may be used as a recovery flow when the target physical page is an anonymous page, which is not described herein again. The embodiment is mainly used for illustrating a recycling process of a target physical page when the type of the target physical page is a file page. Since the first amplitude is lower than the second amplitude, the second amplitude may be lowered two steps at a time in this embodiment.
In step S706, a timer is started.
A preset duration may be set as the repentance duration, and for the setting of the preset duration, please refer to the second embodiment, which is not described in detail in the embodiments of the present invention.
When the time length recorded by the timer reaches the preset time length, the steps S703 to S704 are repeatedly executed. The process may be repeated only once, that is, if the value of the activity of the target physical page is still determined to be higher than the reclamation criterion when steps S703 to S704 are repeatedly executed for the first time, step S705 is not executed again, and the reclamation process for the target physical page is directly exited, that is, only one reclamation attempt is performed for the physical page in the active state. In order to improve the reclamation efficiency and reclaim more memory, it is preferable that two or more reclamation attempts are performed on the active physical page, that is, the steps S703 to S704 may be repeatedly performed twice or more.
The number of times of repetition can be preset, and the actual scene test result shows that the recovery efficiency of the previous recovery attempt is higher, and the recovery efficiency of the fourth and later recovery attempts is very low, so the number of times of repetition can be set to three. In addition, the repetition times can also be set according to the memory occupancy rate, and the higher the memory occupancy rate is, the more the recovery times are. Alternatively, in practical use, the number of repetitions may be set according to other considerations, and is not limited herein.
In step S707, the target physical page is collected.
And if the value of the activity of the target physical page is not higher than the recovery standard, recovering the target physical page.
In the following, according to the method provided by the fourth embodiment, by way of example, the different cases of the value of the first read activity are assumed that the maximum number of times of repeated execution of steps S703 to S704 is set to 3:
if during a reclamation attempt, the target physical page is not accessed and the value of its liveness is not increased, then:
if the value of the activity of the target physical page is read for the first time as the fourth value, after step S705 is executed, the value of the activity of the target physical page is set to the second value, then steps S703 to S704 are repeatedly executed for the first time, because the value of the activity is still higher than the recovery criterion, the value of the activity is continuously decreased by two steps, because the lowest step is the first value, the value is set to the first value, then steps S703 to S704 are repeatedly executed for the second time, and because the value of the activity is not higher than the recovery criterion, the target physical page is recovered. If the value of the activity of the first read target physical page is the fourth value, the physical page needs to repeat the steps S703 to S704 at least twice to be recycled.
If the value of the activity of the target physical page is read for the first time to be the third value, after step S705 is executed, the value of the activity of the target physical page is set to be the first value, and then steps S703 to S704 are repeatedly executed for the first time, and the target physical page is recycled because the value of the activity is not higher than the recycling standard. If the value of the activity of the first read target physical page is the third value, the physical page needs to repeatedly perform step S703 to step S704 at least once to be recycled.
If the value of the activity of the first read target physical page is the second value, after step S705 is executed, the value of the activity of the target physical page is set to the first value, and then steps S703 to S704 are repeated for the first time, and the target physical page is recycled because the value of the activity is not higher than the recycling standard. If the value of the activity of the first read target physical page is the second value, the physical page needs to repeatedly perform step S703 to step S704 at least once to be recycled.
If the value of the activity of the target physical page is read for the first time and is the first value, the target physical page is recycled because the value of the activity is not higher than the recycling standard. If the value of the activity of the first read target physical page is the first value, the physical page can be recycled without repeatedly performing steps S703 to S704.
Therefore, before the recovery step of the present invention is executed, the physical page with higher activity value is less likely to be recovered, that is, the present invention can preferentially recover the physical page with lower activity, and realize the fine classification and recovery of the physical page in the active state.
Compared with the third embodiment, the present embodiment is advantageous to reduce the number of times of repeated execution of steps S703 to S704 by increasing the reduction range of the value of the activity, and improves the recovery efficiency of the active file pages.
Second, assuming that the target physical page is accessed during the eviction attempt, the value of its activity increases, and the system needs more eviction attempts to evict the target physical page than in the first case. In practical application, a system usually performs a limited number of recovery attempts on a physical page, and if the value of the activity of a target physical page is still higher than a recovery standard after the limited number of recovery attempts, it indicates that the activity of the target physical page is very high, and the target process is a higher-value physical page, and the system does not recover the target physical page, so that a more reasonable balance is obtained between a process running effect and sufficient memory resources.
The recovery of the anonymous page and the file page of the target process in the active state can be realized by the method of the third embodiment and the method of the fourth embodiment, respectively, as shown in table 1 below, which is a practical scenario test for performing page recovery according to the method of the third embodiment and the method of the fourth embodiment. It can be understood that the test data in table 1 is only the result of one test, and when the test is performed again, the test data changes due to different terminals used, different use conditions of the application programs, and the like, so the data in table 1 is only used for qualitatively explaining the recovery effect of the present invention on each application, and is not used for quantitatively limiting the recovery efficiency of the present invention on each application.
Application name First recovery rate Second recovery rate Third recovery rate Fourth recovery rate Fifth recovery rate Cumulative recovery of three recoveries The recovery rate was accumulated for five times
Bean cotyledon 2.64% 8.27% 26.73% 0.46% 0.08% 34.56% 35.00%
QQ 4.62% 33.02% 11.55% 1.90% -0.97% 43.49% 44.10%
WeChat 1.79% 12.15% 19.32% -0.04% 0.32% 30.39% 30.60%
Today's headwear 5.84% 16.98% 17.35% -0.33% -0.85% 35.39% 34.70%
QQ browser 11.72% 17.80% 6.53% 1.54% -1.94% 32.17% 32.00%
Mobile phone housekeeper 4.87% 20.91% 17.58% -0.62% 0.72% 37.99% 38.10%
Application center 24.46% 18.66% 11.40% 0.23% -2.54% 45.56% 44.40%
Sina microblog 8.69% 25.51% 32.80% -0.52% -3.39% 54.29% 53.50%
TABLE 1
The method comprises the steps of taking bean, QQ, WeChat, today's headline, a QQ browser, a mobile phone manager, an application center, a Xinlang microblog and other applications as target applications, namely test objects, taking a process in the target applications as a target process, and performing page recovery on the target process to achieve memory recovery of the target applications. Taking bean cotyledon as an example, in the testing process, firstly, performing steps S603 to S604 once on an anonymous page of a target process of the bean cotyledon or performing steps S703 to S704 once on a document page of the bean cotyledon, which is referred to as first recycling of the bean cotyledon for short, and according to the memory size occupied by the bean cotyledon before the recycling test and the memory size occupied by the bean cotyledon after the first recycling, the first recycling rate of the bean cotyledon can be calculated to be 2.64%; then, performing steps S603 to S604 for the second time on the anonymous page of the target process of the bean, or performing steps S703 to S704 for the second time on the document page of the bean, which is referred to as performing the second recovery on the bean for short, and according to the memory size occupied by the bean after the first recovery and the memory size occupied by the bean after the second recovery, calculating to obtain a second recovery rate of the bean, which is 8.27%; by analogy, the third recovery rate for the bean was 26.73%, the fourth recovery rate for the bean was 0.46%, and the fifth recovery rate for the bean was 0.08%.
Observing the recovery rates of different times of recovery of the same application in table 1, it can be seen that the recovery rates of the previous three times of recovery of each application are far greater than the recovery rates of the fourth time and the fifth time, and the recovery rates of the cumulative three times of recovery (calculated according to the size of the memory occupied by the application after the third time of recovery and the size of the memory occupied by the application before the recovery test) and the cumulative five times of recovery are not very different, which indicates that the recovery times are too many, the recovery efficiency is not high, and resources are wasted, so it is preferable to perform the limited number of page recovery on the application.
In addition, the existing process-specific recovery method only recovers the physical page in the inactive state, the recovery rate corresponds to the first recovery rate in table 1, and by comparing the first recovery rate of the same application with the recovery rate of three times of recovery performed cumulatively in table 1, it can be found that the latter is several times of the former, and the multiple is between 2 times and 17 times.
In summary, the present invention provides a method for performing memory recovery for a process, and can selectively recover a physical page in an active state, thereby greatly improving the efficiency of memory recovery. Moreover, different memory recovery strategies are adopted for different types of application programs, for example, for an application program which is preferred by a user, the times of executing memory recovery operations are fewer, and for an application program which is preferred by the user to a lower degree, the times of executing memory recovery operations are more, so that the influence on the response speed of the application program which is preferred by the user due to frequent execution process loading operations is avoided.
Certainly, in order to enable the terminal device to recover the memory in time, the user may set a free memory threshold, such as 200M, and if the current memory of the terminal device is lower than the threshold, the terminal device will automatically trigger a memory recovery operation, such as acquiring a target application program that the terminal device is running, and execute the process shown in fig. 1, so as to fully recover the memory of the terminal device. Preferably, the system may set a default threshold, or the threshold may be set by the user. If the threshold is set by the user, the user can set the threshold according to the actual use condition.
In addition, since the execution of the memory recovery operation will affect the operation speed of the terminal device, in order to reduce the effect on the operation speed of the terminal device, the terminal device may execute the memory recovery operation only when the load is small, for example, the memory recovery operation is executed when the terminal device is in a screen locking state or a screen saving state, or the memory recovery operation is executed when the terminal device is in a sleep state or a non-operating state, or the memory recovery operation is executed when the load of the CPU is low. Of course, a CPU load threshold needs to be set, and when the load of the CPU is lower than the load threshold, it is determined that the load of the CPU is lower, and at this time, the memory reclamation operation may be performed.
In addition, since the memory recovery operation needs to consume a certain amount of power, the memory recovery operation is performed as much as possible when the terminal device has more power, for example, the memory recovery operation is performed when the terminal device is charged or the power of the terminal device is greater than the power threshold, and the memory recovery operation is not performed when the power of the terminal device is lower than the preset power threshold, for example, when the remaining power is lower than 20%.
Certainly, in order to ensure the operation speed of the terminal device, when the power of the terminal device is lower than the power threshold, if the terminal device has more fragments or the idle memory is lower than the memory threshold, such as 200M, a memory recovery operation is still performed.
The above describes the memory recovery method in the embodiment of the present invention, and the following describes the memory recovery device in the embodiment of the present invention.
Referring to fig. 8, the memory recycling apparatus of the present invention includes:
a first obtaining module 801, configured to obtain a running target application. For example, by acquiring list information of running applications in the task manager, a target application currently running by the terminal device is acquired.
The determining module 802 is configured to determine whether the target application is a memory recovery protection application, specifically, the determining module 802 obtains an operating frequency of the target application, and determines whether the operating frequency of the target application is higher than a preset operating frequency; or, judging whether the target application program is an application program in a preset memory recovery protection list or not; or judging whether the target application program is the preset type application program.
If the judging module determines that the operating frequency of the target application program is higher than the preset operating frequency, or determines that the target application program is an application program in a preset memory recovery protection list, or determines that the target application program is an application program of a preset type, the target application program is determined to be a memory recovery protection application program, and otherwise, the target application program is determined not to be a memory recovery protection application program.
The memory recovery module 803 is configured to, when it is determined that the target application is a memory recovery protection application, perform, within a preset time length, a memory recovery operation on the target application for no more than a first preset number of times; when the target application program is determined not to be the memory recovery protection application program, performing memory recovery operation on the target application program for not less than a second preset number of times within a preset time length or closing the target application program; wherein the first preset times is less than the second preset times.
Specifically, the memory recovery module 803 obtains the memory value occupied by the target application program after determining that the target application program is not the memory recovery protection application program, and determines whether the memory value occupied by the target application program is greater than a preset memory value, if so, performs the memory recovery operation on the target application program for not less than a second preset number of times within a preset time length, otherwise, closes the target application program.
It can be seen that, the present invention executes the recovery operation with a smaller number of times on the memory recovery protection application, and executes the memory recovery operation with a larger number of times when the memory value occupied by the target application is larger than the memory recovery protection application, and directly closes the target application when the memory value occupied by the target application is smaller, so as to release more memory as much as possible.
Preferably, when the memory recovery module 803 executes the memory recovery operation on the target application program, the memory recovery operation is executed for multiple times, and an interval time is set between two adjacent memory recovery operations. In one case, when the target application is not the memory reclamation protection application, the second preset number of times is more than two times, and after one memory reclamation operation is executed, the next memory reclamation operation is executed after a first interval time elapses.
And when the target application program is the memory recovery protection application program, performing more than two times of memory recovery operation on the target application program within a preset time length, and after one time of memory recovery operation is performed, performing the next time of memory recovery operation after a second interval time, wherein the second interval time is greater than the first interval time.
The memory recovery module 803 may have a plurality of implementation manners, one specific implementation manner is shown in fig. 9, and the first embodiment of the memory recovery module 803 in the embodiment of the present invention includes:
a second obtaining module 901, configured to obtain a target process corresponding to a target application, and obtain a target physical page corresponding to the target process.
The first reading module 902 is configured to read a value of activity of a target physical page, where the activity of the target physical page is used to mark an activity level of the target physical page, and the value of activity of the target physical page is positively correlated to the activity level of the target physical page.
A reducing module 903, configured to reduce the activity of the target physical page when the value of the activity of the target physical page is higher than the reclamation criterion, and the physical page with the activity value higher than the reclamation criterion is in an active state.
And a second reading module 904, configured to read the value of the activity of the target physical page again after the activity of the target physical page is reduced by the reducing module.
A reclamation module 905 configured to reclaim the target physical page when the value of the liveness of the target physical page is not higher than a reclamation standard.
Referring to fig. 10, a second embodiment of the memory recovery module 803 in the embodiment of the present invention includes:
a third obtaining module 1001, configured to obtain a target process corresponding to a target application, and obtain a target physical page corresponding to the target process.
The first reading module 1002 is configured to read a value of activity of a target physical page, where the activity of the target physical page is used to mark an activity level of the target physical page, and the value of activity of the target physical page is positively correlated to the activity level of the target physical page.
A reducing module 1003, configured to reduce the activity of the target physical page when the value of the activity of the target physical page is higher than the reclamation criterion, where the physical page with the activity value higher than the reclamation criterion is in an active state.
Preferably, the reducing module 1003 comprises a setting unit 1004 and a reducing unit 1005, wherein the setting unit 1004 is configured to set the activity of the target physical page to a second value when the activity of the target physical page is a third value; and when the activity of the target physical page is the second value, setting the activity of the target physical page to be the first value. A reducing unit 1005 configured to reduce, when the target physical page is an anonymous page, the liveness of the target physical page by a first amplitude; when the target physical page is a file page, reducing the activity of the target physical page according to a second amplitude; and the first amplitude is lower than the second amplitude.
A second setting module 1006, configured to set a preset duration according to the priority of the target process before the timer module 1007 starts the timer, where the preset duration is positively correlated to the priority of the target process.
A timing module 1007 used for starting a timer before reading the value of the activity of the target physical page after reducing the activity of the target physical page.
A second reading module 1008 for reading the value of the liveness of the target physical page after the decreasing module decreases the liveness of the target physical page.
A reclaiming module 1009, configured to reclaim the target physical page when the value of the activity of the target physical page is not higher than a reclaiming standard.
In actual use, the second setting module may not be adopted, but a first setting module is adopted, and the first setting module is used for setting the preset duration according to the memory occupancy rate before the timing module starts the timer, wherein the preset duration is negatively related to the memory occupancy rate.
Fig. 11 is a diagram showing only a portion related to an embodiment of the present invention for convenience of description, and please refer to a method portion in an embodiment of the present invention for details that are not disclosed. The terminal device may be any terminal device including a mobile phone, a tablet computer, a Personal Digital Assistant (PDA), and the like.
Referring to fig. 11, the terminal device includes: a power supply 1103, a memory 1102, a processor 1101, and a computer program stored in the memory and executable on the processor. The processor 1101 executes the computer program to implement the steps in the above-described information processing method embodiments, such as steps S101 to S106 shown in fig. 1. Alternatively, the processor, when executing the computer program, implements the functions of each module or unit in the above-described device embodiments.
Illustratively, a computer program may be partitioned into one or more modules/units, which are stored in a memory and executed by a processor to implement the present invention. One or more of the modules/units described above may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program in the terminal device.
Those skilled in the art will appreciate that the configuration shown in fig. 11 does not constitute a limitation of the terminal device, and may include more or less components than those shown, or combine certain components, or arrange different components, for example, the terminal device described above may also include input and output devices, network access devices, buses, etc.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like, the processor being the control center of the terminal device and connecting the various parts of the entire terminal device using various interfaces and lines.
The memory may be used to store computer programs and/or modules, and the processor may implement various functions of the terminal device by running or executing the computer programs and/or modules stored in the memory and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
The terminal device integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium and used by a processor to implement the steps of the above-described embodiments of the method. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying computer program code, recording medium, U.S. disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution media, and the like. It should be noted that the computer readable medium may contain other components which may be suitably increased or decreased as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, in accordance with legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunications signals.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the above-described division of units is only one type of division of logical functions, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Of course, the above-mentioned embodiments are only preferred embodiments of the present invention, and many more variations may be made in practical applications, for example, the setting manner of the information to be processed is changed, the invisible manner of the information to be processed is changed, and such changes do not affect the implementation of the present invention, and should be included in the protection scope of the present invention.

Claims (9)

1. A memory recovery method is applied to terminal equipment and is characterized by comprising the following steps:
acquiring a running target application program, and judging whether the target application program is a memory recovery protection application program or not;
if the target application program is determined to be the memory recovery protection application program, performing memory recovery operation on the target application program for no more than a first preset number of times within a preset time length;
if the target application program is determined not to be the memory recovery protection application program, performing memory recovery operation not less than a second preset number of times on the target application program within the preset time length or closing the target application program;
wherein the first preset times is less than or equal to the second preset times;
executing the memory reclamation operation on the target application program comprises:
acquiring a target process in which the target application program is running, and acquiring a target physical page corresponding to the target process;
reading the value of the activity of the target physical page, wherein the activity of the target physical page is used for marking the activity degree of the target physical page, and the value of the activity of the target physical page is positively correlated with the activity degree of the target physical page;
if the value of the activity degree of the target physical page is higher than a recovery standard and the physical page with the activity degree value higher than the recovery standard is in an active state, reducing the activity degree of the target physical page;
reading the value of the activity of the target physical page again;
and if the value of the activity of the target physical page is not higher than the recovery standard, recovering the target physical page.
2. The method of claim 1, wherein determining that the target application is a memory reclamation protection application comprises:
acquiring the running frequency of the target application program, and determining that the running frequency of the target application program is higher than a preset running frequency; alternatively, the first and second electrodes may be,
determining that the target application program is an application program in a preset memory recovery protection list; alternatively, the first and second electrodes may be,
and determining that the target application program is a preset type of application program.
3. The memory reclamation method according to claim 1 or 2, wherein determining that the target application program is not a memory reclamation protection application program, and performing not less than a second preset number of memory reclamation operations on the target application program or closing the target application program within the preset time length comprises:
and after determining that the target application program is not the memory recovery protection application program, acquiring a memory value occupied by the target application program, and judging whether the memory value occupied by the target application program is greater than a preset memory value, if so, executing memory recovery operation on the target application program for not less than a second preset number of times within the preset time length, otherwise, closing the target application program.
4. The memory recovery method according to claim 1 or 2, wherein the second predetermined number of times is two or more;
executing the memory recovery operation on the target application program for not less than a second preset number of times within the preset time span comprises:
and after the memory recovery operation is executed once, executing the next memory recovery operation after a first interval time.
5. The method of claim 4, wherein performing no more than a first predetermined number of memory reclamation operations on the target application within a predetermined length of time comprises: executing more than two times of memory recovery operation on the target application program within the preset time span, and,
after the memory recovery operation is executed once, executing the next memory recovery operation after a second interval time;
the second interval time is greater than the first interval time.
6. The utility model provides a memory recovery unit, is applied to terminal equipment, its characterized in that, the device includes:
the acquisition module is used for acquiring a running target application program;
the judging module is used for judging whether the target application program is a memory recovery protection application program or not;
the memory recovery module is used for executing memory recovery operation not more than a first preset number of times on the target application program within a preset time length when the target application program is determined to be a memory recovery protection application program; when the target application program is determined not to be the memory recovery protection application program, performing memory recovery operation on the target application program for not less than a second preset number of times within the preset time length or closing the target application program;
wherein the first preset times are less than the second preset times;
the memory recovery module comprises:
the second acquisition module is used for acquiring a target process corresponding to the target application program and acquiring a target physical page corresponding to the target process;
the first reading module is used for reading the value of the activity of the target physical page, the activity of the target physical page is used for marking the activity degree of the target physical page, and the value of the activity degree of the target physical page is positively correlated with the activity degree of the target physical page;
the reducing module is used for reducing the activity of the target physical page when the value of the activity of the target physical page is higher than the recycling standard, and the physical page with the activity value higher than the recycling standard is in an active state;
the second reading module is used for reading the value of the activity of the target physical page again after the activity of the target physical page is reduced by the reducing module;
and the recovery module is used for recovering the target physical page when the value of the activity of the target physical page is not higher than the recovery standard.
7. The memory recovery device according to claim 6, wherein the determining module is specifically configured to:
acquiring the running frequency of the target application program, and judging whether the running frequency of the target application program is higher than a preset running frequency; alternatively, the first and second electrodes may be,
judging whether the target application program is an application program in a preset memory recovery protection list or not; alternatively, the first and second electrodes may be,
and judging whether the target application program is a preset type of application program.
8. A terminal device, characterized in that the terminal device comprises a processor for implementing the steps of the memory reclamation method according to any one of claims 1 to 5 when executing a computer program stored in a memory.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program, when executed by a processor, implements the steps of the memory reclamation method as recited in any one of claims 1 to 5.
CN201710668172.XA 2017-08-07 2017-08-07 Memory recovery method and device, terminal equipment and computer readable storage medium Active CN108228341B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710668172.XA CN108228341B (en) 2017-08-07 2017-08-07 Memory recovery method and device, terminal equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710668172.XA CN108228341B (en) 2017-08-07 2017-08-07 Memory recovery method and device, terminal equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN108228341A CN108228341A (en) 2018-06-29
CN108228341B true CN108228341B (en) 2021-03-02

Family

ID=62654112

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710668172.XA Active CN108228341B (en) 2017-08-07 2017-08-07 Memory recovery method and device, terminal equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN108228341B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109358955A (en) * 2018-09-27 2019-02-19 联想(北京)有限公司 Process management method and device
CN109857555B (en) * 2019-01-15 2023-02-28 Oppo广东移动通信有限公司 Memory recovery method and device, storage medium and electronic equipment
CN110543365B (en) * 2019-08-20 2024-01-09 Oppo广东移动通信有限公司 Memory optimization method and device, computer readable medium and electronic equipment
WO2021072716A1 (en) * 2019-10-17 2021-04-22 深圳市欢太科技有限公司 Memory management method and apparatus, electronic device and computer-readable medium
CN111666227B (en) * 2020-06-16 2021-09-07 北京紫光展锐通信技术有限公司 Page bump protection method and device for memory recovery of operating system
CN115905032A (en) * 2021-08-20 2023-04-04 深圳市江波龙电子股份有限公司 Storage device, data recovery method thereof, control device and readable storage medium
CN115543864A (en) * 2022-09-30 2022-12-30 荣耀终端有限公司 Memory garbage recycling method and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103092700A (en) * 2013-02-01 2013-05-08 华为终端有限公司 Internal memory cleaning method and cleaning device and terminal device
CN104484282A (en) * 2014-12-31 2015-04-01 广东欧珀移动通信有限公司 Internal storage recovery method and device
WO2015132753A1 (en) * 2014-03-07 2015-09-11 Eco4Cloud S.R.L. Method for memory management in virtual machines, and corresponding system and computer program product
CN105159777A (en) * 2015-08-03 2015-12-16 中科创达软件股份有限公司 Process memory collection method and apparatus
CN105701025A (en) * 2015-12-31 2016-06-22 华为技术有限公司 Memory recovery method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103092700A (en) * 2013-02-01 2013-05-08 华为终端有限公司 Internal memory cleaning method and cleaning device and terminal device
WO2015132753A1 (en) * 2014-03-07 2015-09-11 Eco4Cloud S.R.L. Method for memory management in virtual machines, and corresponding system and computer program product
CN104484282A (en) * 2014-12-31 2015-04-01 广东欧珀移动通信有限公司 Internal storage recovery method and device
CN105159777A (en) * 2015-08-03 2015-12-16 中科创达软件股份有限公司 Process memory collection method and apparatus
CN105701025A (en) * 2015-12-31 2016-06-22 华为技术有限公司 Memory recovery method and device

Also Published As

Publication number Publication date
CN108228341A (en) 2018-06-29

Similar Documents

Publication Publication Date Title
CN108228341B (en) Memory recovery method and device, terminal equipment and computer readable storage medium
CN108228449B (en) Terminal device control method and device, terminal device and computer readable storage medium
CN108205473B (en) Memory processing method and device, computer device and computer readable storage medium
CN108205471B (en) Memory recovery method and device, computer device and computer readable storage medium
CN108205498B (en) Memory recovery method and device, computer device and computer readable storage medium
US10810127B2 (en) Solid-state hard disk and data access method for use with solid-state hard disk
CN110058794B (en) Data storage device for dynamically executing garbage recovery and operation method
EP3229142B1 (en) Read cache management method and device based on solid state drive
US10437519B2 (en) Method and mobile terminal for processing write request
CN108776614B (en) Recovery method and device of storage block
CN111324303B (en) SSD garbage recycling method, SSD garbage recycling device, computer equipment and storage medium
CN108205501B (en) Memory recovery method and device, computer device and computer readable storage medium
CN108228339B (en) Memory recovery method and device, terminal equipment and computer readable storage medium
CN108205474B (en) Memory management method, terminal device, computer apparatus, and readable storage medium
US10514848B2 (en) Data storage method for selectively storing data in a buffer preset in a memory of an electronic device or an inherent buffer in an SSD
CN108228342B (en) Terminal device control method and device, terminal device and computer readable storage medium
US8615624B2 (en) Methods, apparatuses, and computer program products for enhancing memory erase functionality
WO2021057622A1 (en) Garbage collection method, device, electronic apparatus, and storage medium
CN108287760B (en) Terminal device control method and device, terminal device and computer readable storage medium
CN108287761B (en) Memory recovery method and device, terminal equipment and computer readable storage medium
CN106406753A (en) Data storage method and data storage device
CN111984413A (en) Memory recovery method and device, electronic equipment and storage medium
CN108228340B (en) Terminal control method and device, terminal equipment and computer readable storage medium
CN108228472B (en) Terminal device control method and device, terminal device and computer readable storage medium
CN113392037A (en) Memory recovery method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant