Memory searching and killing method, device and equipment of terminal system and storage medium

By detecting available memory in the terminal system and checking and killing based on application memory threshold and priority information, the problem of high priority applications taking up memory is solved, the system performance and stability are improved, and the memory adequacy is ensured.

CN119149232APending Publication Date: 2024-12-17ECARX (HUBEI) TECHCO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411188745.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

The existing technology is difficult to effectively detect applications with high priority but large memory occupancy, resulting in a continuous decrease in the available memory of the system, resulting in system lag, instability and abnormal functions.

Method used

By detecting that the available memory of the terminal system is lower than the preset threshold, the first target detection application is determined based on the application memory threshold and memory occupied in the data set to be detected, and the second target detection is determined based on the application priority information if necessary. Kill the application to detect and deal with it.

Benefits of technology

It effectively solves the problem of high priority applications occupies memory, improves system performance and stability, ensures the adequacy of available memory, and avoids system lag and functional abnormalities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149232A_ABST
    Figure CN119149232A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the technical field of system memory searching and killing, and discloses a memory searching and killing method and device of a terminal system, equipment and a storage medium. The method comprises the steps of determining a first target searching and killing application and searching and killing the first target searching and killing application according to a preset application memory threshold value of each to-be-searched and killed application in a to-be-searched and killed data set and an occupied memory of each to-be-searched and killed application in the terminal system in response to detecting that an available memory of a terminal system is lower than a preset available memory threshold value, according to the method, the abnormal applications occupying large memory can be searched and killed first, the problem that the available memory of the system is continuously reduced due to the fact that the applications which are high in priority and occupy large memory cannot be searched and killed is solved, and then if the available memory is still lower than a preset available memory threshold after searching and killing processing, the application priority information is determined based on the application priority information. And determining the second target searching and killing application and searching and killing the second target searching and killing application, thereby ensuring the performance and stability of system operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of system memory detection and killing, and in particular to a memory detection and killing method, device, equipment and storage medium of a terminal system. Background Art

[0002] In Android-based terminal systems, memory resources are a resource that depends on memory hardware and has a fixed size. Therefore, there is a size bottleneck in its use, and applications running in the system cannot use memory without limit. In order to ensure that the memory is not used without limit by the system, the existing technology mainly determines whether the available memory of the system is lower than a certain threshold. If so, the application with the lowest priority is found and killed, thereby freeing up the memory occupied by the application.

[0003] However, if an application with a very high priority occupies a large amount of memory due to memory leaks or other reasons, it is difficult to detect and kill the application using the existing technology, thereby failing to solve problems such as system instability and system function abnormalities caused by the application occupying too much memory. Summary of the invention

[0004] In view of the above-mentioned defects or deficiencies in the prior art, the present application aims to provide a memory killing method, device, equipment and storage medium for a terminal system to solve the problem of continuous reduction of system available memory due to the inability to kill applications with high priority and large memory usage, thereby solving system freezes, instability, functional abnormalities and other phenomena, and improving system performance and stability.

[0005] The present application provides a method for detecting and killing memory in a terminal system, the method comprising:

[0006] In response to detecting that the available memory of the terminal system is lower than a preset available memory threshold, based on the preset application memory threshold of each application to be killed in the to-be-killed data set and the memory occupied by each of the to-be-killed applications in the terminal system, determining a first target application to be killed and performing a killing process on the first target application to be killed;

[0007] If the available memory after the killing process is lower than the preset available memory threshold, a second target killing application is determined based on the application priority information corresponding to the terminal system and the second target killing application is killed.

[0008] Optionally, the determining a first target application to be killed and performing a killing process on the first target application to be killed based on a preset application memory threshold of each application to be killed in the data set to be killed and the memory occupied by each application to be killed in the terminal system includes:

[0009] Using the first application to be killed in the data set to be killed as the current judgment application, wherein the data set to be killed includes each application to be killed and a preset application memory threshold of each application to be killed;

[0010] Determine whether the memory occupied by the currently determined application exceeds a preset application memory threshold of the currently determined application, and if so, determine the currently determined application as a first target killing application, and perform killing processing on the first target killing application;

[0011] Determine whether the available memory after the killing process is lower than the preset available memory threshold. If so, take the next application to be killed of the current application in the data set to be killed as the new current application to be killed, and return to the step of determining whether the occupied memory of the current application to be judged exceeds the preset application memory threshold of the current application to be judged, until the current application to be judged is the last application to be killed in the data set to be killed.

[0012] Optionally, based on the application priority information corresponding to the terminal system, determining a second target killing application and performing a killing process on the second target killing application includes:

[0013] Based on the application priority information corresponding to the terminal system, second target killing applications are determined in the terminal system in order of priority from low to high, and the second target killing applications are killed until the available memory is greater than the preset available memory threshold.

[0014] Optionally, before determining a first target application to be killed and performing a killing process on the first target application to be killed based on a preset application memory threshold of each application to be killed in the data set to be killed and the memory occupied by each application to be killed in the terminal system, the method further includes:

