CN110543431A - Memory optimization method and device, electronic equipment and storage medium - Google Patents

Memory optimization method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110543431A
CN110543431A CN201910797782.9A CN201910797782A CN110543431A CN 110543431 A CN110543431 A CN 110543431A CN 201910797782 A CN201910797782 A CN 201910797782A CN 110543431 A CN110543431 A CN 110543431A
Authority
CN
China
Prior art keywords
memory
cleaned
processes
determining
cleaning process
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910797782.9A
Other languages
Chinese (zh)
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.)
Oppo Chongqing Intelligent Technology Co Ltd
Original Assignee
Oppo Chongqing Intelligent 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 Oppo Chongqing Intelligent Technology Co Ltd filed Critical Oppo Chongqing Intelligent Technology Co Ltd
Priority to CN201910797782.9A priority Critical patent/CN110543431A/en
Publication of CN110543431A publication Critical patent/CN110543431A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

the disclosure relates to a memory optimization method and device, electronic equipment and a storage medium, and relates to the technical field of computers, wherein the method comprises the following steps: responding to an activation instruction of a low memory management service, and triggering the low memory management service to acquire a plurality of processes to be cleaned in a system; obtaining evaluation results of the processes to be cleaned; and determining a target cleaning process from the plurality of processes to be cleaned according to the evaluation result, and executing an ending operation on the target cleaning process. The technical scheme disclosed by the invention can accurately determine the proper target cleaning process to clean, so that the efficiency is improved, the condition of internal memory shortage can be avoided, and the system performance is improved.

Description

