CN110543365B - Memory optimization method and device, computer readable medium and electronic equipment - Google Patents
Memory optimization method and device, computer readable medium and electronic equipment Download PDFInfo
- Publication number
- CN110543365B CN110543365B CN201910770583.9A CN201910770583A CN110543365B CN 110543365 B CN110543365 B CN 110543365B CN 201910770583 A CN201910770583 A CN 201910770583A CN 110543365 B CN110543365 B CN 110543365B
- Authority
- CN
- China
- Prior art keywords
- cleaned
- preset
- cleaning
- priority
- memory
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 314
- 238000005457 optimization Methods 0.000 title claims abstract description 24
- 230000008569 process Effects 0.000 claims abstract description 279
- 238000004140 cleaning Methods 0.000 claims abstract description 129
- 238000011156 evaluation Methods 0.000 claims abstract description 38
- 238000004590 computer program Methods 0.000 claims description 9
- 230000004913 activation Effects 0.000 claims description 4
- 230000004044 response Effects 0.000 claims description 4
- 230000004048 modification Effects 0.000 claims description 3
- 238000012986 modification Methods 0.000 claims description 3
- 238000011084 recovery Methods 0.000 claims 2
- 230000003213 activating effect Effects 0.000 claims 1
- 238000005516 engineering process Methods 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 description 9
- 230000007246 mechanism Effects 0.000 description 8
- 230000006870 function Effects 0.000 description 6
- 238000012545 processing Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 230000001960 triggered effect Effects 0.000 description 3
- 230000009471 action Effects 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000002123 temporal effect Effects 0.000 description 2
- 230000003190 augmentative effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000001105 regulatory effect Effects 0.000 description 1
- 230000003252 repetitive effect Effects 0.000 description 1
- 230000002441 reversible effect Effects 0.000 description 1
- 230000026676 system process Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5022—Mechanisms to release resources
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The present disclosure relates to the field of computer technologies, and in particular, to a memory optimization method, a memory optimization apparatus, a computer readable medium, and an electronic device. The method comprises the following steps: the method comprises the steps of responding to a trigger instruction of a system to activate a low memory management service, and obtaining a process to be cleaned by the low memory management service according to a preset rule; reading an end information tag of the process to be cleaned; wherein the end information tag includes: cleaning the frequency mark and the corresponding time mark; evaluating whether the process to be cleaned meets a preset cleaning condition according to the cleaning frequency mark and the corresponding time mark; when the evaluation result meets the preset cleaning condition, executing neglect operation on the process to be cleaned; or executing ending operation on the process to be cleaned when the evaluation result does not meet the preset cleaning condition. The method and the device can identify the process frequently cleaned in a short time and improve the situation that the memory cannot be released.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a memory optimization method, a memory optimization apparatus, a computer readable medium, and an electronic device.
Background
For intelligent terminal equipment such as mobile phones and tablet computers, a plurality of application programs can be operated simultaneously. Each application may correspond to one or more processes, each of which may occupy a certain amount of memory when running. For the Android system, when the memory is in tension, for example, after the memory is lower than a preset memory threshold value, a low memory management (low memory killer) mechanism can be adopted to clear the process and release the memory, so that the system is prevented from being blocked and even is halted and restarted due to insufficient memory.
In the prior art, when a process is cleaned up by using a low memory killer mechanism, after a process is killed, the process is created and operated again in the current application scene because the system needs to use the process. Especially for part of background service processes, the situation that the internal memory of the system is not really suitable for relieving the internal memory tension is caused.
It should be noted that the information disclosed in the above background section is only for enhancing understanding of the background of the present disclosure and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure aims to provide a memory optimization method, a memory optimization device, a computer readable medium, and an electronic device, which can avoid that a system process is repeatedly closed and created and cannot actually release memory.
Other features and advantages of the present disclosure will be apparent from the following detailed description, or may be learned in part by the practice of the disclosure.
According to a first aspect of the present disclosure, there is provided a memory optimization method, including:
the method comprises the steps of responding to a trigger instruction of a system to activate a low memory management service, and obtaining a process to be cleaned by the low memory management service according to a preset rule;
reading an end information tag of the process to be cleaned; wherein the end information tag includes: cleaning the frequency mark and the corresponding time mark;
evaluating whether the process to be cleaned meets a preset cleaning condition according to the cleaning frequency mark and the corresponding time mark;
when the evaluation result meets the preset cleaning condition, executing neglect operation on the process to be cleaned; or alternatively
And executing ending operation on the process to be cleaned when the evaluation result does not meet the preset cleaning condition.
According to a second aspect of the present disclosure, there is provided an indoor positioning system based on an augmented reality device, comprising:
the service activation module is used for responding to a trigger instruction of the system to activate a low memory management service so as to be used for acquiring a process to be cleaned by the low memory management service according to a preset rule;
the process tag reading module is used for reading the end information tag of the process to be cleaned; wherein the end information tag includes: cleaning the frequency mark and the corresponding time mark;
the process evaluation module is used for evaluating whether the process to be cleaned meets a preset cleaning condition according to the cleaning frequency mark and the corresponding time mark;
the neglect process executing module is used for executing neglect operation on the process to be cleaned when the evaluation result meets the preset cleaning condition; or alternatively
And the ending process executing module is used for executing ending operation on the process to be cleaned when the evaluation result does not meet the preset cleaning condition.
According to a third aspect of the present disclosure, there is provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements the memory optimization method described above.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising:
one or more processors;
and the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the memory optimization method.
In the memory optimization method provided by the embodiment of the disclosure, after the process to be cleaned is selected by using the low memory management service, the process to be cleaned can be evaluated again according to the frequency of the previous cleaning of each process to be cleaned and the time of each cleaning, so that when the preset cleaning condition is met, the process to be cleaned is ignored, and the process to be cleaned is prevented from being re-established after being ended, so that the storage space cannot be really released. And the system can clean other ending processes after ignoring the process to be cleaned. Thereby effectively releasing the storage space.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure. It will be apparent to those of ordinary skill in the art that the drawings in the following description are merely examples of the disclosure and that other drawings may be derived from them without undue effort.
FIG. 1 schematically illustrates a method for memory optimization in an exemplary embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow diagram of a method of evaluating a process to be cleaned in an exemplary embodiment of the present disclosure;
FIG. 3 schematically illustrates a flow diagram of another method of evaluating a process to be cleaned in an exemplary embodiment of the present disclosure;
FIG. 4 schematically illustrates a schematic composition of a memory optimization device in an exemplary embodiment of the present disclosure;
fig. 5 schematically illustrates a structural diagram of a computer system of an electronic device in an exemplary embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
The kernel of the existing Android system adopts a low memory killer (low memory management service) mechanism to clear processes when the system memory is tense so as to release the memory and relieve the shortage of the system memory. When selecting a process, the rule with the largest memory occupation is generally selected according to the process priority from low to high under the condition of the same priority. However, some processes are processes needed by the current scene use, and the processes may be quickly re-established and operated after being killed, so that the processes are established after being killed, the memory is still occupied by the processes, and the memory is not actually released, so that the system memory is insufficient and cannot be relieved. If such an operation is repeated several times, it is likely that the system will crash or restart due to insufficient memory.
In order to overcome the defects and shortcomings of the prior art, the embodiment provides a memory optimization method which can be applied to intelligent terminal devices such as mobile phones and tablet computers and the like applying Android systems. Referring to fig. 1, the memory method may include the following steps:
s11, a low memory management service is activated in response to a trigger instruction of a system, so that the low memory management service can acquire a process to be cleaned according to a preset rule;
s12, reading an end information tag of the process to be cleaned; wherein the end information tag includes: cleaning the frequency mark and the corresponding time mark;
s13, evaluating whether the process to be cleaned meets a preset cleaning condition according to the cleaning frequency mark and the corresponding time mark;
s14, executing ending operation on the process to be cleaned when the evaluation result does not meet the preset cleaning condition;
and S15, executing ending operation on the process to be cleaned when the evaluation result does not meet the preset cleaning condition.
In the memory optimization method provided in this example embodiment, after low memory killer (low memory management service) is activated, a process to be cleaned may be selected by using the low memory management service, and then the process to be cleaned may be evaluated again according to the frequency of previous cleaning of each process to be cleaned and the time of each cleaning, so that when the preset cleaning condition is satisfied, the process to be cleaned is ignored. On the one hand, the problem that the storage space cannot be really released due to the fact that the process is built again after being ended can be effectively avoided. And the other side can enable the system to clear other ending processes after ignoring the process to be cleared, so that the storage space is effectively released.
The steps of the memory optimization method in this exemplary embodiment will be described in more detail below with reference to the accompanying drawings and examples.
Step S11, a low memory management service is activated in response to a trigger instruction of the system, so that the low memory management service can acquire a process to be cleaned according to a preset rule.
In this example embodiment, the system may monitor the currently available physical memory or the free physical memory on an irregular basis. For example, when a new application is started, memory space needs to be allocated for the application, and at this time, the currently free memory space can be queried. If the current free memory space is lower than the preset warning value, the memory reclaiming program can be triggered and activated, for example, memory is regulated or the memory is directly reclaimed. Of course, when the system executes a timing task, the system idle memory is periodically detected, and when the warning value is lower than the preset warning value, the memory reclaiming program is triggered and activated. The related content of the memory reclamation can be implemented by using the prior art scheme, which is not described in detail in this disclosure.
After the system memory reclamation is performed, low memory killer (low memory management service) may be triggered if the free memory is still below the preset alert value. After the low memory management service is activated, a process to be cleaned can be selected from the processes currently running in the system according to a preset rule.
For example, in the Android system, after the user exits the application, in order to facilitate restarting of the application, the process of the application still maintains its running state in the system. However, as the number of open programs increases, the memory of the system becomes insufficient, and a portion of the process needs to be killed to free up memory space. At this point, a determination may be made as to which processes to kill through the Low Memory Killer mechanism.
Specifically, the Low Memory Killer mechanism determines whether to kill a process based on the priority of the process and the size of occupied memory. In general, the Android system is provided with the following categories of processes: a foreground process (front App), a visible process (visible App), a Secondary service (Secondary Server), a background process (Hidden App), a Content Provider (Content Provider), and an Empty process (Empty App). The priority of each process is sequentially from high to low. When the Android system kills the processes by using a Low Memory Killer mechanism, the Android system generally selects from low to high according to the priority of each process, and under the condition of the same priority, the process with the largest memory occupation is selected for killing. Each type of process is preconfigured with a corresponding memory warning value. The Low Memory Killer mechanism can complete the determination of the process to be cleaned by using the existing rule, and the specific process can be completed by using the existing technology, which is not described in detail in this disclosure.
Step S12, reading an end information tag of the process to be cleaned; wherein the end information tag includes: the frequency markers and corresponding time markers are cleaned.
In this example embodiment, for each process in the system, a corresponding end information tag may be configured in advance for each process, and the end information tag may include the number of times the process is cleaned up, and a timestamp at each cleaning up. For example, for a content provider XX process, its end information tag may include: cleaning frequency: 1, cleaning time: xx year xx month xx day, 16:42:56:110; cleaning frequency: 2, cleaning time: xx year xx month xx day, 17:01:12:001.
and S13, evaluating whether the process to be cleaned meets a preset cleaning condition according to the cleaning frequency mark and the corresponding time mark.
In this example embodiment, after the end information tag of each process to be cleaned is obtained, each process to be cleaned may be evaluated to determine whether a preset cleaning condition is satisfied. Specifically, referring to fig. 2, the following steps may be included:
step S1311, reading the cleaning frequency flag and determining whether the cleaning frequency flag is greater than or equal to a first threshold value;
step S1312, when the cleaning frequency marks are larger than a first threshold value, obtaining time marks corresponding to the continuous n cleaning frequency marks to determine cleaning time length;
step S1313, when the cleaning duration is less than or equal to the second threshold value, determining that the evaluation result of the process to be cleaned meets a preset cleaning condition; or alternatively
Step S1314, when the cleaning time is greater than the second threshold, determining that the evaluation result of the process to be cleaned does not meet the preset cleaning condition.
For example, the process to be cleaned is an empty process B, and the end information tag may include: cleaning frequency: 1, cleaning time: xx year xx month xx day, 16:42:56:001; cleaning frequency: 2, cleaning time: xx year xx month xx day, 16:42:56:200; cleaning frequency: 3, cleaning time: xx year xx month xx day, 16:42:56:450. and when the process to be cleaned is cleaned for the last time, cleaning the process for the third time, and if the preset first threshold value is 3, judging that the process to be cleaned is larger than the first threshold value. At this point, the specific cleaning time can be calculated from the three time stamps to be 450 milliseconds. If the second threshold value is 500 milliseconds, the process to be cleaned is judged to be smaller than the second threshold value, and the process to be cleaned meets the preset cleaning condition. That is, the process to be cleaned is cleaned continuously for a plurality of times within a shorter time window, the process to be cleaned is cleaned continuously for three times, and the process to be cleaned is cleaned for the fourth time, and the process to be cleaned is judged to currently meet the preset cleaning condition.
Or if the process to be cleaned is an empty process C, and the end information label only contains one or two data of cleaning frequency, the corresponding evaluation result is directly judged to be not satisfied with the preset cleaning condition, and the end operation is still executed on the empty process C.
Or if the end information label of the empty process C to be cleaned contains three data of cleaning frequency, but the cleaning time is longer than the second threshold value through calculation, judging that the corresponding evaluation result does not meet the preset cleaning condition, and still executing the end operation on the empty process C.
Alternatively, in other exemplary embodiments of the present disclosure, it is also possible to determine whether a preset cleaning condition is satisfied by calculating the cleaning frequency. Specifically, referring to fig. 3, the following steps may be included:
step S1321, determining the cleaning frequency corresponding to the process to be cleaned according to the cleaning frequency mark and the corresponding time mark;
step S1322, when the cleaning frequency is less than or equal to a third threshold value, determining that the evaluation result of the process to be cleaned is that a preset cleaning condition is satisfied; or alternatively
Step S1323, when the cleaning frequency is greater than the third threshold value, determining that the evaluation result of the process to be cleaned does not meet the preset cleaning condition.
For example, the cleaning frequency may be calculated from the number of cleaning times and the cleaning duration. In the above embodiment, the number of cleaning times of the empty process B is 3, and the cleaning time is 450 ms, and the cleaning frequency is 450/3, 150 ms/time. If the preset third threshold value is 200 ms, the empty process B is judged to meet the preset cleaning condition, which indicates that the empty process B is cleaned once in a shorter time.
Of course, in other exemplary embodiments of the present disclosure, the first threshold value and the second threshold value may be other specific values. For example, the first threshold value may be 4, 5, etc.; the second threshold may be 800 milliseconds, 1 second, or 1.5 seconds, etc. The present disclosure is not particularly limited thereto.
And S14, when the evaluation result meets the preset cleaning condition, executing neglect operation on the process to be cleaned.
In this example embodiment, when the evaluation result corresponding to the process to be cleaned is that the preset cleaning condition is satisfied, the ignore operation may be performed on the process to be cleaned. For example, the empty process B to be cleaned in the above embodiment, when it is evaluated that the preset cleaning condition is satisfied, an ignore operation is performed on it, that is, the process is not killed any more. In order to meet the requirement of the system for free storage space, the low memory management service can select other processes and kill the processes according to preset rules, so that the memory space is released.
For example, the ignoring of the process to be cleaned may be achieved by modifying the priority information. Specifically, it may include:
the priority information of the process to be cleaned is configured to be neglected; when a preset time period is reached, modifying the neglected priority to the original priority; wherein the level of the ignore priority is higher than the level of the original priority.
For example, if the process to be cleaned is a background process, the priority of the process to be cleaned may be modified to be the priority corresponding to the secondary service process. Specifically, this can be achieved by modifying the oom _adj value of the process to be cleaned. For example, if the original oom _adj value of the background process to be cleaned is 7, the modified oom _adj value is 4. So that the system can skip the process to be cleaned when cleaning the process.
In addition, a timing task can be set for the process to be cleaned, and the priority is modified to the original value after a time period is reached. For example, 10 seconds or 30 seconds. Thereby avoiding that the priority of the process is permanently modified, disturbing the normal execution strategy of the system.
Alternatively, in other exemplary embodiments of the present disclosure, the ignoring of the process to be cleaned may also be implemented by setting a list of ignored processes. Specifically, it may include:
adding the process to be cleaned to a preset neglected process list; and when a preset time period is reached, the process to be cleaned is cleaned from the neglected process list.
For example, a list of ignored processes may be pre-established and stored in a designated database. And when the process to be cleaned is judged to meet the preset cleaning condition, writing the information of the process into the neglected process list. At the same time, a timed task may be established for it, which is deleted from the ignore process list after a period of time has elapsed. The above list of ignored processes may include identification information of the process, a time length of the timed task, a writing time, a deleting time, and the like.
And after the low-memory service selects the process to be cleaned, the process list can be read first, and the process identification is used for inquiring and judging whether the process to be cleaned is in the process list. If in the form, an ignore operation can be performed on the form; if not, continuing to execute the subsequent judgment.
In addition, based on the above, when the process to be cleaned executes the neglect operation, the corresponding end information tag can be cleared, so that when the neglect operation of the process to be cleaned is finished, the process can be judged again by the normal strategy.
And S15, executing ending operation on the process to be cleaned when the evaluation result does not meet the preset cleaning condition.
In this example embodiment, if the evaluation result corresponding to the process to be cleaned does not meet the preset cleaning condition, it indicates that the process is not cleaned frequently within a shorter time window, and then normal process ending operation may be performed on the process, so as to release the memory space of the process.
Based on the foregoing, in other exemplary embodiments of the present disclosure, a process information table may be preconfigured for the system, where the end information tag corresponding to each process is stored in the process information table. The process information form may be stored in a designated target database.
When the end information label of the process to be cleaned is read, the corresponding end information label can be inquired in the process information form by utilizing the identification information of each process.
If the process to be cleaned is empty in the query result corresponding to the process information form, the process is indicated to be not cleaned, or the previous neglected operation is finished, and then the ending operation is directly executed on the process to be cleaned, so that the flow is saved.
According to the method provided by the embodiment of the disclosure, when the system activates Low Memory Killer (low memory management service) mechanism to kill the processes, one or more processes to be cleaned can be selected according to conventional rules, and then the relevant information of each process to be cleaned is read and evaluated to judge whether the preset cleaning condition is met. When the preset cleaning condition is met, the process is indicated to be killed continuously and repeatedly in a shorter time window, and the process is re-created, namely the process is necessary to be used in the current application scene. At this point, an ignore operation may be performed on it, and the process may not be killed for a certain period of time. And the low memory management service can select other processes and kill the processes according to the existing rules, so that the memory space is effectively released. The process which is frequently cleaned recently is effectively identified, so that the situation that the same process is frequently killed is improved, and the system is prevented from being halted or restarted due to insufficient memory for a long time.
It is noted that the above-described figures are only schematic illustrations of processes involved in a method according to an exemplary embodiment of the invention, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
Further, referring to fig. 4, in this exemplary embodiment, there is further provided a memory optimization device 40, including: a service activation module 401, a process tag reading module 402, a process evaluation module 403, an ignore process execution module 404, and an end process execution module 405. Wherein:
the service activation module 401 may be configured to activate a low memory management service in response to a trigger instruction of the system, so that the low memory management service obtains a process to be cleaned according to a preset rule.
The process tag reading module 402 may be configured to read an end information tag of the process to be cleaned; wherein the end information tag includes: the frequency markers and corresponding time markers are cleaned.
The process evaluation module 403 may be configured to evaluate whether the process to be cleaned meets a preset cleaning condition according to the cleaning frequency flag and the corresponding time flag.
The ignoring process executing module 404 may be configured to execute an ignoring operation on the process to be cleaned when the evaluation result meets a preset cleaning condition.
The ending process execution module 405 may be configured to execute an ending operation on the process to be cleaned when the evaluation result does not meet the preset cleaning condition.
In one example of the present disclosure, the process tag reading module 402 may include: a process information form query unit (not shown in the figure).
The process information form query unit may be configured to query a corresponding end information tag in a process information form preset in a target database according to a preset process identifier of the process to be cleaned; the process information form comprises a process identifier and an end information label corresponding to the process.
In one example of the present disclosure, the process tag reading module 402 may further include: a null result execution unit (not shown in the figure). Wherein,
the empty result execution unit may be configured to execute an ending operation on the process to be cleaned when the query result corresponding to the process information form of the process to be cleaned is empty.
In one example of the present disclosure, the process evaluation module 403 may include: a cleaning frequency flag reading unit, a cleaning time length acquisition unit, a first judgment unit, and a second judgment unit (not shown in the figure). Wherein,
the cleaning frequency flag reading unit may be configured to read the cleaning frequency flag and determine whether the cleaning frequency flag is greater than or equal to a first threshold value.
The cleaning time length obtaining unit may be configured to obtain time marks corresponding to n continuous cleaning frequency marks to determine a cleaning time length when the cleaning frequency mark is greater than a first threshold value; wherein n is a positive integer.
The first judging unit may be configured to determine that the evaluation result of the process to be cleaned meets a preset cleaning condition when the cleaning duration is less than or equal to a second threshold value.
The second judging unit may be configured to determine that the evaluation result of the process to be cleaned does not meet a preset cleaning condition when the cleaning time is longer than a second threshold value.
In one example of the present disclosure, the process evaluation module 403 may include: may further include: a cleaning frequency acquisition unit, a third judgment unit, and a fourth judgment unit (not shown in the figure). Wherein,
the cleaning frequency obtaining unit may be configured to determine a cleaning frequency corresponding to the process to be cleaned according to the cleaning frequency flag and the corresponding time flag.
The third judging unit may be configured to determine that the evaluation result of the process to be cleaned meets a preset cleaning condition when the cleaning frequency is less than or equal to a third threshold value.
The fourth judging unit may be configured to determine that the evaluation result of the process to be cleaned does not meet a preset cleaning condition when the cleaning frequency is greater than a third threshold value.
In one example of the present disclosure, the neglect process execution module may include: a priority modifying unit, a priority restoring unit (not shown in the figure). Wherein,
the priority modification unit may be configured to configure the priority information of the process to be cleaned to ignore a priority.
The priority reduction unit may be configured to modify the neglected priority to an original priority when a preset time period is reached; wherein the level of the ignore priority is higher than the level of the original priority.
In one example of the present disclosure, the ignoring process execution module may further include: an ignore process list processing unit, an ignore process list restoring unit (not shown in the figure).
The process to be cleaned up may be added to a preset process to be ignored list by the process to be ignored list processing unit.
The ignoring process list restoring unit may be configured to clear the process to be cleared from the ignoring process list when a preset time period is reached.
The specific details of each module in the above memory optimization device are described in detail in the corresponding memory optimization method, so that the details are not repeated here.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
Fig. 5 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
It should be noted that, the computer system 500 of the electronic device shown in fig. 5 is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a central processing unit (Central Processing Unit, CPU) 501, which can perform various appropriate actions and processes according to a program stored in a Read-Only Memory (ROM) 502 or a program loaded from a storage section 508 into a random access Memory (Random Access Memory, RAM) 503. In the RAM 503, various programs and data required for the system operation are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other through a bus 504. An Input/Output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a liquid crystal display (Liquid Crystal Display, LCD), and the like, and a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN (Local Area Network ) card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The drive 510 is also connected to the I/O interface 505 as needed. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
In particular, according to embodiments of the present invention, the processes described below with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511. When executed by a Central Processing Unit (CPU) 501, performs the various functions defined in the system of the present application.
It should be noted that, the computer readable medium shown in the embodiments of the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-Only Memory (ROM), an erasable programmable read-Only Memory (Erasable Programmable Read Only Memory, EPROM), flash Memory, an optical fiber, a portable compact disc read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present invention may be implemented by software, or may be implemented by hardware, and the described units may also be provided in a processor. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
As another aspect, the present application also provides a computer-readable medium that may be contained in the electronic device described in the above embodiment; or may exist alone without being incorporated into the electronic device. The computer-readable medium carries one or more programs which, when executed by one of the electronic devices, cause the electronic device to implement the methods described in the embodiments below. For example, the electronic device may implement the steps shown in fig. 1.
Furthermore, the above-described drawings are only schematic illustrations of processes included in the method according to the exemplary embodiment of the present invention, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (7)
1. A memory optimization method, comprising:
the method for activating the low memory management service in response to the triggering instruction of the system is used for the low memory management service to acquire the process to be cleaned according to a preset rule, and comprises the following steps: after the system memory recovery is executed, if the idle memory is still lower than a preset warning value, triggering a low memory management service to select a process to be cleaned from the processes currently running in the system; the low memory management service determines a process to be cleaned according to the priority of the process and the size of occupied memory;
reading an end information tag of the process to be cleaned; wherein the end information tag includes: cleaning the frequency mark and the corresponding time mark;
evaluating whether the process to be cleaned meets a preset cleaning condition according to the cleaning frequency mark and the corresponding time mark comprises the following steps: determining the cleaning frequency corresponding to the process to be cleaned according to the cleaning frequency mark and the corresponding time mark; when the cleaning frequency is smaller than or equal to a third threshold value, determining that the evaluation result of the process to be cleaned meets a preset cleaning condition; or when the cleaning frequency is greater than a third threshold value, determining that the evaluation result of the process to be cleaned does not meet a preset cleaning condition;
when the evaluation result meets the preset cleaning condition, executing neglect operation on the process to be cleaned, including: the priority information of the process to be cleaned is configured to be an neglect priority, and neglect operation is executed on the process to be cleaned, so that the process is not killed any more; when a preset time period is reached, modifying the neglected priority to be the original priority; wherein the level of the ignore priority is higher than the level of the original priority; or alternatively
And executing ending operation on the process to be cleaned when the evaluation result does not meet the preset cleaning condition.
2. The method of claim 1, wherein the reading the end information tag of the process to be cleaned comprises:
inquiring a corresponding end information label in a process information form preset in a target database according to the preset process identification of the process to be cleaned; the process information form comprises a process identifier and an end information label corresponding to the process.
3. The method according to claim 2, wherein the method further comprises:
and executing ending operation on the process to be cleaned when the query result corresponding to the process information form of the process to be cleaned is empty.
4. The method of claim 1, wherein performing an ignore operation on the process to be cleaned comprises:
adding the process to be cleaned to a preset neglected process list;
and when a preset time period is reached, the process to be cleaned is cleaned from the neglected process list.
5. A memory optimization device, comprising:
the service activation module is used for responding to a trigger instruction of the system to activate a low memory management service, so that the low memory management service can acquire a process to be cleaned according to a preset rule, and comprises the following steps: after the system memory recovery is executed, if the idle memory is still lower than a preset warning value, triggering a low memory management service to select a process to be cleaned from the processes currently running in the system; the low memory management service determines a process to be cleaned according to the priority of the process and the size of occupied memory;
the process tag reading module is used for reading the end information tag of the process to be cleaned; wherein the end information tag includes: cleaning the frequency mark and the corresponding time mark;
the process evaluation module is configured to evaluate whether the process to be cleaned meets a preset cleaning condition according to the cleaning frequency mark and the corresponding time mark, and includes: determining the cleaning frequency corresponding to the process to be cleaned according to the cleaning frequency mark and the corresponding time mark; when the cleaning frequency is smaller than or equal to a third threshold value, determining that the evaluation result of the process to be cleaned meets a preset cleaning condition; or when the cleaning frequency is greater than a third threshold value, determining that the evaluation result of the process to be cleaned does not meet a preset cleaning condition;
the neglecting process executing module is used for executing neglecting operation on the process to be cleaned when the evaluation result meets the preset cleaning condition, and comprises the following steps: the priority modification unit is used for configuring the priority information of the process to be cleaned as an neglected priority, executing neglected operation on the process to be cleaned, and not killing the process; the priority restoring unit is used for modifying the neglected priority to the original priority when the preset time period is reached; wherein the level of the ignore priority is higher than the level of the original priority; or alternatively
And the ending process executing module is used for executing ending operation on the process to be cleaned when the evaluation result does not meet the preset cleaning condition.
6. A computer readable medium on which a computer program is stored, characterized in that the computer program, when executed by a processor, implements the memory optimization method according to any one of claims 1 to 4.
7. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the memory optimization method of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910770583.9A CN110543365B (en) | 2019-08-20 | 2019-08-20 | Memory optimization method and device, computer readable medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910770583.9A CN110543365B (en) | 2019-08-20 | 2019-08-20 | Memory optimization method and device, computer readable medium and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110543365A CN110543365A (en) | 2019-12-06 |
CN110543365B true CN110543365B (en) | 2024-01-09 |
Family
ID=68711809
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910770583.9A Active CN110543365B (en) | 2019-08-20 | 2019-08-20 | Memory optimization method and device, computer readable medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110543365B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114296907A (en) * | 2020-09-21 | 2022-04-08 | 华为技术有限公司 | Method and device for process control |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104850414A (en) * | 2014-02-14 | 2015-08-19 | 可牛网络技术(北京)有限公司 | Cleaning method and cleaning apparatus of application process, and mobile terminal |
CN106293924A (en) * | 2015-05-20 | 2017-01-04 | Tcl集团股份有限公司 | The EMS memory management process of Android system and device |
CN107608785A (en) * | 2017-08-15 | 2018-01-19 | 深圳天珑无线科技有限公司 | Process management method, mobile terminal and readable storage medium |
CN107797871A (en) * | 2017-11-30 | 2018-03-13 | 努比亚技术有限公司 | EMS memory occupation method for releasing resource, mobile terminal and computer-readable recording medium |
CN107943593A (en) * | 2018-01-03 | 2018-04-20 | 上海传英信息技术有限公司 | A kind of memory automatic cleaning method for intelligent terminal |
CN108228341A (en) * | 2017-08-07 | 2018-06-29 | 珠海市魅族科技有限公司 | Method for recovering internal storage and device, terminal device and computer readable storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105373485A (en) * | 2014-09-01 | 2016-03-02 | 富泰华工业(深圳)有限公司 | Memory cleaning system and method and terminal device |
-
2019
- 2019-08-20 CN CN201910770583.9A patent/CN110543365B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104850414A (en) * | 2014-02-14 | 2015-08-19 | 可牛网络技术(北京)有限公司 | Cleaning method and cleaning apparatus of application process, and mobile terminal |
CN106293924A (en) * | 2015-05-20 | 2017-01-04 | Tcl集团股份有限公司 | The EMS memory management process of Android system and device |
CN108228341A (en) * | 2017-08-07 | 2018-06-29 | 珠海市魅族科技有限公司 | Method for recovering internal storage and device, terminal device and computer readable storage medium |
CN107608785A (en) * | 2017-08-15 | 2018-01-19 | 深圳天珑无线科技有限公司 | Process management method, mobile terminal and readable storage medium |
CN107797871A (en) * | 2017-11-30 | 2018-03-13 | 努比亚技术有限公司 | EMS memory occupation method for releasing resource, mobile terminal and computer-readable recording medium |
CN107943593A (en) * | 2018-01-03 | 2018-04-20 | 上海传英信息技术有限公司 | A kind of memory automatic cleaning method for intelligent terminal |
Non-Patent Citations (1)
Title |
---|
桌面Linux内存管理算法改进;刘生平等;《***工程与电子技术》;20050320;第27卷(第03期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN110543365A (en) | 2019-12-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107239339B (en) | System performance optimization parameter determination method, system performance optimization method and device | |
CN109995677B (en) | Resource allocation method, device and storage medium | |
CN104268019A (en) | Software operating method and device and terminal | |
CN105677477A (en) | Method and device for optimizing application program resources and electronic equipment | |
CN109002457A (en) | Downloading channel statistical processing methods, device and the electronic equipment of application program | |
CN106155789A (en) | A kind of application freezing method and mobile terminal | |
CN104239179A (en) | Terminal and method for achieving application management thereof | |
CN110543365B (en) | Memory optimization method and device, computer readable medium and electronic equipment | |
CN112579692A (en) | Data synchronization method, device, system, equipment and storage medium | |
CN109634822B (en) | Function time consumption statistical method and device, storage medium and terminal equipment | |
CN107506293B (en) | Software performance data acquisition method and device | |
CN113806651B (en) | Data caching method, device, server and storage medium | |
CN112235474B (en) | Method, device and equipment for scheduling prepaid flow code number | |
CN105721392B (en) | A kind of method, apparatus and system for recommending application | |
CN107329832B (en) | Data receiving method and device | |
CN105843752A (en) | Method and device for distributing memory of mobile terminal for caching image data | |
CN111107147B (en) | Message pushing method and device | |
CN111221468B (en) | Storage block data deleting method and device, electronic equipment and cloud storage system | |
CN110795239A (en) | Application memory leakage detection method and device | |
CN109067864B (en) | Notification message pushing method and device and electronic equipment | |
CN109101259B (en) | Updating method and device of OSDMap cache container and terminal | |
CN110377616A (en) | A kind of data-erasure method, device, electronic equipment and storage medium | |
CN110555744A (en) | Service data processing method and system | |
CN108920722B (en) | Parameter configuration method and device and computer storage medium | |
CN110532095B (en) | Memory optimization method and device, electronic 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 |