[0015] Determine the memory occupied by each application in the terminal system, and sort all applications in descending order of memory occupied;

[0016] Sending application related information of the top N applications in the sorting result to the server, so that the server determines each application to be detected and killed and a preset application memory threshold of each application to be detected and killed based on the application related information of the top N applications, and constructs a data set to be detected and killed;

[0017] Receive the to-be-checked data set fed back by the server.

[0018] Optionally, the method further includes:

[0019] A data set to be detected and killed is received from a server, wherein the data set to be detected and killed is determined by the server based on application related information sent by other terminal systems of the same type.

[0020] Optionally, before determining the second target killing application based on the application priority information corresponding to the terminal system and performing killing processing on the second target killing application, the method further includes:

[0021] Sending the memory occupied by each application in the terminal system after the killing process to the server, so that the server can reduce the preset application memory threshold of the application to be killed in the data set to be killed according to the memory occupied by each application, or replace the application to be killed in the data set to be killed and determine the corresponding preset application memory threshold;

[0022] Receive the updated set of to-be-checked data fed back by the server.

[0023] Optionally, after the first target killing application is killed, the method further includes:

[0024] Sending the memory occupied by each application in the terminal system after the killing process to the server, so that the server determines whether there is an application affected by the first target killing application according to the memory occupied by each application, and if so, updates the application to be killed in the data set to be killed and / or the preset application memory threshold of the application to be killed;

[0025] Receive the updated set of to-be-checked data fed back by the server.

[0026] The embodiment of the present application also provides a memory killing device of a terminal system, the device comprising:

[0027] A data set traversal killing module is used to, in response to detecting that the available memory of the terminal system is lower than a preset available memory threshold, determine a first target killing application based on a preset application memory threshold of each to-be-killed application in the to-be-killed data set and the memory occupied by each to-be-killed application in the terminal system, and perform a killing process on the first target killing application;

[0028] The priority killing module is used to determine a second target killing application and perform killing processing on the second target killing application based on the application priority information corresponding to the terminal system if the available memory after the killing processing is lower than the preset available memory threshold.

[0029] The present application also provides an electronic device, the electronic device comprising:

[0030] Processor and memory;

[0031] The processor is used to execute the steps of the memory killing method of the terminal system provided in any embodiment of the present application by calling the program or instruction stored in the memory.

[0032] An embodiment of the present application also provides a computer-readable storage medium, which stores a program or instruction, and the program or instruction enables a computer to execute the steps of the memory killing method of the terminal system provided by any embodiment of the present application.

[0033] In summary, the present application proposes a memory killing method for a terminal system. In response to detecting that the available memory of the terminal system is lower than a preset available memory threshold, the method determines a first target killing application according to the preset application memory threshold of each to-be-killed application in the to-be-killed data set and the memory occupied by each to-be-killed application in the terminal system, and performs a killing process on the first target killing application. Furthermore, if the available memory of the terminal system is still lower than the preset available memory threshold after the killing process, a second target killing application is determined based on application priority information and the second target killing application is killed. The method can be performed in the process of searching according to the application priority information. Before killing an application, first target the applications in the to-be-killed data set and kill some applications according to the memory occupied and the preset application memory threshold. This allows the system to first kill abnormal applications that occupy a large amount of memory, thereby solving the problem of continuous reduction in system available memory due to the inability to kill applications with high priority and large memory. After killing the first target application, if the available memory is still lower than the preset available memory threshold, continue to kill low-priority applications based on the application priority information, thereby further ensuring the adequacy of available memory, solving system freezes, instability, functional abnormalities and other phenomena, and improving system operation performance and stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0035] Figure 1 It is a flow chart of a memory killing method of a terminal system provided by an embodiment of the present application;

[0036] Figure 2 It is a schematic diagram of a processing process of a low memory management mechanism provided in an embodiment of the present application;

[0037] Figure 3 This is a schematic diagram of a system memory check and kill process provided by an embodiment of the present application;

[0038] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.

[0040] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0041] As mentioned in the background technology, in response to the problems in the prior art, this application proposes a memory killing method for a terminal system. The memory killing method for a terminal system is mainly applicable to terminal systems such as car computers and mobile phones. When the available memory in the terminal system is lower than the preset available memory threshold, some applications in the terminal system are killed by using the data set to be killed and the application priority information. The memory killing method for a terminal system provided in an embodiment of the present application can be executed by an electronic device integrated in the terminal system.

[0042] Figure 1 This is a flow chart of a terminal system memory killing method provided by an embodiment of the present application. Figure 1 , the memory killing method of the terminal system specifically includes:

[0043] S110. In response to detecting that the available memory of the terminal system is lower than a preset available memory threshold, based on the preset application memory threshold of each application to be killed in the to-be-killed data set and the memory occupied by each application to be killed in the terminal system, determine a first target application to be killed and perform a killing process on the first target application to be killed.