Memory optimization method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a memory optimization method, a memory optimization device, an electronic device, and a computer-readable storage medium.
Background
For intelligent terminal equipment such as mobile phones and tablet computers, a plurality of application programs can be operated simultaneously. Each application program may correspond to one or more processes, and each process occupies a certain memory when running. For the Android system, when the memory is in tension, for example, the memory is lower than a preset memory threshold, a low memory management service mechanism can be used for cleaning the process and releasing the memory.
In the related art, when a low memory management service mechanism is used to clean a process, a process with low priority or a process with a large memory is generally killed first. If a process with a lower priority has a larger memory, but a system has a low memory caused by memory leak and other exceptions, the process with the large memory occupation can be killed only when the system memory is continuously reduced to the memory threshold corresponding to the priority. This approach may result in an inability to quickly and accurately determine the process to be completed, thereby effectively alleviating a memory-starvation condition. In addition, this may cause the system to have a low memory for a long time, which may cause the system to be stuck or even to be dead in a black screen.
It is to be noted that the information disclosed in the above background section is only for enhancement of 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 is directed to a method and an apparatus for optimizing a memory, an electronic device, and a storage medium, so as to overcome, at least to a certain extent, a problem that a process cannot be ended accurately in time due to limitations and defects of related technologies.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to an aspect of the present disclosure, there is provided a memory optimization method, including:
Responding to an activation instruction of a low memory management service, and triggering the low memory management service to acquire a plurality of processes to be cleaned in a system;
Obtaining evaluation results of the processes to be cleaned;
And determining a target cleaning process from the plurality of processes to be cleaned according to the evaluation result, and executing an ending operation on the target cleaning process.
According to an aspect of the present disclosure, there is provided a memory optimization apparatus, including:
the system comprises a process determining module, a processing module and a processing module, wherein the process determining module is used for responding to an activating instruction of low memory management service and triggering the low memory management service to acquire a plurality of processes to be cleaned in the system;
The evaluation result determining module is used for acquiring evaluation results of the processes to be cleaned;
And the process ending module is used for determining a target cleaning process from the plurality of processes to be cleaned according to the evaluation result and executing ending operation on the target cleaning process.
According to an aspect of the present disclosure, there is provided an electronic device including:
a processor; and
A memory for storing executable instructions of the processor;
Wherein the processor is configured to perform any of the memory optimization methods described above via execution of the executable instructions.
According to an aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the memory optimization method of any one of the above.
in the memory optimization method, the memory optimization device, the electronic device, and the computer-readable storage medium provided in the embodiments of the present disclosure, a target cleaning process is determined according to evaluation results of a plurality of processes to be cleaned, and an end operation is performed on the target cleaning process. On the one hand, the evaluation result of each process to be cleaned can be determined from multiple dimensions through the information corresponding to the process, and then the most appropriate target cleaning process is determined from the multiple processes to be cleaned through the evaluation result of the processes to be cleaned, so that a long waiting process required when the processes to be cleaned are determined according to one dimension is avoided, and the efficiency and the accuracy of determining the target cleaning process are improved. On the other hand, the target cleaning process can be ended in time according to the evaluation result, so that the condition that the system continuously keeps low memory for a long time is avoided, the function of quickly cleaning the memory is realized, the effectiveness of optimizing the memory is improved, and the system performance is improved.
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 present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
Fig. 1 schematically illustrates a schematic diagram of a memory optimization method in an embodiment of the present disclosure.
Fig. 2 schematically illustrates a specific flow of determining a target cleaning process in an embodiment of the present disclosure.
Fig. 3 schematically illustrates a specific flow of determining a target cleaning process according to a candidate cleaning process in the embodiment of the present disclosure.
Fig. 4 schematically illustrates a block diagram of a memory optimization apparatus in an embodiment of the present disclosure.
fig. 5 schematically illustrates a block diagram of an electronic device in an embodiment of the disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different 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 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. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
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 their repetitive description 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 the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The inventor finds that the current strategy for selecting and killing the process by the Android low-memory management service is as follows: the available memory is lower than different thresholds, the priority ranges of the processes that can be selected are different, and the specific memory thresholds and the corresponding relationship between the priorities can be shown in table 1. The priority can be represented by adj, the specific numerical value can be any numerical value between-1000 and 1000, and the higher the adj is, the lower the priority is.
TABLE 1
adj 0 100 200 300 900 906
Memory threshold 70MB 90MB 100MB 120MB 220MB 320MB
That is, when the available memory of the system is less than 320MB, only one process with the maximum adj for representing the priority can be selected within the range of 906-1000 corresponding to the priority adj; and under the condition that the adj priorities are the same, selecting the process occupying the largest memory to kill. However, if there is an exception such as memory leak in a process with a priority adj of 100, which results in low memory in the system, according to the policy in the related art, the system will kill the process from 906 to 100, that is, the process with large memory will be killed only when the memory of the system is continuously as low as 90 MB. This can cause the system to have a low memory for a long time, which may cause the system to jam or even to crash.
In order to solve the above technical problem, an embodiment of the present disclosure first provides a memory optimization method, which may be applied to an application scenario in which a memory of a terminal is released and optimized. Referring to fig. 1, the memory optimization method may include steps S110 to S130, where:
In step S110, in response to an activation instruction for a low memory management service, triggering the low memory management service to acquire a plurality of processes to be cleaned in a system;
In step S120, obtaining evaluation results of the plurality of processes to be cleaned;
In step S130, a target cleaning process is determined from the plurality of processes to be cleaned according to the evaluation result, and an end operation is performed on the target cleaning process.
In the memory optimization method provided in the embodiment of the disclosure, on one hand, since the evaluation result of each process to be cleaned can be determined from multiple dimensions through the information corresponding to the process, and then the most appropriate target cleaning process is determined from the multiple processes to be cleaned through the evaluation result of the process to be cleaned, a long waiting process required when the process to be cleaned is determined according to one dimension is avoided, and the efficiency and accuracy of determining the target cleaning process are improved. On the other hand, the target cleaning process can be ended in time according to the evaluation result, so that the condition that the system continuously keeps low memory for a long time is avoided, the function of quickly cleaning the memory is realized, the effectiveness of optimizing the memory is improved, and the system performance is improved.
Next, a memory optimization method in the embodiment of the present disclosure is specifically described with reference to fig. 1 to 3.
In step S110, in response to an activation instruction for the low memory management service, the low memory management service is triggered to acquire a plurality of processes to be cleaned in the system.
In the embodiment of the present disclosure, the low memory management service refers to a low memory vendor, and is used to clean a process or an application program in a system corresponding to a terminal device. The terminal equipment can be a mobile phone, a tablet computer and the like; the system can be an Android system installed and operated on the terminal equipment. Android is a multitasking system, that is to say, a plurality of programs can be run simultaneously. Generally, starting a program is time-consuming, so in order to increase the running speed, when the program exits, the Android does not kill the program immediately, so that the program can be started quickly when running again next time. With more and more programs reserved in the system, the memory is insufficient, and the low memory management service is to clear related programs when the memory of the system is lower than a certain value, so that the system is guaranteed to keep a certain amount of free memory.
Based on this, the currently available physical memory or the idle physical memory of the system may be monitored, and specifically, the system memory may be monitored in real time or periodically. For example, when a new application program is started, a memory space needs to be allocated to the application program, and at this time, the currently free memory space can be queried; the system memory may also be monitored at intervals. The activate command refers to a command for activating a low memory management service cleaning process, and may include, but is not limited to, that the currently free memory space of the system is lower than a preset memory threshold, for example. After the low memory management service is activated, a plurality of processes to be cleaned in the system can be acquired through the low memory management service. For the memory management service, the low memory management service mechanism judges whether to kill the process according to the priority of the process and the size of the occupied memory. Namely, when the Android system kills the processes by using the low memory management service mechanism, the Android system selects the processes from low to high according to the priority of each process, and selects the process with the largest memory occupation to kill under the condition of equal priority. The Android system provides the following classes of processes: foreground process, visible process, secondary service, background process, content provider, and null process. The priority of the processes of each category sequentially changes from high to low, and the processes of each category are configured with corresponding memory threshold values in advance. Based on this, the acquired plurality of processes to be cleaned may be all processes running in the system or part of processes. The partial processes may be processes of the same priority or processes of different priorities, and are not limited herein.
Next, as shown in fig. 1, in step S120, the evaluation results of the plurality of processes to be cleaned are obtained.
In the embodiment of the disclosure, the evaluation result is information used for representing the grade degree of the process to be cleaned, so that whether the process to be cleaned can be cleaned or not is determined through the evaluation result. The evaluation result may be a specific numerical value or a range, and the evaluation result is described as a specific numerical value.
The evaluation result can be specifically represented by a process score, and the larger the process score is, the larger the evaluation result is; the smaller the progress score, the smaller the assessment result. On the basis, the process score of the process to be cleaned can be obtained as the evaluation result, so that the target cleaning process can be determined subsequently. Specifically, the process score of each process to be cleaned may be calculated according to the process information, the memory information, and the memory information of the system of the process to be cleaned. The process information of the process to be cleaned may include, but is not limited to, priority information, and may be specifically represented by adj. The memory information of the process to be cleaned may include, but is not limited to, the memory occupied by the process to be cleaned, which may be specifically represented by process _ total _ size, and the memory occupied by the page (4k) process may be used. The memory information of the system may be the total memory of the system, and is specifically represented by a memory parameter C. The memory parameters may be used to indicate the specific size of the total memory, and the total memory of the system is different, and the corresponding memory parameters are also different. For example, the larger the total memory of the system, the larger the memory parameter, e.g., memory parameter C may be 512. The specific calculation method for determining the process score of the process to be cleaned according to the process information and the memory information of the process to be cleaned and the memory information of the system can be as shown in formula (1):
points + process _ total _ size/C formula (1)
Wherein C is a value greater than 0.
For example, when the priority adj of the process 1 to be cleaned is 906, the occupied memory is 100MB, and if the memory parameter C is 512, the process score of the process 1 to be cleaned, which is calculated by the formula (1), is 906+50 to 961; if the priority adj of the process 2 to be cleaned is 100, the occupied memory is 2GB, and if the memory parameter C is 512, the process score of the process 2 to be cleaned, which is calculated by the formula (1), is 100+1024 — 1124.
in formula (1), the weight of the priority adj and the weight of the occupied memory process _ total _ size are both 1. It should be noted that the weights of the priority adj and the memory occupied process _ total _ size are other values within the scope of the disclosure, and are not limited herein.
By the method, the process score of each process to be cleaned can be accurately determined according to the process information of the process to be cleaned and the memory information of the system, so that the degree of the process to be cleaned can be accurately evaluated.
Next, in step S130, a target cleaning process is determined from the plurality of processes to be cleaned according to the evaluation result, and an end operation is performed on the target cleaning process.
In the embodiment of the present disclosure, the target cleaning process refers to a process that is to execute a finishing operation currently, that is, a process to be cleaned that is to be killed currently. Because when cleaning the process, a plurality of processes are cleaned in sequence, the number of the target cleaning processes to be killed at present can be one, so that the target cleaning processes can be cleaned accurately. When the number of the target cleaning processes is one, in the process of determining the target cleaning processes, the candidate cleaning processes can be determined according to the ranking order of the process scores. Fig. 2 is a schematic diagram schematically illustrating the determination of the target cleaning process according to the process score, and referring to fig. 2, the method mainly includes step S210 and step S220, where:
In step S210, determining a candidate cleaning process from the plurality of processes to be cleaned according to the ranking order of the process scores;
in step S220, the target cleaning process is determined according to the candidate cleaning processes.
in the embodiment of the present disclosure, the candidate cleaning processes may be all processes obtained according to the ranking order of the process scores. The order of arrangement may be, for example, from large to small, or from small to large, and may be set according to actual needs, and the order of large to small is taken as an example for description here. Specifically, the process to be cleaned with the highest process score among all the processes to be cleaned may be determined as the candidate cleaning process. Of course, in other embodiments, the process to be cleaned with the lowest process score among all the processes to be cleaned may also be determined as the candidate cleaning process. It should be noted that the number of the determined candidate cleaning processes may be one or more. For example, the process with the highest score is the process 1 to be cleaned; or the process with the highest score is the process to be cleaned 1 and the process to be cleaned 2, and the like. Further, the target cleaning process can be determined from the candidate cleaning processes in different manners according to the number of the candidate cleaning processes.
Further, fig. 3 schematically shows a schematic diagram of determining a target cleaning process according to a candidate cleaning process, and referring to fig. 3, the method mainly includes the following steps S310 to S330, and the steps in fig. 3 are a specific implementation manner of step S220, where:
In step S310, it is determined whether the number of candidate cleaning processes is one. If yes, go to step S320; if not, go to step S330.
In step S320, when the number of candidate cleaning processes is one, the candidate cleaning process may be directly used as the target cleaning process. For example, if the process score 1124 is the highest among the processes to be cleaned, and the process score 1124 only corresponds to the process 1 to be cleaned, the process 1 to be cleaned may be used as a candidate cleaning process, and the process 1 to be cleaned may be further used as a final target cleaning process.
in step S330, when the number of candidate cleaning processes is plural, the process score of each candidate cleaning process is newly determined, and the target cleaning process is determined according to the newly determined process scores of the candidate cleaning processes.
the process score may be specifically determined according to the process information and the memory information of the candidate cleaning process. Since it is independent of the total memory of the system, the memory parameters can be fixed so that they remain unchanged. The unchanged state here means that the memory parameters when the candidate cleaning process is re-determined are the same as the memory parameters when the process to be cleaned is determined. For example, if the process score is the highest for the process 1 to be cleaned and the process 2 to be cleaned, and the memory parameter when calculating the process scores of the process 1 to be cleaned and the process 2 to be cleaned is 512, the process 1 to be cleaned and the process 2 to be cleaned are taken as candidate cleaning processes, and the memory parameter when calculating the process scores is also 512. Only the weights in equation (1) need to be adjusted.
similarly, the process information of the candidate cleaning process may include, but is not limited to, priority information, which may be specifically denoted by adj; the process information may also include a process type, which may be used to determine and adjust the importance of the priority information, and the importance of the priority information may be represented by a weight of the priority information. For example, the priority information corresponding to process type 1 has a weight of 1, the priority information corresponding to process type 2 has a weight of 1.5, and so on. It should be noted that the importance of the process type may be positively or negatively correlated with the weight of the priority information, and the positive correlation is taken as an example for description herein. The memory information may include, but is not limited to, an occupied memory of the candidate cleaning process, which may be specifically represented by process _ total _ size, and may be a memory occupied size of a page (4k) process. The memory information may further include a range of memory occupied by the candidate cleaning process, where the range of memory occupied may be used to measure an importance degree of the memory information, the importance degree of the memory information may be represented by a weight of the memory information, and the degree of memory occupied may be positively or negatively related to the importance degree of the memory information, which is described here by taking negative correlation as an example. For example, the weight of the memory information corresponding to the range 1 occupying the memory is 1.5, and the weight of the memory information corresponding to the range 2 occupying the memory is 1.
in this case, the process score of the candidate cleaning process may be calculated as shown in equation (2):
points ═ a × adj + B × process _ total _ size/C equation (2)
After the process scores of the candidate cleaning processes are obtained, the target cleaning process can still be determined according to the ranking order of the process scores of the candidate cleaning processes. For example, the candidate cleaning process in which the process score is highest is determined as the target cleaning process. If a target cleaning process cannot be determined, steps S310 to S330 in fig. 3 may be continued until a target cleaning process is determined.
for example, if the process scores of the to-be-cleaned process 3 and the to-be-cleaned process 4 calculated by the formula (1) are the same and are the maximum values, the to-be-cleaned process 3 may be used as the candidate cleaning process 3, and the to-be-cleaned process 4 may be used as the candidate cleaning process 4. The process scores of candidate cleaning process 3 and candidate cleaning process 4 are further recalculated. If the type of the process 3 to be cleaned is a foreground process, the weight a of the priority information in the formula (2) may be adjusted to, for example, 1.5; if the range of the occupied memory of the process 3 to be cleaned is the range 1, the weight B of the memory information in the formula (2) may be adjusted to be, for example, 0.5. Thus, when the priority adj of the candidate cleaning process 3 is 906, the occupied memory is 100MB, and if the memory parameter C is 512, the process score of the candidate cleaning process 3 calculated by the formula (2) is 704.5; if the priority adj of the candidate cleaning process 4 is 100, the occupied memory is 2GB, and if the memory parameter C is 512, the process score of the candidate cleaning process 4 calculated by the formula (2) is 1324.8. The candidate cleaning process 4 may be used as the target cleaning process at this time. If a target cleaning process cannot be determined, steps S310 to S330 in fig. 3 may be continued until a target cleaning process is determined.
According to the technical scheme in the figure 3, different modes are selected according to the number of the candidate cleaning processes, when the number of the candidate cleaning processes is multiple, the most appropriate and accurate target cleaning process can be determined from the multiple candidate cleaning processes, the process information and the memory information of the processes can be combined according to different conditions, the target cleaning process can be rapidly and accurately determined according to multiple dimensions such as the memory information of a system and the like, the problem that long-time waiting is needed when the process to be cleaned is determined according to the priority and the occupied memory under the same priority is solved, the limitation is large, the target cleaning process is determined according to the process score of the process to be cleaned, and the accuracy of determining the process and the effectiveness of operation are improved.
In addition, when the number of the obtained candidate cleaning processes is multiple, the target cleaning process can be determined in a preset mode, wherein the preset mode can be at least one of the following modes: taking the candidate cleaning process occupying the largest memory as the target cleaning process; taking one of the candidate cleaning processes with the least historical cleaning times as the target cleaning process; and taking the candidate cleaning process with the running time larger than the time threshold value as the target cleaning process.
in the embodiment of the present disclosure, for example, if there are multiple candidate cleaning processes, such as candidate cleaning process 5, candidate cleaning process 6, and candidate cleaning process 7, and the memory occupied by candidate cleaning process 6 is the largest, then candidate cleaning process 6 may be used as the target cleaning process.
for each process in the system, a corresponding end information tag may be configured for each process in advance, and the end information tag may include the historical cleaning times of the process; or the historical cleaning times of each process are determined by cleaning the log by the process. If there are a plurality of candidate cleaning processes (candidate cleaning process 5, candidate cleaning process 6, candidate cleaning process 7) and the number of historical cleaning times of the candidate cleaning process 7 is the smallest, the candidate cleaning process 7 may be regarded as the target cleaning process.
In addition, the target cleaning process may be performed with a running time that is too long, for example, greater than a time threshold. The time threshold may be set to a larger value, such as 48 hours, according to actual needs, and is not limited herein.
The above three manners for determining the target cleaning process may be used alone or in combination, and are not limited herein. Of course, the manner of determining the target cleaning process according to other strategies (such as cleaning duration, etc.) is also within the scope of the embodiments of the present disclosure, and is not limited herein.
On this basis, in the present exemplary embodiment, if the target cleaning process is determined, the ending operation may be performed on the determined target cleaning process through the low memory management service. Ending operation here refers to stopping or shutting down the targeted cleaning process so that it is no longer running. After the target cleaning process is finished, the memory space occupied by the target cleaning process can be released, so that the situation of system memory shortage can be quickly relieved.
fig. 4 shows a memory optimization apparatus in the embodiment of the present disclosure, and referring to fig. 4, the memory optimization apparatus mainly includes a process determining module 401, an evaluation result determining module 402, and a process ending module 403, where:
A process determining module 401, configured to trigger, in response to an activation instruction for a low memory management service, a low memory management service to acquire multiple processes to be cleaned in a system;
an evaluation result determining module 402, configured to obtain evaluation results of the multiple processes to be cleaned;
A process ending module 403, configured to determine a target cleaning process from the multiple processes to be cleaned according to the evaluation result, and perform an ending operation on the target cleaning process.
In an exemplary embodiment of the present disclosure, the evaluation result includes a process score, and the evaluation result determination module includes: and the process score determining module is used for determining the process score of the process to be cleaned according to the process information, the memory information and the system memory information of the process to be cleaned.
In an exemplary embodiment of the disclosure, the process score determination module is configured to: and determining the process score of the process to be cleaned according to the priority information of the process to be cleaned, the occupied memory of the process to be cleaned and the total memory of the system.
In an exemplary embodiment of the disclosure, the process ending module includes: and the target determining module is used for determining candidate cleaning processes from the plurality of processes to be cleaned according to the arrangement sequence of the process scores and determining the target cleaning process according to the candidate cleaning processes.
In an exemplary embodiment of the present disclosure, the goal determining module includes: and the candidate process determining module is used for determining the process to be cleaned with the highest process score as the candidate cleaning process.
In an exemplary embodiment of the disclosure, the candidate cleaning process is one, and the targeting module includes: a first determining module, configured to use the candidate cleaning process as the target cleaning process.
In an exemplary embodiment of the disclosure, the candidate cleaning processes are plural, and the targeting module includes: the score re-determination module is used for re-determining the process score of the candidate cleaning process according to the process information and the memory information of the candidate cleaning process; a second determining module, configured to determine the target cleaning process according to the ranking order of the process scores of the candidate cleaning processes.
it should be noted that the specific details of each module in the memory optimization device have been described in detail in the corresponding memory optimization method, and therefore are not described herein again.
It should be noted that although in the above detailed description several modules or units of the 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, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, although the steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
In the embodiment of the disclosure, an electronic device capable of implementing the method is also provided.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 500 according to this embodiment of the disclosure is described below with reference to fig. 5. The electronic device 500 shown in fig. 5 is only an example and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
as shown in fig. 5, the electronic device 500 is embodied in the form of a general purpose computing device. The components of the electronic device 500 may include, but are not limited to: the at least one processing unit 510, the at least one memory unit 520, and the bus 550 that couples the various system components including the memory unit 520 and the processing unit 510.
wherein the storage unit stores program code that is executable by the processing unit 510 to cause the processing unit 510 to perform steps according to various exemplary embodiments of the present disclosure as described in the above section "exemplary methods" of this specification. For example, the processing unit 510 may perform the steps as shown in fig. 1.
The memory unit 520 may include a readable medium in the form of a volatile memory unit, such as a random access memory unit (RAM)5201 and/or a cache memory unit 5202, and may further include a read only memory unit (ROM) 5203.
Storage unit 520 may also include a program/utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 530 may be one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, a graphics acceleration interface, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 500 may also communicate with one or more external devices 600 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 500, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 500 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 550. Also, the electronic device 500 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 560. As shown, the network adapter 560 communicates with the other modules of the electronic device 500 over the bus 530. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
in an embodiment of the present disclosure, a computer-readable storage medium is further provided, on which a program product capable of implementing the above-mentioned method of the present specification is stored. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the "exemplary methods" section above of this specification, when the program product is run on the terminal device.
According to the program product for implementing the above method of the embodiments of the present disclosure, it may employ a portable compact disc read only memory (CD-ROM) and include program codes, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a 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.
the program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or 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.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a 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 readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
furthermore, the above-described figures are merely schematic illustrations of processes included in methods according to embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple 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 variations, 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.

