CN110543365A - Memory optimization method and device, computer readable medium and electronic device - Google Patents

Memory optimization method and device, computer readable medium and electronic device Download PDF

Info

Publication number
CN110543365A
CN110543365A CN201910770583.9A CN201910770583A CN110543365A CN 110543365 A CN110543365 A CN 110543365A CN 201910770583 A CN201910770583 A CN 201910770583A CN 110543365 A CN110543365 A CN 110543365A
Authority
CN
China
Prior art keywords
cleaned
preset
cleaning
memory
evaluation result
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.)
Granted
Application number
CN201910770583.9A
Other languages
Chinese (zh)
Other versions
CN110543365B (en
Inventor
周华材
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201910770583.9A priority Critical patent/CN110543365B/en
Publication of CN110543365A publication Critical patent/CN110543365A/en
Application granted granted Critical
Publication of CN110543365B publication Critical patent/CN110543365B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy 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 device, a computer-readable medium, and an electronic device. The method comprises the following steps: activating a low memory management service in response to a trigger instruction of a system so that the low memory management service acquires a process to be cleaned according to a preset rule; reading an end information tag of the process to be cleaned; wherein the end information tag includes: clearing the frequency marks and the corresponding time marks; evaluating whether the process to be cleaned meets a preset cleaning condition or not according to the cleaning frequency mark and the corresponding time mark; when the evaluation result meets the preset cleaning condition, executing neglecting operation on the process to be cleaned; or when the evaluation result does not meet the preset cleaning condition, executing ending operation on the process to be cleaned. The method and the device can identify the frequently cleaned process in a short time, and improve the condition that the memory cannot be released.

Description

memory optimization method and device, computer readable medium and electronic device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a memory optimization method, a memory optimization device, 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 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, when the memory is lower than a preset memory threshold value, a low memory management (low memory killer) mechanism can be used for cleaning the process and releasing the memory, so that the system is prevented from being stuck or even being halted and restarted due to insufficient memory.
In the prior art, when a low memory killer mechanism is used to clean a process, the process is created and works again due to the fact that a system needs to use the process in the current application scenario after the process is killed. Especially for part of background service processes, the situation that the shortage of the system memory cannot be really alleviated in practice is caused.
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 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 a memory.
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 a first aspect of the present disclosure, there is provided a memory optimization method, including:
Activating a low memory management service in response to a trigger instruction of a system so that the low memory management service acquires a process to be cleaned according to a preset rule;
Reading an end information tag of the process to be cleaned; wherein the end information tag includes: clearing the frequency marks and the corresponding time marks;
Evaluating whether the process to be cleaned meets a preset cleaning condition or not according to the cleaning frequency mark and the corresponding time mark;
When the evaluation result meets the preset cleaning condition, executing neglecting operation on the process to be cleaned; or
and when the evaluation result does not meet the preset cleaning condition, executing ending operation on the process to be cleaned.
according to a second aspect of the present disclosure, there is provided an augmented reality device-based indoor positioning system, comprising:
the service activation module is used for activating the low memory management service in response to a trigger instruction of the system 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 ending information tag of the process to be cleaned; wherein the end information tag includes: clearing the frequency marks and the corresponding time marks;
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 neglected process execution module is used for executing the neglected operation on the process to be cleaned when the evaluation result meets the preset cleaning condition; or
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;
a storage device 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 described above.
In the memory optimization method provided by the embodiment of the disclosure, after the processes to be cleaned are selected by using the low memory management service, the processes to be cleaned can 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 met, the processes to be cleaned are ignored, and the problem that the processes cannot really release the storage space due to re-establishment after the processes are finished is avoided. And the system can clean other terminable 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 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 exemplary embodiment of the present disclosure;
FIG. 2 is a flow diagram schematically illustrating a method of evaluating a process to be cleaned in an exemplary embodiment of the disclosure;
FIG. 3 is a flow chart schematically illustrating another method for evaluating a process to be cleaned in an exemplary embodiment of the present disclosure;
Fig. 4 is a schematic diagram illustrating a composition of a memory optimization device according to an exemplary embodiment of the disclosure;
Fig. 5 schematically illustrates a structural diagram of a computer system of an electronic device in an exemplary 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.
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 kernel of the existing Android system adopts a low memory killer (low memory management service) mechanism to clear the process to release the memory when the system memory is in shortage, so as to alleviate 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 equal priority. However, some processes are processes required by the use of the scene at that time, and the processes may be quickly re-established and work 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 operations are repeated several times, it is likely that the system will crash or restart due to insufficient memory.
In view of the above disadvantages and shortcomings of the prior art, the present exemplary embodiment provides a memory optimization method, which can be applied to an intelligent terminal device using an Android system, such as a mobile phone and a tablet computer. Referring to fig. 1, the memory method may include the following steps:
s11, activating a low memory management service in response to a trigger instruction of the system, so that the low memory management service acquires a process to be cleaned according to a preset rule;
s12, reading the ending information label of the process to be cleaned; wherein the end information tag includes: clearing the frequency marks and the corresponding time marks;
S13, evaluating whether the process to be cleaned meets the preset cleaning condition according to the cleaning frequency mark and the corresponding time mark;
S14, when the evaluation result does not meet the preset cleaning condition, executing ending operation on the process to be cleaned;
And S15, when the evaluation result does not meet the preset cleaning condition, executing ending operation on the process to be cleaned.
In the memory optimization method provided in this example embodiment, after a low memory manager (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 the process to be cleaned is ignored when a preset cleaning condition is satisfied. On one hand, the problem that the process is established again after being ended and the storage space cannot be really released can be effectively avoided. In another aspect, the system can clear other processes which can be finished after ignoring the process to be cleared, and further effectively release the storage space.
hereinafter, each step of the memory optimization method in this exemplary embodiment will be described in more detail with reference to the drawings and the embodiments.
Step S11, activating a low memory management service in response to a trigger instruction of the system, so that the low memory management service acquires 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 idle physical memory at irregular intervals. For example, when a new application is started, memory space needs to be allocated to the application, and the currently free memory space may be queried. If the current free memory space is lower than the preset warning value, a memory recovery procedure can be triggered and activated, for example, memory normalization is performed, or the memory is directly recovered. Of course, the system may perform a timing task, periodically detect the system idle memory, and trigger and activate the memory reclamation procedure when the system idle memory is lower than a preset warning value. The relevant content of memory recovery can be realized by using the prior art scheme, and the details of the disclosure are not repeated.
After the system memory recovery is executed, if the idle memory is still lower than the preset warning value, a low memory manager (low memory management service) may be triggered. 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 program, the process of the application program still maintains its running state in the system in order to facilitate the restart of the program. 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. The decision as to which processes to kill can now be made by the Low Memory Killer mechanism.
Specifically, the Low Memory Killer mechanism determines whether to kill the process according to the priority of the process and the size of the occupied Memory. Generally, the Android system provides the following classes of processes: foreground process (foreground App), visible process (visible App), Secondary service (Secondary Server), background process (background App), Content Provider (Content Provider), and null process (Empty App). The priority of each process is from high to low in sequence. When the Android system kills the processes by using a Low Memory Killer mechanism, the processes are generally selected from Low to high according to the priority of each process, and the process with the largest Memory occupation is selected to be killed under the condition of equal priority. And the processes of each type are pre-configured with corresponding memory warning values. The Low Memory Killer mechanism can complete the determination of the process to be cleaned by using the existing rules, and the specific process can be completed by using the prior art, which is not described in detail in the disclosure.
Step S12, reading the ending information label of the process to be cleaned; wherein the end information tag includes: the frequency stamp and the corresponding time stamp are cleaned.
In this exemplary embodiment, 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 number of times that the process is cleaned and a timestamp of each cleaning. For example, for the content provider XX process, its end information tag may include: cleaning frequency: 1, cleaning time: xx years xx month xx days, 16: 42: 56: 110; cleaning frequency: 2, cleaning time: xx years xx month xx days 17: 01: 12: 001.
And step S13, evaluating whether the process to be cleaned meets the preset cleaning condition according to the cleaning frequency mark and the corresponding time mark.
in this exemplary 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, as shown with reference to fig. 2, the following steps may be included:
step S1311, reading the cleaning frequency mark and judging whether the cleaning frequency mark is larger than or equal to a first threshold value;
step S1312, when the cleaning frequency marker is larger than a first threshold value, acquiring time markers corresponding to n continuous cleaning frequency markers to determine cleaning duration;
Step S1313, when the cleaning duration is smaller than or equal to a second threshold value, determining that the evaluation result of the process to be cleaned meets a preset cleaning condition; or
Step S1314, when the cleaning duration is greater than the second threshold, determining that the evaluation result of the process to be cleaned does not satisfy a preset cleaning condition.
for example, the to-be-cleaned process is a null process B, and the end information tag thereof may include: cleaning frequency: 1, cleaning time: xx years xx month xx days, 16: 42: 56: 001; cleaning frequency: 2, cleaning time: xx years xx month xx days, 16: 42: 56: 200 of a carrier; cleaning frequency: 3, cleaning time: xx years xx month xx days, 16: 42: 56: 450. if the preset first threshold value is 3, it is determined that the process to be cleaned is larger than the first threshold value. At this point, the specific cleaning duration can be calculated from the three time stamps, which is 450 ms. If the second threshold is 500 milliseconds, the second threshold is judged to be smaller than the second threshold, and the process to be cleaned meets the preset cleaning condition. Namely, the process to be cleaned is continuously cleaned for a plurality of times within a short time window, the previous process is continuously cleaned for three times, the fourth cleaning is performed at this time, and it is determined that the process to be cleaned currently meets the preset cleaning condition.
Or, if the process to be cleaned is the empty process C and the ending information tag only contains data of one or two cleaning frequencies, directly determining that the corresponding evaluation result does not satisfy the preset cleaning condition, and still executing the ending operation on the empty process C.
or, if the end information tag of the empty process C to be cleaned contains data of three cleaning frequencies, but the cleaning duration is calculated to be greater than the second threshold, it is determined that the corresponding evaluation result does not satisfy the preset cleaning condition, and the end operation is still performed on the empty process C.
Alternatively, in other exemplary embodiments of the present disclosure, whether a preset cleaning condition is satisfied may also be determined by calculating a cleaning frequency. Specifically, as shown with reference 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, determining that the evaluation result of the process to be cleaned satisfies a preset cleaning condition when the cleaning frequency is less than or equal to a third threshold value; or
Step S1323, 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.
For example, the cleaning frequency may be calculated from the number of times of cleaning and the cleaning time period. In the above embodiment, the number of times of cleaning the null process B is 3, and the cleaning duration is 450 ms, so the cleaning frequency is 450/3, which is 150 ms/time. If the preset third threshold value is 200 milliseconds, the empty process B is judged to meet the preset cleaning condition, which indicates that the empty process B can be cleaned once in a short time.
Of course, in other exemplary embodiments of the present disclosure, the first threshold value and the second threshold value may also 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 limited thereto.
And step S14, when the evaluation result meets the preset cleaning condition, executing an ignoring operation on the process to be cleaned.
In this exemplary embodiment, when the evaluation result corresponding to the process to be cleaned satisfies the preset cleaning condition, the ignoring 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, the ignoring operation is performed thereon, that is, the process is not killed any more. Then, in order to meet the requirement of the system for free storage space, the low memory management service can select other processes according to a preset rule and kill the processes, so as to release the memory space.
For example, the ignoring of the process to be cleaned may be achieved by modifying the priority information. Specifically, the method may include:
Configuring the priority information of the process to be cleaned as an ignoring priority; when a preset time period is reached, the neglected priority is modified into an 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, the original oom _ adj value for the background process to be cleaned is 7, and the modified oom _ adj value is 4. Therefore, 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 the priority of the process from being permanently modified and disturbing the normal execution strategy of the system.
Alternatively, in other exemplary embodiments of the present disclosure, the process to be cleaned may be ignored by setting a process list to be ignored. Specifically, the method may include:
Adding the process to be cleaned to a preset neglected process list; and when a preset time period is reached, clearing the process to be cleared from the neglected process list.
for example, an ignore process list 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 list of ignored processes after a period of time has elapsed. In the above list of the omitted processes, identification information of the processes, the time length of the timed task, the writing time, the deleting time, and the like may be included.
And after the low memory service selects the process to be cleaned, the list of the ignored process can be read first, and the process identifier is used for inquiring and judging whether the process to be cleaned is in the list of the ignored process. If the list is in the form, the ignore operation can be executed; if not, the subsequent judgment is continuously executed.
in addition, based on the above, when the ignoring operation is performed on the process to be cleaned, the corresponding end information tag may be cleared, so that when the ignoring operation of the process to be cleaned is ended, the process may be determined again by a normal policy.
And step S15, when the evaluation result does not meet the preset cleaning condition, executing ending operation on the process to be cleaned.
in this exemplary embodiment, if the evaluation result corresponding to the process to be cleaned does not satisfy the preset cleaning condition, it indicates that the process is not frequently cleaned within a short time window, and at this time, the normal process ending operation may be performed on the process, so as to release the memory space of the process.
Based on the above, in other exemplary embodiments of the present disclosure, a process information form may also be configured in advance for the system, and the end information tag corresponding to each process is stored in the process information form. The process information form may be stored in a designated target database.
When the end information tags of the processes to be cleaned are read, the corresponding end information tags can be inquired in the process information form by using 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 not cleaned, or the previous neglect operation is finished, the process to be cleaned is directly executed to finish the operation, and the process is saved.
In the method provided by the embodiment of the present disclosure, when a Low Memory manager (Low Memory management service) mechanism is activated to kill a process, the system may first select one or more processes to be cleaned according to a conventional rule, and then read and evaluate relevant information of each process to be cleaned, so as to determine whether a preset cleaning condition is satisfied. When the preset cleaning condition is met, the process is indicated to be killed for a plurality of times in a short time window, and the process is recreated, namely the process is used as necessary in the current application scene. At this point, an override operation may be performed on it, which no longer kills the process for a certain amount of time. And further, the low memory management service can select other processes according to the existing rule and kill the processes, so that the memory space is effectively released. The process which is cleaned recently and frequently is effectively identified, so that the condition 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 to be noted that the above-mentioned figures are only schematic illustrations of the processes involved in the method according to an exemplary embodiment of the invention, 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.
Further, referring to fig. 4, in the present exemplary embodiment, a memory optimization device 40 is further provided, which includes: 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 a system, so that the low memory management service acquires 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 stamp and the corresponding time stamp are cleaned.
The process evaluation module 403 may be configured to evaluate whether the process to be cleaned satisfies a preset cleaning condition according to the cleaning frequency flag and the corresponding time flag.
the ignore process executing module 404 may be configured to execute an ignore operation on the process to be cleared when the evaluation result satisfies a preset clearing condition.
The ending process executing module 405 may be configured to execute an ending operation on the process to be cleaned when the evaluation result does not satisfy the preset cleaning condition.
In an example of the present disclosure, the process tag reading module 402 may include: a process information form query unit (not shown).
The process information form query unit can be used for querying a corresponding end information tag 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 tag corresponding to the process.
In an 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 end operation on the process to be cleaned when the query result corresponding to the process information form is empty.
in an example of the present disclosure, the process evaluation module 403 may include: a cleaning frequency index reading unit, a cleaning duration obtaining unit, a first judging unit and a second judging 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 duration obtaining unit may be configured to obtain time stamps corresponding to n consecutive cleaning frequency stamps to determine the cleaning duration when the cleaning frequency stamp is greater than a first threshold; wherein n is a positive integer.
the first judging unit may be configured to determine that an evaluation result of the process to be cleaned satisfies a preset cleaning condition when the cleaning duration is less than or equal to a second threshold.
The second judging unit may be configured to determine that the evaluation result of the process to be cleaned does not satisfy a preset cleaning condition when the cleaning duration is greater than a second threshold.
In an example of the present disclosure, the process evaluation module 403 may include: the method can also comprise the following steps: 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 tag and the corresponding time tag.
The third judging unit may be configured to determine that an evaluation result of the process to be cleaned satisfies 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 satisfy a preset cleaning condition when the cleaning frequency is greater than a third threshold value.
In one example of the present disclosure, the ignore process executing module may include: a priority modification unit, a priority restoration 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 as an override priority.
The priority restoration unit may be configured to modify the ignoring 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 an example of the present disclosure, the ignore process executing module may further include: a process list processing unit and a process list restoring unit (not shown).
The list of ignored processes processing unit may be configured to add the process to be cleaned to a preset list of ignored processes.
The ignored process list restoring unit may be configured to clear the process to be cleaned from the ignored process list when a preset time period is reached.
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.
FIG. 5 illustrates a schematic structural diagram of a computer system suitable for use with the electronic device to implement 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 bring any limitation to the functions and the scope of the application of the embodiment of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that 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 (RAM) 503. In the RAM 503, various programs and data necessary for system operation are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via 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 portion 506 including a keyboard, a mouse, and the like; an output section 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, 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 driver 510 is also connected to the I/O interface 505 as necessary. 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 necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to an embodiment of the present invention, the processes described below with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the 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 illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program executes various functions defined in the system of the present application when executed by a Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the embodiment of the present invention may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer 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 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 (EPROM), a 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 present invention, 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, a computer readable signal medium may include a propagated data signal with computer 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 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 flowchart 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 described 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 disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
as another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method as described in the embodiments below. For example, the electronic device may implement the steps shown in fig. 1.
furthermore, the above-described figures are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the invention, 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.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is to be limited only by the terms of the appended claims.

Claims (10)

1. A method for optimizing a memory, comprising:
activating a low memory management service in response to a trigger instruction of a system so that the low memory management service acquires a process to be cleaned according to a preset rule;
Reading an end information tag of the process to be cleaned; wherein the end information tag includes: clearing the frequency marks and the corresponding time marks;
evaluating whether the process to be cleaned meets a preset cleaning condition or not according to the cleaning frequency mark and the corresponding time mark;
when the evaluation result meets the preset cleaning condition, executing neglecting operation on the process to be cleaned; or
And when the evaluation result does not meet the preset cleaning condition, executing ending operation on the process to be cleaned.
2. the method of claim 1, wherein 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 tag corresponding to the process.
3. The method of claim 2, further comprising:
and when the query result corresponding to the process information form of the process to be cleaned is empty, executing an ending operation on the process to be cleaned.
4. The method of claim 1, wherein the evaluating whether the progress to be cleaned satisfies a preset cleaning condition according to the cleaning frequency flag and the corresponding time flag comprises:
reading the cleaning frequency mark and judging whether the cleaning frequency mark is larger than or equal to a first threshold value;
When the cleaning frequency mark is larger than a first threshold value, acquiring time marks corresponding to n continuous cleaning frequency marks to determine cleaning duration; wherein n is a positive integer;
When the cleaning duration is less than or equal to a second threshold value, determining that the evaluation result of the process to be cleaned meets a preset cleaning condition; or
And when the cleaning duration is greater than a second threshold value, determining that the evaluation result of the process to be cleaned does not meet a preset cleaning condition.
5. The method of claim 1, wherein the evaluating whether the progress to be cleaned satisfies a preset cleaning condition according to the cleaning frequency flag and the corresponding time flag comprises:
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
And 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.
6. The method of claim 1, wherein the performing an ignore operation on the process to be cleaned comprises:
Configuring the priority information of the process to be cleaned as an ignoring priority; and
When a preset time period is reached, modifying the neglected priority into an original priority; wherein the level of the ignore priority is higher than the level of the original priority.
7. the method of claim 1, wherein the 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, clearing the process to be cleared from the neglected process list.
8. A memory optimization device, comprising:
the service activation module is used for activating the low memory management service in response to a trigger instruction of the system 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 ending information tag of the process to be cleaned; wherein the end information tag includes: clearing the frequency marks and the corresponding time marks;
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 neglected process execution module is used for executing the neglected operation on the process to be cleaned when the evaluation result meets the preset cleaning condition; or
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.
9. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the memory optimization method according to any one of claims 1 to 7.
10. 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 carry out the memory optimization method of any one of claims 1 to 7.
CN201910770583.9A 2019-08-20 2019-08-20 Memory optimization method and device, computer readable medium and electronic equipment Active CN110543365B (en)

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 true CN110543365A (en) 2019-12-06
CN110543365B 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022057863A1 (en) * 2020-09-21 2022-03-24 华为技术有限公司 Process control method and apparatus

Citations (7)

* Cited by examiner, † Cited by third party
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
US20160062700A1 (en) * 2014-09-01 2016-03-03 Fu Tai Hua Industry (Shenzhen) Co., Ltd. System, method for cleaning memory space and terminal device with memory space cleaning function
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

Patent Citations (7)

* Cited by examiner, † Cited by third party
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
US20160062700A1 (en) * 2014-09-01 2016-03-03 Fu Tai Hua Industry (Shenzhen) Co., Ltd. System, method for cleaning memory space and terminal device with memory space cleaning function
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 (2)

* Cited by examiner, † Cited by third party
Title
刘生平等: "桌面Linux内存管理算法改进", 《系统工程与电子技术》 *
刘生平等: "桌面Linux内存管理算法改进", 《系统工程与电子技术》, vol. 27, no. 03, 20 March 2005 (2005-03-20) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022057863A1 (en) * 2020-09-21 2022-03-24 华为技术有限公司 Process control method and apparatus
CN115836280A (en) * 2020-09-21 2023-03-21 华为技术有限公司 Method and device for process control

Also Published As

Publication number Publication date
CN110543365B (en) 2024-01-09

Similar Documents

Publication Publication Date Title
CN101334778A (en) Management database connecting method and system
CN103927266A (en) Improved Control Of Pre-fetch Flow
CN110445828B (en) Data distributed processing method based on Redis and related equipment thereof
CN107239339A (en) System function optimization parameter determination method, system function optimization method and device
CN110930291B (en) GPU video memory management control method and related device
US9875137B2 (en) Intelligent application back stack management
CN109800269A (en) Data managing method, device, computer equipment and storage medium
CN113806651B (en) Data caching method, device, server and storage medium
US20180315306A1 (en) Analyzing big data to manage traffic flow
CN110704097A (en) Data collection method and device, electronic equipment and storage medium
CN110018883A (en) A kind of virtual machine delet method, device, equipment and storage medium
CN107563736B (en) Switching method of native page and Web page and server
CN110543365A (en) Memory optimization method and device, computer readable medium and electronic device
CN112235474B (en) Method, device and equipment for scheduling prepaid flow code number
CN110377616A (en) A kind of data-erasure method, device, electronic equipment and storage medium
CN108632085B (en) Gray level user management method, device, platform and storage medium
CN107526690B (en) Method and device for clearing cache
CN113051005B (en) Loading method and device
CN106528162A (en) Target object display method and device, and electronic equipment
CN113360251B (en) Intelligent contract execution and cross-contract calling method, device and storage medium
CN111327771A (en) Method and device for identifying crank call number
CN116860427A (en) Resource recovery method and device
CN109062781A (en) A kind of message buffer management method and device
CN110532095B (en) Memory optimization method and device, electronic equipment and storage medium
CN109189664B (en) Information acquisition method and terminal for application program

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