[0044] The terminal system includes but is not limited to systems in electronic devices such as car computers, mobile phones, and tablet computers. The preset available memory threshold can be a reserved memory pre-set for the terminal system to ensure that the terminal system is not used without restriction and to provide corresponding memory for applications that users expect to use in real time.

[0045] Exemplarily, the preset available memory threshold can be determined based on the total memory of the terminal system. For example, the preset available memory threshold can be determined in the total memory according to a certain proportion; or, the preset available memory threshold can be the threshold for triggering application killing in the LowMemory Killer (low memory management) mechanism in the terminal system (low_wmark, that is, the preset low memory indicating the need for application killing).

[0046] The main logic of the low memory management mechanism is: real-time monitoring of the available memory of the terminal system. When the available memory is lower than low_wmark, the priorities of all surviving processes in the system are traversed to kill processes with lower process priorities.

[0047] like Figure 2 As shown, Figure 2 This is a schematic diagram of the processing process of a low memory management mechanism provided in an embodiment of the present application. First, in response to detecting that the system is turned on and running, the low memory management mechanism can be initialized, and then during the operation of the terminal system, it is determined whether the system available memory is less than low_wmark. If not, it continues to return to the judgment. If so, the low memory management mechanism kills lower priority applications, thereby terminating the entire process.

[0048] In an embodiment of the present application, the available memory of the terminal system can be determined in real time through the low memory management mechanism in the terminal system. If it is detected that the available memory of the terminal system is lower than the preset available memory threshold, it means that the terminal system needs to perform application killing to free up a certain amount of memory for use by applications subsequently launched by other users.

[0049] Specifically, when the available memory is lower than the preset available memory threshold, the embodiment of the present application can be divided into two rounds of killing. The first round of killing can be based on the data set to be killed to kill some applications. If the available memory of the terminal system is still lower than the preset available memory threshold after the first round of killing, the second round of killing can be continued. The second round of killing can be based on the application priority information to kill some applications. Among them, the first round of killing can first kill some applications through the preset application memory threshold of each application to be killed in the data set to be killed, and the memory occupied by each application to be killed in the terminal system.

[0050] The data set to be killed may be composed of each application to be killed and a preset application memory threshold of each application to be killed. For example, each application to be killed and a preset application memory threshold of each application to be killed may be combined through specific rules to construct a data set to be killed, for example: process1, x1; process2, x2; process3, x3; ...

[0051] Specifically, the application to be checked and killed may be an application that occupies a large amount of memory and is to be determined as to whether it needs to be checked and killed; the preset application memory threshold may be a pre-set memory allowed to be occupied by the application to be checked and killed. If the memory occupied by the application to be checked and killed exceeds the threshold, it indicates that the memory occupied by the application to be checked and killed is abnormal, which may be due to problems such as memory leakage or application operation failure. At this time, the application to be checked and killed will have a significant impact or hidden danger on the stability and performance of the terminal system, and can be checked and killed.

[0052] In an embodiment of the present application, the set of data to be detected and killed can be issued by the server. For example, when the available memory is lower than a preset available memory threshold, the terminal system can send real-time application-related information to the server, so that the server generates and issues the corresponding set of data to be detected and killed.

[0053] In a specific implementation, before determining the first target killing application and performing killing processing on the first target killing application based on the preset application memory threshold of each application to be killed in the data set to be killed and the memory occupied by each application to be killed in the terminal system, the following steps are also included:

[0054] Step 1: determine the memory occupied by each application in the terminal system, and sort all applications in descending order of the memory occupied;

[0055] Step 2: Send the application related information of the top N applications in the sorting result to the server, so that the server determines each application to be detected and killed and the preset application memory threshold of each application to be detected and killed based on the application related information of the top N applications, and constructs a data set to be detected and killed;

[0056] Step 3: Receive the to-be-checked data set fed back by the server.

[0057] When it is detected that the available memory of the terminal system is lower than the preset available memory threshold, all applications can be sorted in descending order of the memory occupied in the terminal system, and the application-related information of the top N applications is sent to the server. The application-related information includes application type, application attribute data, and occupied memory.

[0058] Furthermore, after receiving the application-related information of the top N applications, the server can directly select some applications that occupy large memory as the applications to be killed according to the memory occupied by the top N applications, and determine the preset application memory threshold of the applications to be killed according to the application type and application attribute data. Where N is an integer greater than 0, for example, N can be set to 10.

[0059] Alternatively, after receiving the application-related information of the top N applications, the server can use machine learning and other methods, such as a pre-built neural network model, with the goal of using applications that occupy a large amount of memory and can be safely cleaned, combined with the application-related information to select the application to be killed, and determine the preset application memory threshold of the application to be killed. Among them, whether the application can be safely cleaned can be determined by simulating the application running and simulating the application being killed, and then judging whether the application can be safely cleaned according to the operating status of the system after the killing. For example, if the operating status of the system is normal and the memory is released normally, it can be determined that the application can be safely cleaned. The preset application memory threshold of the application to be killed can be determined in combination with the occupied memory sent by other terminal systems for the application to be killed.