Claims (10)

1. A method for optimizing a memory, comprising:
Responding to an activation instruction of a low memory management service, and triggering the low memory management service to acquire a plurality of processes to be cleaned in a system;
Obtaining evaluation results of the processes to be cleaned;
and determining a target cleaning process from the plurality of processes to be cleaned according to the evaluation result, and executing an ending operation on the target cleaning process.
2. The memory optimization method according to claim 1, wherein the evaluation result comprises a process score, and the obtaining the evaluation result of the process to be cleaned comprises:
And determining the process score of the process to be cleaned according to the process information, the memory information and the system memory information of the process to be cleaned.
3. the memory optimization method according to claim 2, wherein determining the process score of the process to be cleaned according to the process information, the memory information of the process to be cleaned and the memory information of the system comprises:
and determining the process score of the process to be cleaned according to the priority information of the process to be cleaned, the occupied memory of the process to be cleaned and the total memory of the system.
4. the memory optimization method of claim 2, wherein determining a target cleaning process from the plurality of processes to be cleaned according to the evaluation result comprises:
and determining candidate cleaning processes from the plurality of processes to be cleaned according to the arrangement sequence of the process scores, and determining the target cleaning process according to the candidate cleaning processes.
5. the memory optimization method of claim 4, wherein determining candidate cleaning processes from the plurality of processes to be cleaned according to the ranking order of the process scores comprises:
And determining the process to be cleaned with the highest process score as the candidate cleaning process.
6. The memory optimization method according to claim 4, wherein the number of the candidate cleaning processes is one, and determining the target cleaning process according to the candidate cleaning process comprises:
And taking the candidate cleaning process as the target cleaning process.
7. The memory optimization method according to claim 4, wherein the number of the candidate cleaning processes is multiple, and determining the target cleaning process according to the candidate cleaning processes comprises:
Re-determining the process score of the candidate cleaning process according to the process information and the memory information of the candidate cleaning process;
And determining the target cleaning process according to the ranking sequence of the process scores of the candidate cleaning processes.
8. A memory optimization device, comprising:
the system comprises a process determining module, a processing module and a processing module, wherein the process determining module is used for responding to an activating instruction of low memory management service and triggering the low memory management service to acquire a plurality of processes to be cleaned in the system;
The evaluation result determining module is used for acquiring evaluation results of the processes to be cleaned;
And the process ending module is used for determining a target cleaning process from the plurality of processes to be cleaned according to the evaluation result and executing ending operation on the target cleaning process.
9. an electronic device, comprising:
A processor; and
a memory for storing executable instructions of the processor;
Wherein the processor is configured to perform the memory optimization method of any one of claims 1-7 via execution of the executable instructions.
10. a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the memory optimization method of any one of claims 1 to 7.
CN201910797782.9A 2019-08-27 2019-08-27 Memory optimization method and device, electronic equipment and storage medium Pending CN110543431A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910797782.9A CN110543431A (en) 2019-08-27 2019-08-27 Memory optimization method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910797782.9A CN110543431A (en) 2019-08-27 2019-08-27 Memory optimization method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110543431A true CN110543431A (en) 2019-12-06

Family

ID=68710669

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910797782.9A Pending CN110543431A (en) 2019-08-27 2019-08-27 Memory optimization method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110543431A (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130054895A1 (en) * 2011-08-23 2013-02-28 Vmware, Inc. Cooperative memory resource management for virtualized computing devices
CN102984580A (en) * 2012-11-12 2013-03-20 北京奇虎科技有限公司 Internal storage cleaning method and system
CN103544063A (en) * 2013-09-30 2014-01-29 三星电子(中国)研发中心 Method and device for removing processes applied to Android platform
CN104298549A (en) * 2014-09-30 2015-01-21 北京金山安全软件有限公司 Method and device for cleaning application programs in mobile terminal and mobile terminal
CN105893066A (en) * 2014-12-19 2016-08-24 上海涌杰信息科技有限公司 Android system based mobile terminal recovery control method
US20160371194A1 (en) * 2015-06-19 2016-12-22 Sap Se Numa-aware memory allocation
CN106354562A (en) * 2016-08-25 2017-01-25 上海传英信息技术有限公司 Memory cleaning system and memory cleaning method
CN107133097A (en) * 2017-04-16 2017-09-05 努比亚技术有限公司 Memory Optimize Method and device
CN107220076A (en) * 2016-09-27 2017-09-29 华为技术有限公司 A kind of method for recovering internal storage and device
CN107450985A (en) * 2017-07-27 2017-12-08 北京珠穆朗玛移动通信有限公司 EMS memory management process, mobile terminal and storage medium
CN109117263A (en) * 2017-06-23 2019-01-01 中兴通讯股份有限公司 A kind of method and device of user terminal memory release

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130054895A1 (en) * 2011-08-23 2013-02-28 Vmware, Inc. Cooperative memory resource management for virtualized computing devices
CN102984580A (en) * 2012-11-12 2013-03-20 北京奇虎科技有限公司 Internal storage cleaning method and system
CN103544063A (en) * 2013-09-30 2014-01-29 三星电子(中国)研发中心 Method and device for removing processes applied to Android platform
CN104298549A (en) * 2014-09-30 2015-01-21 北京金山安全软件有限公司 Method and device for cleaning application programs in mobile terminal and mobile terminal
CN105893066A (en) * 2014-12-19 2016-08-24 上海涌杰信息科技有限公司 Android system based mobile terminal recovery control method
US20160371194A1 (en) * 2015-06-19 2016-12-22 Sap Se Numa-aware memory allocation
CN106354562A (en) * 2016-08-25 2017-01-25 上海传英信息技术有限公司 Memory cleaning system and memory cleaning method
CN107220076A (en) * 2016-09-27 2017-09-29 华为技术有限公司 A kind of method for recovering internal storage and device
CN107133097A (en) * 2017-04-16 2017-09-05 努比亚技术有限公司 Memory Optimize Method and device
CN109117263A (en) * 2017-06-23 2019-01-01 中兴通讯股份有限公司 A kind of method and device of user terminal memory release
CN107450985A (en) * 2017-07-27 2017-12-08 北京珠穆朗玛移动通信有限公司 EMS memory management process, mobile terminal and storage medium

Similar Documents

Publication Publication Date Title
KR102245025B1 (en) Memory return method and device
EP3508974B1 (en) Method and terminal for allocating system resource to application
US9250958B2 (en) System, method, and apparatus for improving application-launch latencies
US20180307600A1 (en) Memory reclaim method and apparatus
CN109857556B (en) Memory recovery method and device, storage medium and electronic equipment
US9971548B1 (en) Storage resource management employing performance analytics
JP7004902B2 (en) Performance evaluation program and performance evaluation method
CN110532197B (en) Memory recovery method and device, electronic equipment and storage medium
CN107239339B (en) System performance optimization parameter determination method, system performance optimization method and device
EP3502878B1 (en) Method for preloading application and terminal device
KR20130127445A (en) Application lifetime management
CN109308220B (en) Shared resource allocation method and device
US20170063622A1 (en) Information processing apparatus, computer-readable recording medium, and information processing system
Vimal et al. A memory management scheme for enhancing performance of applications on Android
CN110866590A (en) Data processing method and device, electronic equipment and storage medium
CN107704317A (en) Smart machine and its application management method and the device with store function
CN112667170B (en) Spark data caching method for sliding window data analysis
CN110543431A (en) Memory optimization method and device, electronic equipment and storage medium
CN110532095B (en) Memory optimization method and device, electronic equipment and storage medium
CN110750346B (en) Task operation optimization method, device, terminal and storage medium
JP2019021070A (en) Information processor, information processing method, and program
CN110704614A (en) Information processing method and device for predicting user group type in application
CN116185636A (en) Memory management method, device, equipment and storage medium
EP4354293A1 (en) Detection method and apparatus, and electronic device
CN107589907B (en) Data processing method, electronic device and computer readable 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20191206