[0060] After determining the data set to be detected and killed, the server can feed back the data set to be detected and killed to the terminal system, and use the data set to be detected and killed to update the memory recovery application data set set in the server for the system type corresponding to the terminal system. Among them, each system type corresponds to a memory recovery application data set, and the content of the memory recovery application data set is empty by default. The content stored in it can be sent to each terminal system of the corresponding system type as the data set to be detected and killed.

[0061] Through the above steps 1 to 3, when it is detected that the available memory of the terminal system is lower than the preset available memory threshold, the application-related information of the top N applications occupying the memory can be sent to the server first, so that the server can generate and feedback the data set to be checked and killed, thereby realizing that the terminal system actively obtains the data set to be checked and killed when it is necessary to check and kill the memory, and the server generates the data set to be checked and killed in real time, making the data set to be checked and killed more targeted, and being able to ensure that the data set to be checked and killed can solve the problem of insufficient available memory of the terminal system as much as possible.

[0062] Considering that when it is detected that the available memory of the terminal system is lower than the preset available memory threshold, the application-related information is first sent to the server. This may cause the application-related information to fail to be sent due to abnormal operation of the terminal system or poor communication signals, thereby resulting in the inability to obtain the data set to be checked and killed. Therefore, in an embodiment of the present application, in addition to the terminal system actively obtaining the data set to be checked and killed from the server, the server can also actively send the data set to be checked and killed to each terminal system.

[0063] In another specific implementation, the method provided in the embodiment of the present application further includes:

[0064] The data set to be detected and killed is received from the server, wherein the data set to be detected and killed is determined by the server based on application related information sent by other terminal systems of the same type.

[0065] The server can determine the data set to be detected and killed based on the received application related information, and send it to all terminal systems of the same type as the sending application related information in real time. The process of the server determining the data set to be detected and killed can refer to the above description, which will not be repeated here.

[0066] That is, the terminal system can receive the data set to be detected and killed that is actively sent by the server, and the data set to be detected and killed can be determined by the server based on application-related information sent by other terminal systems of the same type. Through this implementation, the server can actively send the data set to be detected and killed. The server can actively send it to each terminal system when it detects that the data set to be detected and killed is generated or updated. For the terminal system that fails to successfully receive the data set to be detected and killed, the data set to be detected and killed can be repeatedly sent to the terminal system at a set period until the terminal system feedbacks that the data set to be detected and killed is successfully received. This implementation can avoid the situation where the data set to be detected and killed cannot be obtained in real time due to abnormal operation of the terminal system or poor communication signal, and further ensures the reliability of terminal system application detection and killing.

[0067] In the embodiment of the present application, based on the data set to be killed, the memory occupied by each application to be killed in the terminal system can be determined, and then all applications to be killed that occupy more than the corresponding preset application memory threshold are taken as the first target killing application and are killed. In addition, it is also possible to determine whether the applications to be killed need to be killed in turn according to the order of the applications to be killed in the data set to be killed, until the available memory of the terminal system exceeds the preset available memory threshold or the traversal is complete.

[0068] In a specific implementation, based on the preset application memory threshold of each application to be killed in the to-be-killed data set and the memory occupied by each application to be killed in the terminal system, determining a first target application to be killed and performing a killing process on the first target application to be killed includes the following steps:

[0069] Step 4: Use the first application to be detected and killed in the data set to be detected and killed as the current judgment application, wherein the data set to be detected and killed includes each application to be detected and killed and a preset application memory threshold of each application to be detected and killed;

[0070] Step 5: determine whether the memory occupied by the current judgment application exceeds the preset application memory threshold of the current judgment application. If so, determine the current judgment application as the first target killing application, and perform killing processing on the first target killing application;

[0071] Step 6, determine whether the available memory after the killing process is lower than the preset available memory threshold. If so, take the next application to be killed of the current application in the data set to be killed as the new current application to be killed, and return to execute the step of determining whether the occupied memory of the current application to be judged exceeds the preset application memory threshold of the current application to be judged, until the current application to be judged is the last application to be killed in the data set to be killed.

[0072] In the above step 1, the applications to be killed in the data set to be killed can be randomly arranged, or the applications to be killed in the data set to be killed can be arranged in descending order according to the preset application memory threshold. It should be noted that the advantage of arranging in descending order according to the preset application memory threshold is that applications that occupy more memory can be killed first, so as to release more system memory through one killing as much as possible, thereby improving the killing efficiency.

[0073] Specifically, in the above steps 4-5, the first application to be checked and killed in the data set to be checked and killed can be first used as the current judgment application, and it can be determined whether the memory occupied by the current judgment application exceeds the corresponding preset application memory threshold. If not, it means that the memory occupied by the current judgment application is normal and no processing is required. At this time, the next application to be checked and killed after the current judgment application in the data set to be checked and killed can be re-used as the new current judgment application, and return to execute step 5; if so, it means that the memory occupied by the current judgment application may be abnormal due to memory leakage or other reasons. At this time, the current judgment application can be used as the first target killing application, and the first target killing application can be checked and killed.

[0074] Furthermore, in step 6, it is necessary to continue to determine whether the available memory after the killing is still lower than the preset available memory threshold. If not, it means that the available memory of the terminal system has reached the standard at this time, and there is no need to perform application killing, and it can be ended directly.

[0075] If the available memory is still lower than the preset available memory threshold, it means that the system's available memory is still insufficient and it is necessary to continue to kill applications. At this time, the next application to be killed in the currently judged application in the to-be-killed data set can be re-selected as the new current judgment application, and return to execute step 5, that is, return to re-judge whether the memory occupied by the currently judged application exceeds the corresponding preset application memory threshold. If so, it will be killed as the first target killing application. If not, the next application to be killed will be selected as the new current judgment application, and this process will be repeated until the current judgment application is the last application to be killed in the to-be-killed data set.

[0076] Through the above steps 4 to 6, it is possible to preferentially kill the applications with larger memory in the data set to be killed, so as to release as much system memory as possible at one time, thereby improving the killing efficiency.

[0077] In this embodiment, in addition to the above-mentioned sequential determination of whether each application to be killed needs to be killed until the available memory is not less than the preset available memory threshold or all applications to be killed are judged to be completed, it is also possible to directly screen out each application to be killed whose occupied memory is greater than the preset application memory threshold based on the preset application memory threshold of each application to be killed in the data set to be killed and the memory occupied by each application to be killed in the terminal system, as the initial killing application, further, in combination with at least one of the application killing priority, the amount of memory exceeding the threshold, the proportion of memory exceeding the threshold and the application running time, the final first target killing application is selected therefrom, and all first target killing applications are killed.

[0078] Exemplarily, through the application killing priority, select some applications with high priority from all the initial killing applications as the first target killing applications; or, select the initial killing applications whose amount of memory occupied exceeds the preset application memory threshold and is greater than the set value as the first target killing application; or, select the initial killing applications whose proportion of memory occupied exceeds the preset application memory threshold and is greater than the set proportion as the first target killing application; or, select the initial killing applications whose application running time is greater than the set time as the first target killing application. It should be noted that the first target killing application can also be selected by combining the application killing priority, the amount of memory exceeding the threshold, the proportion of memory exceeding the threshold and the application running time. Considering that there may be a possibility that there is an error in the application to be killed or the preset application memory threshold of the application to be killed in the data set to be killed sent by the server, in order to further improve the reliability of the terminal system memory release, information can also be uploaded to the server during the first round of killing so that the server can update the data set to be killed.

[0079] Optionally, after the first target application is checked and killed, the method further includes:

[0080] Sending the memory occupied by each application in the terminal system after the killing process to the server, so that the server determines whether there is an application affected by the first target killing application according to the memory occupied by each application, and if so, updates the application to be killed in the data set to be killed and / or the preset application memory threshold of the application to be killed;

[0081] Receive the updated set of to-be-checked data fed back by the server.

[0082] Specifically, after each first target application is killed, the memory occupied by each application in the terminal system after the killing process can be sent to the server, so that the server can determine whether there are applications whose memory usage has increased or is abnormal due to the killing of the first target application based on the memory occupied by each application. If so, such applications can be written into the data set to be killed as applications to be killed, and their corresponding preset application memory threshold can be determined. Alternatively, only the preset application memory threshold of the first target application can be updated, such as increasing the preset application memory threshold of the first target application, to avoid affecting the operation of other applications due to the killing of the application.

[0083] After updating the to-be-checked and killed data set, the server can feed back the updated to-be-checked and killed data set to the terminal system.

[0084] Through the above implementation mode, the terminal system can upload information to the server during the first round of killing, so that the server can update the data set to be killed, thereby achieving the purpose of optimizing the data set to be killed, and trying to avoid the situation where the memory release fails due to errors in the application to be killed or the preset application memory threshold of the application to be killed, thereby further improving the reliability of memory release of the terminal system.

[0085] S120: If the available memory after the killing process is lower than the preset available memory threshold, determine a second target killing application based on the application priority information corresponding to the terminal system and perform killing process on the second target killing application.

[0086] Specifically, after completing the first round of killing, it can be determined whether the available memory of the terminal system is still lower than the preset available memory threshold. If so, it means that the available memory of the terminal system does not meet the standard and a second round of killing is required to further release memory.

[0087] Considering that the first round of killing failed to release enough memory, it may be caused by errors in the data set to be killed. Therefore, after the first round of killing is completed and before the second round of killing begins, the memory occupied by each application in the terminal system can be uploaded to the server to enable the server to update the data set to be killed.

[0088] Optionally, before determining the second target killing application based on the application priority information corresponding to the terminal system and performing killing processing on the second target killing application, the method further includes:

[0089] The memory occupied by each application in the terminal system after the killing process is sent to the server, so that the server can reduce the preset application memory threshold of the application to be killed in the data set to be killed according to the memory occupied by each application, or replace the application to be killed in the data set to be killed and determine the corresponding preset application memory threshold.

[0090] Specifically, after the first round of killing is completed, if the available memory after the killing process is still lower than the preset available memory threshold, it means that the available memory of the terminal system at this time still does not exceed the preset available memory threshold, and the first round of killing has failed to effectively release the memory. Therefore, before the second round of killing begins, the occupied memory of each application in the terminal system after the killing process can be sent to the server, so that the server can lower the preset application memory threshold of the application to be killed according to the occupied memory of each application, or replace each application to be killed and determine a new preset application memory threshold for each application to be killed, so as to achieve the purpose of updating the data set to be killed.

[0091] Through the above implementation mode, the terminal system can upload information to the server before the second round of killing, so that the server can update the data set to be killed, thereby achieving the purpose of optimizing the data set to be killed, and trying to avoid the situation where the memory release fails due to errors in the application to be killed or the preset application memory threshold of the application to be killed, thereby further improving the reliability of memory release of the terminal system.

[0092] In an embodiment of the present application, for the second round of killing, a low memory management mechanism can be used through application priority information to determine the second target killing application in the terminal system and perform killing processing on the second target killing application.

[0093] Exemplarily, a plurality of second target killing applications may be determined according to a preset killing number and application priority information, and the number of the second target killing applications is equal to the preset killing number.

[0094] In an example, based on the application priority information corresponding to the terminal system, determining the second target killing application and performing killing processing on the second target killing application includes:

[0095] Based on the application priority information corresponding to the terminal system, the second target killing application is determined in the terminal system in order of priority from low to high, and the second target killing application is killed until the available memory is greater than the preset available memory threshold.

[0096] Specifically, according to the application priority information, the second target killing application can be determined in order of priority from low to high among all applications surviving in the terminal system, and the second target killing application can be killed until the available memory of the terminal system is greater than the preset available memory threshold.

[0097] Through the above example, you can first kill applications with lower priorities until the available memory is greater than the preset available memory threshold, so as to avoid killing too many applications at one time and affecting user use.

[0098] Figure 3 Schematic diagram of a system memory check and kill process provided by an embodiment of the present application, such as Figure 3As shown, first, in response to detecting that the system is turned on and running, the low memory management mechanism can be initialized and determine whether the system available memory is less than low_wmark. If not, it continues to return to determine. If so, it determines whether the data set to be killed is empty, that is, whether it has been traversed completely. If not, it can continue to traverse the application to be killed and determine whether the application memory occupied by the application to be killed is less than the application corresponding threshold (that is, the preset application memory threshold). If the application memory occupied is less than the application corresponding threshold, the low memory management mechanism can kill the application, and upload the application memory information after killing, and continue to determine whether the system available memory is less than low_wmark. In the case that the system available memory is less than low_wmark, it can return to continue to determine whether the data set to be killed is empty. In the case that the system available memory is not less than low_wmark, the whole process can be directly terminated. If the application memory occupied is not less than the application corresponding threshold, it can return to continue to determine whether the data set to be killed is empty to continue traversing the next application to be killed.

[0099] If the data set to be killed is empty, that is, all applications to be killed have been traversed, it can be determined whether the system available memory is less than low_wmark. If it is, the memory information of the applications in the system is uploaded, and the low memory management mechanism can kill applications with lower priorities until the system available memory is not less than low_wmark, and then return to continue to determine whether the system available memory is less than low_wmark.

[0100] The above process optimizes the order of killing applications according to priority by adding a killing strategy algorithm based on the native low memory management mechanism. At the same time, through the data set to be killed, the application in the data set is intervened in advance to kill.

[0101] The embodiments of the present application have the following technical effects: in response to detecting that the available memory of the terminal system is lower than a preset available memory threshold, a first target killing application is determined and the first target killing application is killed according to the preset application memory threshold of each application to be killed in the data set to be killed and the memory occupied by each application to be killed in the terminal system; if the available memory of the terminal system is still lower than the preset available memory threshold after the killing, a second target killing application is determined based on the application priority information and the second target killing application is killed; before killing the application according to the application priority information, the method can first kill some applications according to the occupied memory and the preset application memory threshold for each application to be killed in the data set to be killed, and can first kill abnormal applications that occupy a large amount of memory, so as to solve the problem of continuous reduction of system available memory caused by the inability to kill applications with high priority and large memory; after killing the first target killing application, if the available memory is still lower than the preset available memory threshold, the low priority application is continued to be killed based on the application priority information, so as to further ensure the sufficiency of available memory, solve the system freeze, instability, functional abnormality and the like, and improve the performance and stability of system operation.

[0102] Based on the same purpose, the embodiment of the present application also provides a memory killing device of a terminal system, the device comprising a data set traversal killing module and a priority killing module, wherein:

[0103] A data set traversal killing module is used to, in response to detecting that the available memory of the terminal system is lower than a preset available memory threshold, determine a first target killing application based on a preset application memory threshold of each to-be-killed application in the to-be-killed data set and the memory occupied by each to-be-killed application in the terminal system, and perform a killing process on the first target killing application;

[0104] The priority killing module is used to determine a second target killing application and perform killing processing on the second target killing application based on the application priority information corresponding to the terminal system if the available memory after the killing processing is lower than the preset available memory threshold.

[0105] In some implementations, the data set traversal detection module is specifically used to:

[0106] Using the first application to be killed in the data set to be killed as the current judgment application, wherein the data set to be killed includes each application to be killed and a preset application memory threshold of each application to be killed;

[0107] Determine whether the memory occupied by the currently determined application exceeds a preset application memory threshold of the currently determined application, and if so, determine the currently determined application as a first target killing application, and perform killing processing on the first target killing application;

[0108] Determine whether the available memory after the killing process is lower than the preset available memory threshold. If so, take the next application to be killed of the current application in the data set to be killed as the new current application to be killed, and return to the step of determining whether the occupied memory of the current application to be judged exceeds the preset application memory threshold of the current application to be judged, until the current application to be judged is the last application to be killed in the data set to be killed.

[0109] In some implementations, the priority killing module is specifically used to:

[0110] Based on the application priority information corresponding to the terminal system, second target killing applications are determined in the terminal system in order of priority from low to high, and the second target killing applications are killed until the available memory is greater than the preset available memory threshold.

[0111] In some implementations, the device further includes a memory monitoring module for acquiring available memory of the terminal system.

[0112] In some embodiments, the device also includes a data set synchronization module, which is used to determine the memory occupied by each application in the terminal system and sort all applications in order of the memory occupied from large to small; send the application-related information of the top N applications in the sorting results to the server, so that the server determines each application to be killed and the preset application memory threshold of each application to be killed based on the application-related information of the top N applications, and constructs a data set to be killed; and receive the data set to be killed fed back by the server.

[0113] In some embodiments, the device further comprises a data set synchronization module, the data set synchronization module being used to receive a data set to be detected and killed sent by a server, wherein the data set to be detected and killed is determined by the server based on application related information sent by other terminal systems of the same type.

[0114] In some embodiments, the device also includes a data set synchronization module, which is used to send the occupied memory of each application in the terminal system after the killing process to the server, so that the server can reduce the preset application memory threshold of the application to be killed in the data set to be killed according to the occupied memory of each application, or replace the application to be killed in the data set to be killed and determine the corresponding preset application memory threshold; and receive the updated data set to be killed fed back by the server.

[0115] In some embodiments, the device also includes a data set synchronization module, which is used to send the occupied memory of each application in the terminal system after the killing process to the server, so that the server can determine whether there is an application affected by the first target killing application based on the occupied memory of each application. If so, update the application to be killed in the data set to be killed and / or the preset application memory threshold of the application to be killed; and receive the updated data set to be killed fed back by the server.

[0116] The memory killing device of the terminal system provided in the embodiment of the present application can execute the steps of the memory killing method of the terminal system provided in the method embodiment of the present application, and the execution steps and beneficial effects are no longer repeated here.

[0117] Figure 4 Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown, the electronic device 400 includes one or more processors 401 and a memory 402 .

[0118] The processor 401 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 400 to perform desired functions.

[0119] The memory 402 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 301 may run the program instructions to implement the memory killing method of the terminal system of any embodiment of the present application described above and / or other desired functions. Various contents such as initial external parameters, thresholds, etc. may also be stored in the computer-readable storage medium.

[0120] In one example, the electronic device 400 may further include: an input device 403 and an output device 404, which are interconnected via a bus system and / or other forms of connection mechanisms (not shown). The input device 403 may include, for example, a keyboard, a mouse, etc. The output device 404 may output various information to the outside, including early warning information, braking force, etc. The output device 404 may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.

[0121] Of course, to simplify, Figure 4 Only some of the components related to the present application in the electronic device 400 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application conditions, the electronic device 400 may also include any other appropriate components.

[0122] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the memory killing method of the terminal system provided in any embodiment of the present application.

[0123] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0124] In addition, an embodiment of the present application may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps of the memory killing method of the terminal system provided in any embodiment of the present application.

[0125] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0126] It should be noted that the terms used in this application are only for describing specific embodiments, rather than limiting the scope of this application. As shown in the specification and claims of this application, unless the context clearly indicates an exception, the words "one", "a", "a kind of" and / or "the" do not specifically refer to the singular, but may also include the plural. The terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method or device including the elements.

[0127] It should also be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. Unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", etc. should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0128] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and its core ideas of this application. The above is only the preferred implementation method of this application. It should be pointed out that due to the limitations of textual expression and the objective existence of infinite specific structures, ordinary technicians in this technical field can make several improvements, modifications or changes without departing from the principles of this application, and can also combine the above technical features in an appropriate manner; these improvements, modifications, changes or combinations, or the direct application of the concept and technical solution of the invention to other occasions without improvement, should be regarded as the scope of protection of this application.

Claims

1. A memory killing method for a terminal system, characterized in that: include: In response to detecting that the available memory of the terminal system is lower than a preset available memory threshold, based on the preset application memory threshold of each application to be killed in the to-be-killed data set and the memory occupied by each of the to-be-killed applications in the terminal system, determining a first target application to be killed and performing a killing process on the first target application to be killed; If the available memory after the killing process is lower than the preset available memory threshold, a second target killing application is determined based on the application priority information corresponding to the terminal system and the second target killing application is killed.

2. The method according to claim 1, characterized in that The determining of a first target application to be killed and performing a killing process on the first target application to be killed based on a preset application memory threshold of each application to be killed in the data set to be killed and the memory occupied by each application to be killed in the terminal system comprises: Using the first application to be killed in the data set to be killed as the current judgment application, wherein the data set to be killed includes each application to be killed and a preset application memory threshold of each application to be killed; Determine whether the memory occupied by the currently determined application exceeds a preset application memory threshold of the currently determined application, and if so, determine the currently determined application as a first target killing application, and perform killing processing on the first target killing application; Determine whether the available memory after the killing process is lower than the preset available memory threshold. If so, take the next application to be killed of the current application in the data set to be killed as the new current application to be killed, and return to the step of determining whether the occupied memory of the current application to be judged exceeds the preset application memory threshold of the current application to be judged, until the current application to be judged is the last application to be killed in the data set to be killed.

3. The method according to claim 1, characterized in that Based on the application priority information corresponding to the terminal system, determining a second target killing application and performing a killing process on the second target killing application includes: Based on the application priority information corresponding to the terminal system, second target killing applications are determined in the terminal system in order from low to high priority, and the second target killing applications are killed until the available memory is greater than the preset available memory threshold.

4. The method according to claim 1, characterized in that: Before determining a first target application to be killed and performing a killing process on the first target application to be killed based on a preset application memory threshold of each application to be killed in the data set to be killed and the memory occupied by each application to be killed in the terminal system, the method further includes: Determine the memory occupied by each application in the terminal system, and sort all applications in descending order of memory occupied; Sending application related information of the top N applications in the sorting result to the server, so that the server determines each application to be detected and killed and a preset application memory threshold of each application to be detected and killed based on the application related information of the top N applications, and constructs a data set to be detected and killed; Receive the to-be-checked data set fed back by the server.

5. The method according to claim 1, characterized in that The method further comprises: A data set to be detected and killed is received from a server, wherein the data set to be detected and killed is determined by the server based on application related information sent by other terminal systems of the same type.

6. The method according to claim 1, characterized in that Before determining a second target killing application based on the application priority information corresponding to the terminal system and performing a killing process on the second target killing application, the method further includes: Sending the memory occupied by each application in the terminal system after the killing process to the server, so that the server can reduce the preset application memory threshold of the application to be killed in the data set to be killed according to the memory occupied by each application, or replace the application to be killed in the data set to be killed and determine the corresponding preset application memory threshold; Receive the updated set of to-be-checked data fed back by the server.

7. The method according to claim 2, characterized in that: After the first target application is detected and killed, the method further includes: Sending the memory occupied by each application in the terminal system after the killing process to the server, so that the server determines whether there is an application affected by the first target killing application according to the memory occupied by each application, and if so, updates the application to be killed in the data set to be killed and / or the preset application memory threshold of the application to be killed; Receive the updated set of to-be-checked data fed back by the server.

8. A memory check and kill device for a terminal system, characterized in that: include: A data set traversal killing module is used to, in response to detecting that the available memory of the terminal system is lower than a preset available memory threshold, determine a first target killing application based on a preset application memory threshold of each to-be-killed application in the to-be-killed data set and the memory occupied by each to-be-killed application in the terminal system, and perform a killing process on the first target killing application; The priority killing module is used to determine a second target killing application and perform killing processing on the second target killing application based on the application priority information corresponding to the terminal system if the available memory after the killing processing is lower than the preset available memory threshold.

9. An electronic device, characterized in that: The electronic device comprises: Processor and memory; The processor is used to execute the steps of the memory killing method of the terminal system as described in any one of claims 1 to 7 by calling the program or instruction stored in the memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or instruction, and the program or instruction enables a computer to execute the steps of the memory killing method of the terminal system as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Watchdog circuit monitoring device and system

    CN120179450A

  • Watchdog circuit monitoring device and system

    CN120179450B