Resource management method, device, electronic device and storage medium
By obtaining the resource value of the target application in the terminal device and recycling resources according to the recycling trigger conditions, the application lag or crash caused by insufficient resources in the terminal device is solved, and more efficient resource management and recycling is achieved.
Patent Information
- Application Number
- CN202311297425.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-08
- Publication Date
- 2025-04-08
AI Technical Summary
During the use of terminal devices, due to the increase in the number of applications and the use of too many resources, resulting in insufficient system resources and the application lag or crash.
By obtaining the resource value currently occupied by the target application, if the resource value meets the recovery trigger condition, at least part of the resource resource of the target application is recycled using the corresponding resource recycling strategy. The recovery trigger condition includes at least the occupied resource value is greater than the first resource threshold.
It realizes more refined resource management, timely recycles excessive resources, avoids application lag or crash problems caused by insufficient system resources, and improves the efficiency and flexibility of resource recycling.
Smart Images

Figure CN119781950A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a resource management method, device, electronic device and storage medium. Background Art
[0002] With the development of terminal technology, terminal devices such as mobile phones and tablet computers have become indispensable items in people's daily lives.
[0003] However, when the terminal device is in use, as the number of applications opened increases, more and more processes are running, and more and more resources are occupied, which will reduce the available computer resources of the system and cause a resource shortage problem, which will cause the applications in the terminal device to freeze or crash. Summary of the invention
[0004] The present application proposes a resource management method, device, electronic device and storage medium to timely realize more effective resource recycling.
[0005] In a first aspect, an embodiment of the present application provides a resource management method, the method comprising: obtaining the resource value currently occupied by a target application, the target application being any application currently running; if the resource value meets a recycling trigger condition, then utilizing a resource recycling strategy corresponding to the recycling trigger condition to recycle at least part of the resources currently occupied by the target application, the recycling trigger condition comprising at least the occupied resource value being greater than a first resource threshold.
[0006] In a second aspect, an embodiment of the present application provides a resource management device, the device comprising: a resource value acquisition module and a resource recovery module. The resource value acquisition module is used to acquire the resource value currently occupied by a target application, the target application being any running application; and the resource recovery module is used to recover at least part of the resources currently occupied by the target application using a resource recovery strategy corresponding to the recovery trigger condition if the resource value meets a recovery trigger condition, the recovery trigger condition at least including that the occupied resource value is greater than a first resource threshold.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above-mentioned method.
[0008] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a program code is stored. The program code can be called by a processor to execute the above method.
[0009] In the solution provided by the present application, the resource value currently occupied by the target application is obtained, and the target application is any application currently running; if the resource value meets the recycling trigger condition, the resource recycling strategy corresponding to the recycling trigger condition is used to recycle at least part of the resources currently occupied by the target application, and the recycling trigger condition at least includes that the occupied resource value is greater than the first resource threshold. In this way, resource recycling based on the application as a unit can achieve more refined resource management; and when the resource value occupied by any running application meets the recycling trigger condition, resource recycling using the resource recycling strategy adapted to the recycling trigger condition can also better and more flexibly achieve resource recycling, thereby effectively avoiding the problem of insufficient system resources of electronic equipment, resulting in application freezes or flashbacks. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0011] Figure 1 A flow chart of a resource management method provided in an embodiment of the present application is shown.
[0012] Figure 2 A flowchart of a resource management method provided in yet another embodiment of the present application is shown.
[0013] Figure 3 A flow chart of a resource management method provided in another embodiment of the present application is shown.
[0014] Figure 4 A flow chart of a resource management method provided in yet another embodiment of the present application is shown.
[0015] Figure 5 It is a block diagram of a resource management device provided according to an embodiment of the present application.
[0016] Figure 6 It is a block diagram of an electronic device according to an embodiment of the present application for executing the resource management method according to an embodiment of the present application.
[0017] Figure 7 It is a storage unit of an embodiment of the present application for storing or carrying program codes for implementing the resource management method according to an embodiment of the present application. DETAILED DESCRIPTION
[0018] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0019] It should be noted that in some processes described in the specification, claims and the above-mentioned drawings of the present application, multiple operations that appear in a specific order are included, and these operations may not be executed or executed in parallel in the order in which they appear in this article. The sequence numbers of operations such as S110, S120, etc. are only used to distinguish different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or less operations, and these operations may be executed in sequence or in parallel. And, the terms "first", "second", etc. in the specification, claims and the above-mentioned drawings of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or server that includes a series of steps or sub-modules is not necessarily limited to those steps or sub-modules explicitly listed, but may include other steps or sub-modules that are not explicitly listed or that are inherent to these processes, methods, products, or devices.
[0020] In the related art, memory recycling is generally performed only when the overall memory of the electronic device is low on memory. This cannot prevent the entire system memory usage problem caused by a memory leak in one application, which may affect the normal use of other applications.
[0021] The inventor proposes a resource management method, device, electronic device and storage medium, which can recycle the resources occupied by any running application using an adapted resource recycling strategy when the application occupies too many resources. The resource management method provided in the embodiment of the present application is described in detail below.
[0022] Please refer to Figure 1 , Figure 1 A schematic diagram of a resource management method provided in an embodiment of the present application. Figure 1 The resource management method provided in the embodiment of the present application is described in detail. The resource management method may include the following steps:
[0023] Step S110: obtaining the resource value currently occupied by the target application, where the target application is any application currently running.
[0024] In this embodiment, the resource value may include at least one of a memory value, a central processing unit (CPU) time slice, and a disk storage space. It is understandable that any application running in the electronic device, whether it is an application running in the foreground or an application running in the background, will occupy a certain resource value. Based on this, the resource value occupied by each running application can be monitored in real time based on the user identity (UID) of each application.
[0025] Step S120: If the resource value meets the recycling trigger condition, the resource recycling strategy corresponding to the recycling trigger condition is used to recycle at least part of the resources currently occupied by the target application. The recycling trigger condition at least includes that the occupied resource value is greater than a first resource threshold.
[0026] Furthermore, after obtaining the resource value currently occupied by the target application, it can be determined whether the resource value meets the recycling trigger condition, so that when the resource value meets the recycling trigger condition, that is, when the resource value currently occupied by the target application is greater than the first resource threshold, the resource recycling strategy corresponding to the recycling trigger condition is promptly used to recycle at least part of the resources currently occupied by the target application. For example, timely recycle at least one resource in the memory, CPU time slice and disk storage space currently occupied by the target application. In this way, in the case where the resource value occupied by any application is too much, part of the resources occupied by the application are promptly recycled, avoiding the occurrence of phenomena such as freezing or flashing back of the application in the electronic device due to excessive resource occupation of the electronic device. In addition, when resource recycling is required, a pre-set resource recycling strategy that is more adapted to the recycling trigger condition can be used for resource recycling, which can improve the effect and efficiency of resource recycling.
[0027] In some implementations, the recycling trigger condition may include at least one of the following conditions: the occupied resource value is greater than the first resource threshold, the occupied resource value is greater than the first resource threshold and the remaining resource value is less than the second resource threshold, and the occupied resource value is greater than the first resource threshold and the remaining available resource value is less than the third resource threshold. The first resource threshold, the second resource threshold, and the third resource threshold may all be pre-set values, which are not limited in this embodiment. The recycling trigger condition may also be set in combination with CPU usage, disk read and write rate, and disk throughput.
[0028] In this manner, if the recycling triggering conditions include the above three conditions at the same time, a corresponding resource recycling strategy can be set for each recycling triggering condition to achieve better resource recycling in different recycling scenarios.
[0029] Specifically, if the occupied resource value is greater than the first resource threshold, the corresponding resource recovery strategy may be to recover the first percentage of resources currently occupied by the target application; if the occupied resource value is greater than the first resource threshold and the remaining resource value is less than the second resource threshold, the corresponding resource recovery strategy may be to recover the second percentage of resources currently occupied by the target application; if the occupied resource value is greater than the first resource threshold and the remaining available resource value is less than the third resource threshold, the corresponding resource recovery strategy may be to recover the third percentage of resources currently occupied by the target application. Wherein, the first percentage is less than the second percentage, and the second percentage is less than the third percentage, for example, the first percentage is 10%, the second percentage is 20%, and the third percentage is 30%; and the first percentage, the second percentage, and the third percentage may all be pre-set values, which are not limited in this embodiment.
[0030] It can be seen that in this method, under the premise that the resource value currently occupied by the target application is greater than the first resource threshold, that is, under the premise that the target application currently occupies too much resource value, the tighter the remaining resource value of the electronic device, the more resources currently occupied by the target application will be recovered, thereby achieving more flexible and accurate resource recovery based on the actual situation of the resources of the electronic device.
[0031] In some embodiments, if the resource value meets the recycling trigger condition, the resource recycling strategy corresponding to the recycling trigger condition is used to recycle at least part of the resources currently occupied by the target application until the recycled resource value meets the stop recycling condition. In other words, it is not that the resources currently occupied by the target application are recycled only once, nor is it that the resources currently occupied by the target application are recycled in a cycle. Instead, a stop recycling condition is pre-set, and after detecting that the recycled resource value meets the stop recycling condition, the recycling of the resources currently occupied by the target application is stopped. In this way, the accuracy and efficiency of resource recycling can be further guaranteed; to a certain extent, it can avoid the occurrence of problems such as too little resource recycling leading to a shortage of remaining resources of the electronic device or too much resource recycling affecting the normal operation of the target application, that is, on the basis of not affecting the normal operation of the target application, the resource recycling accuracy and recycling efficiency are maximized.
[0032] The stopping recycling condition includes at least one of the following conditions:
[0033] The recovered resource value is greater than or equal to the fourth resource threshold;
[0034] The ratio of the recovered resource value to the resource value currently occupied by the target application is greater than or equal to a first threshold;
[0035] The ratio of the resource value occupied by the target application after resource recycling to the first resource threshold is less than or equal to the second threshold, and the second threshold is a positive number less than 1. Exemplarily, taking the first resource threshold as 100MB and the second threshold as 10%, if the resource value currently occupied by the target application is 120MB, then when it is detected that the resource value occupied by the target application for resource recycling is 100*(1-10%)=90MB, it can be determined that the recycled resource value meets the stop recycling condition.
[0036] It can be seen that in this way, by setting a variety of stop recycling conditions, resource recovery can be made more accurate, that is, the most suitable stop recycling condition can be called according to different needs in actual applications, thereby greatly improving the accuracy and efficiency of resource recovery.
[0037] Optionally, each threshold value in the stop recycling condition corresponding to different applications can be set in advance according to the resource demand of the application, and the size of each threshold value can be negatively correlated with the resource demand of the application.
[0038] Optionally, each threshold value in the stop recycling condition corresponding to different applications can be set in advance according to the priority of the application, that is, the size of each threshold value can be negatively correlated with the priority of the application. That is, the higher the priority of the application, the more important the application is, and the threshold values in the stop recycling condition can be set smaller, so as to avoid abnormal operation of the application due to excessive resource recycling, thereby affecting the user experience.
[0039] Optionally, when it is detected that the remaining available resource value of the electronic device is less than the target resource threshold, that is, the remaining available resources of the electronic device are insufficient, and the resource value meets the recycling trigger condition, the resource recycling strategy corresponding to the recycling trigger condition is used to recycle at least part of the resources currently occupied by the target application until the recycled resource value meets the stop recycling condition. In other words, when the overall resources of the electronic device are insufficient, the resources currently occupied by the target application that meets the recycling trigger condition will be recycled to the greatest extent, so as to ensure that the electronic device will not cause problems such as running freezes due to insufficient resources of its own.
[0040] Optionally, when it is detected that the remaining available resource value of the electronic device is greater than or equal to the target resource threshold, that is, the remaining available resources of the electronic device are sufficient, and the resource value meets the recycling trigger condition, the resource recycling strategy corresponding to the recycling trigger condition is used to recycle at least part of the resources currently occupied by the target application. In other words, when the overall resources of the electronic device are sufficient, it is only necessary to appropriately recycle the resources currently occupied by the target application, which can avoid the subsequent problems such as insufficient resources of the electronic device and operation jams to a certain extent.
[0041] In some implementations, after step S110, if it is determined that the resource value currently occupied by the target application does not meet the recycling trigger condition, the resource value occupied by the target application at the target moment after the current moment is predicted as the predicted resource value; and it is determined whether the predicted resource value meets the recycling trigger condition. Optionally, if the predicted resource value meets the recycling trigger condition, the resource recycling strategy corresponding to the recycling trigger condition is used to recycle at least part of the resources currently occupied by the target application. In other words, by predicting the resource usage trend of the target application, resource recycling can be performed in advance to avoid resource recycling when the electronic device has already experienced problems such as operation jams due to insufficient resources.
[0042] In this embodiment, resource recycling is performed on an application basis, which can achieve more refined resource management; and when the resource value occupied by any running application meets the recycling trigger condition, resource recycling is performed using a resource recycling strategy that is adapted to the recycling trigger condition from a variety of resource recycling strategies, which can also better and more flexibly achieve resource recycling, thereby effectively avoiding insufficient system resources of electronic devices, resulting in problems such as application freezes or crashes.
[0043] Please refer to Figure 2 , Figure 2 A flowchart of a resource management method provided in another embodiment of the present application is shown below. Figure 2 The resource management method provided in the embodiment of the present application is described in detail. The resource management method may include the following steps:
[0044] Step S210: Obtain the memory value currently occupied by the target application, where the target application is any application currently running.
[0045] In this embodiment, the memory value is taken as an example for the resource value currently occupied by the target application. Specifically, the electronic device can monitor the memory value occupied by each application in real time, for example, according to the UID identifier of the target application, obtain the target process currently running by the target application, such as obtaining the process table of the target application, and the process table records all the current processes of the target application. Then, the memory information occupied by each process is obtained, and the memory occupied by all the target processes of the target application is added up, so that the memory value currently occupied by the target application can be calculated.
[0046] Step S220: If the currently occupied memory value is greater than the first memory threshold, the file pages in the inactive file page list of the target application are recycled.
[0047] Furthermore, it is possible to determine whether the memory value currently occupied by the target application is greater than a first memory threshold. If it is determined that the memory value is greater than the first memory threshold, it indicates that the memory value currently occupied by the target application is too much. In order to avoid memory leakage in the target application and cause the normal operation of other applications, at least part of the memory currently occupied by the target application can be reclaimed. Considering that in actual applications, the file pages in the inactive file page list are all file pages that have been used less recently, and they will not be frequently used in a short period of time, therefore, when it is determined that the currently occupied memory value is greater than the first memory threshold, at least part of the file pages in the inactive file page list of the target application can be preferentially reclaimed. In this way, the memory occupied by the target application can be reclaimed without affecting the normal operation of the target application.
[0048] Optionally, if the currently occupied memory value is less than or equal to the first memory threshold, it indicates that the target application currently occupies not too much memory. In this case, the electronic device may not perform a memory recovery operation.
[0049] Step S230: If the currently occupied memory value is greater than the first memory threshold and the remaining memory value is less than the second memory threshold, the file pages in the inactive file page list of the target application are recycled, and the anonymous pages in the inactive anonymous page list corresponding to the target application are compressed.
[0050] In some implementations, it is also possible to determine whether the memory value currently occupied by the target application is greater than the first memory threshold, and to determine whether the current remaining memory value of the electronic device is less than the second memory threshold. The two determination conditions may be executed simultaneously or one after the other, and this embodiment does not limit this.
[0051] In this way, if the currently occupied memory value is greater than the first memory threshold and the remaining memory value is less than the second memory threshold, it can be determined that the target application currently occupies too much memory value, and the remaining memory value of the electronic device is insufficient. If memory recycling is not performed at this time, the target application may have memory leaks and the electronic device may experience running problems. Therefore, in this case, a more powerful memory recycling method can be used to recycle the memory of the target application, thereby maximizing the memory recycling effect.
[0052] Considering that the anonymous pages in the inactive anonymous page list are the anonymous pages that have been used less recently and will not be frequently used in a short period of time; however, since the anonymous pages refer to dynamically allocated heap memory, they cannot be directly recycled and may be accessed again later. Therefore, memory recycling can be indirectly achieved by compressing the anonymous pages in the inactive anonymous page list, that is, the compressed anonymous pages occupy less heap memory than the anonymous pages before compression, which means that memory recycling is achieved to a certain extent.
[0053] Based on this, when it is determined that the currently occupied memory value is greater than the first memory threshold and the remaining memory value is less than the second memory threshold, the file pages in the inactive file page list of the target application are recycled, and the anonymous pages in the inactive anonymous page list corresponding to the target application are also compressed. In this way, when the remaining system memory is insufficient and the target application occupies too much memory, the memory of the electronic device can be recycled to a greater extent.
[0054] Optionally, if the currently occupied memory value is greater than the first memory threshold and the remaining memory value is greater than or equal to the second memory threshold, only the file pages in the inactive file page list of the target application may be reclaimed.
[0055] Step S240: If the currently occupied memory value is greater than the first memory threshold and the remaining available memory value is less than the third memory threshold, all memory pages in the memory group corresponding to the target application are recycled.
[0056] In other embodiments, it is possible to determine whether the memory value currently occupied by the target application is greater than the first memory threshold, and to determine whether the current remaining available memory value of the electronic device is less than the third memory threshold. The two judgment conditions may be executed simultaneously or one after the other, and this embodiment does not limit this. The current remaining available memory value of the electronic device may be understood as the sum of the remaining memory value of the electronic device, the memory value occupied by the file page cache data, and the memory value occupied by the cache data of other memories. That is, since the cache can be cleared to release part of the memory space, when calculating the remaining available memory value, the memory value occupied by the cache data may be calculated in advance.
[0057] In this way, if the currently occupied memory value is greater than the first memory threshold and the remaining memory value is less than the second memory threshold, it can be determined that the memory value currently occupied by the target application is too much, and the remaining available memory value of the electronic device is seriously insufficient. If memory recovery is not performed at this time, the electronic device will experience problems such as running freezes or shutting down. Therefore, in this case, a more powerful memory recovery method can be used to recover the memory of the target application, thereby maximizing the memory recovery effect. Specifically, all memory pages in the memory group corresponding to the target application can be directly recovered, thereby maximizing memory recovery.
[0058] Optionally, if the currently occupied memory value is greater than the first memory threshold, but the remaining available memory value is greater than or equal to the third memory threshold, only the file pages in the inactive file page list of the target application may be reclaimed.
[0059] In this embodiment, no matter which of the aforementioned memory recycling methods is used, memory recycling can be stopped when the recycled memory value meets the stop recycling condition. The stop recycling condition includes at least one of the following conditions: the recycled memory value is greater than or equal to the fourth memory threshold; the ratio of the recycled memory value to the memory value currently occupied by the target application is greater than or equal to the first threshold; the ratio of the memory value occupied by the target application after resource recycling to the first memory threshold is less than or equal to the second threshold, and the second threshold is a positive number less than 1.
[0060] In this embodiment, for the memory resources occupied by the target application, when the occupied memory value meets different memory recovery trigger conditions, different more targeted and adaptive memory recovery methods are used to perform memory recovery, thereby improving the efficiency and flexibility of memory recovery. At the same time, it will not cause problems such as target application and electronic device operation jams due to the use of inappropriate memory recovery methods.
[0061] Please refer to Figure 3 , Figure 3 A flowchart of a resource management method provided in another embodiment of the present application. Figure 3 The resource management method provided in the embodiment of the present application is described in detail. The resource management method may include the following steps:
[0062] Step S310: Obtain the resource value currently occupied by the target application, where the target application is any application currently running.
[0063] In this embodiment, the step S310 may refer to the contents in the aforementioned embodiments, which will not be described in detail here.
[0064] Step S320: Obtain the current running status of the target application.
[0065] It is understandable that applications in different running states generally have different requirements for resources in the electronic device. For example, for applications in the foreground running state, since users will interact with the applications in the foreground running state, the requirements for real-time performance are relatively high. Therefore, the requirements for resources in the electronic device in the foreground running state are generally higher. For applications in the background running state, the requirements for real-time performance are relatively low, and the requirements for resources in the electronic device are relatively lower than those in the foreground running state.
[0066] Therefore, in this embodiment, the corresponding foreground trigger condition can be set in advance for the foreground running state, and the corresponding background trigger condition can be set in advance for the background running state. Based on this, before determining whether the resource value currently occupied by the target application meets the recycling trigger condition, the current running state of the target application can be obtained first, and the recycling trigger condition corresponding to the current running state can be determined.
[0067] Step S330: If the current running state is the foreground running state, a foreground trigger condition corresponding to the foreground running state is obtained as the recycling trigger condition.
[0068] Step S340: If the current running state is a background running state, obtain the background trigger condition corresponding to the background running state as the recycling trigger condition, and the first resource threshold in the foreground trigger condition is less than the first resource threshold in the background trigger condition.
[0069] In this embodiment, both the foreground trigger condition and the background trigger condition may include at least one of the following conditions: the occupied resource value is greater than the first resource threshold, the occupied resource value is greater than the first resource threshold and the remaining resource value is less than the second resource threshold, and the occupied resource value is greater than the first resource threshold and the remaining available resource value is less than the third resource threshold. Of course, considering the need to reserve sufficient resources for the target application in the foreground running state, the first resource threshold in the foreground trigger condition is less than the first resource threshold in the background trigger condition, the second resource threshold in the foreground trigger condition is less than the second resource threshold in the background trigger condition, and the third resource threshold in the foreground trigger condition is less than the third resource threshold in the background trigger condition.
[0070] In this way, different recycling trigger conditions are set for each application in the foreground running state and the background running state, so that resource recycling can be performed more flexibly and efficiently without affecting the normal operation of the application, that is, without the user being aware of it.
[0071] Step S350: If the resource value meets the recycling trigger condition, the resource recycling strategy corresponding to the recycling trigger condition is used to recycle at least part of the resources currently occupied by the target application. The recycling trigger condition at least includes that the occupied resource value is greater than the first resource threshold.
[0072] In this embodiment, a corresponding foreground resource recycling policy can be set in advance for the foreground trigger condition, and a corresponding background resource recycling policy can be set in advance for the background trigger condition. Among them, the resource value recycled by the foreground resource recycling policy can be set to be smaller than the resource value recycled by the background resource recycling policy. In this way, it can be avoided that too many resources are recycled for the target application in the foreground running state, causing the target application to freeze or flash back, affecting the user's experience, and other problems.
[0073] In some implementations, if the resource value meets the recycling trigger condition, the resource recycling strategy corresponding to the recycling trigger condition is used to recycle at least part of the resources currently occupied by the target application until the recycled resource value meets the stop recycling condition. The stop recycling condition includes at least one of the following conditions: the recycled resource value is greater than or equal to the fourth resource threshold; the ratio of the recycled resource value to the resource value currently occupied by the target application is greater than or equal to the first threshold; the ratio of the resource value occupied by the target application after resource recycling to the first resource threshold is less than or equal to the second threshold, and the second threshold is a positive number less than 1.
[0074] In this way, the threshold value in the stop recycling condition can also be adjusted for different running states, so that resource recycling can be stopped at a more appropriate time for applications in different running states, thereby achieving better resource recycling. Optionally, the fourth resource threshold value in the stop recycling condition corresponding to the foreground running state can be smaller than the fourth resource threshold value in the stop recycling condition corresponding to the foreground running state; the first threshold value in the stop recycling condition corresponding to the foreground running state can be smaller than the first threshold value in the stop recycling condition corresponding to the foreground running state; the second threshold value in the stop recycling condition corresponding to the foreground running state can be larger than the second threshold value in the stop recycling condition corresponding to the foreground running state.
[0075] In some embodiments, when the resource value is a memory value, if the currently occupied memory value meets the foreground trigger condition, at least some of the memory pages in the inactive memory list corresponding to the target application are recycled. That is to say, when the target application is in the foreground running state, in order to ensure the normal operation of the target application, generally all of its memory pages will not be recycled; instead, at least some of the memory pages in the inactive memory list that have been used less recently and will not be frequently used in a short period of time will be recycled. In this way, memory recycling is achieved without affecting the normal operation of the target application.
[0076] Optionally, if the currently occupied memory value meets the background trigger condition, all memory pages in the memory group corresponding to the target application are reclaimed, or at least part of the memory pages in the inactive memory list corresponding to the target application are reclaimed. That is to say, when the target application is in the background running state, even if the background running application ends because all memory pages are recycled, the user is generally unaware of it. Therefore, it is possible to adopt a recycling strategy with less recycling intensity, for example, to recycle at least part of the memory pages in the inactive memory list corresponding to the target application; of course, it is also possible to adopt a recycling strategy with greater recycling intensity, for example, to recycle all memory pages in the memory group corresponding to the target application.
[0077] In this way, when it is determined that the target application is in the background running state and the currently occupied memory value meets the background trigger condition, it can be further determined whether the target application belongs to multiple preset types of applications; if it belongs to any preset type, at least part of the memory pages in the inactive memory list corresponding to the target application are recycled; if it does not belong to any preset type, all memory pages in the memory group corresponding to the target application are recycled. Among them, the multiple preset types can at least include: music playback type, video playback type, video call type and voice call type, etc., which are not limited in this embodiment. In other words, multiple preset types of applications can be understood as types of applications that can be perceived by users to be running in the background. In this way, it can be avoided that due to the recycling of all memory pages of the target application in the background running state, some applications that are perceived by users to be running in the background end their running state, thereby greatly reducing the user's experience and other problems. In addition, for the target application in the background running state, combined with its application type, a more flexible selection of a recycling strategy that matches its application type for resource recycling is carried out, which realizes more refined resource recycling management and also makes resource recycling management more intelligent and flexible.
[0078] Optionally, the memory occupied by each process of the target application may be reclaimed, that is, finer-grained memory reclamation may be achieved.
[0079] In this embodiment, for target applications in different operating states, different recycling trigger conditions are used to determine whether the resources occupied by the target applications need to be recycled; and, if recycling is determined to be necessary, the recycling strategy corresponding to the operating state is further used to recycle resources. In other words, for target applications in different operating states, more suitable recycling trigger conditions are used to more accurately determine whether resource recycling is necessary; and, if resource recycling is necessary, a more suitable recycling strategy is used to more effectively and accurately implement resource recycling. In this way, the intelligence and flexibility of resource management are greatly improved.
[0080] Please refer to Figure 4 , Figure 4 A flowchart of a resource management method provided in another embodiment of the present application is shown below. Figure 4 The resource management method provided in the embodiment of the present application is described in detail. The resource management method may include the following steps:
[0081] Step S410: obtaining the resource value currently occupied by the target application, the target application being any running application, and the resource value including the resource value of each resource among the multiple resources occupied by the target application.
[0082] In this embodiment, the multiple resources may include at least two of memory value, CPU time slice and disk storage space. That is, this embodiment can perform resource management on multiple resources occupied by the target application. Naturally, the recycling trigger condition includes multiple sub-trigger conditions, and the multiple sub-trigger conditions correspond to the multiple resources one by one, that is, a sub-trigger condition corresponding to the resource is set for each resource. Among them, each sub-trigger condition at least includes that the resource value of the corresponding resource is greater than the first sub-threshold.
[0083] Step S420: If the resource value of the target resource meets the sub-trigger condition corresponding to the target resource, then use the resource recycling strategy corresponding to the recycling trigger condition to recycle at least part of the resources currently occupied by the target application, and the target resource is any one of the multiple resources.
[0084] It is understandable that although there is no direct connection between the memory value, CPU time slice and disk storage space occupied by the target application, there will be a certain influence between them. For example, when the CPU time slice occupied by the target application is high or the disk storage space occupied is large, the memory value occupied by the target application will generally be high. Therefore, it is possible to determine whether the resource value of the target resource meets the sub-trigger condition corresponding to the target resource, that is, to determine whether the resource value of each resource meets the sub-trigger condition corresponding to the resource.
[0085] Optionally, if the resource value of the target resource meets the sub-trigger condition corresponding to the target resource, that is, if there is a resource that meets its corresponding sub-trigger condition, it can be determined that the target application occupies too much resource value to a certain extent, and then the resource recovery strategy corresponding to the recovery trigger condition can be used to recycle at least part of the resources currently occupied by the target application, thereby realizing timely recovery of the resources occupied by the target application.
[0086] In some embodiments, the resource recovery strategy includes multiple sub-recovery strategies, and the multiple sub-recovery strategies correspond one-to-one to multiple resources. Based on this, if the resource value of the target resource meets the sub-trigger condition corresponding to the target resource, the sub-recovery strategy corresponding to the target resource is used to recycle at least part of the target resources currently occupied by the target application. In other words, sub-trigger conditions and sub-recovery strategies are set correspondingly for various resources occupied by the target application. Therefore, when any resource meets its corresponding sub-trigger condition, the corresponding sub-recovery strategy is called to recycle at least part of the resources currently occupied by the target application. In this way, a more refined and more fine-grained resource recovery process for the resources occupied by the application is achieved.
[0087] For example, if the target resource is memory, that is, if the memory value of the target application meets the sub-trigger condition corresponding to the memory, the sub-recycling strategy corresponding to the memory can be used to recycle at least part of the memory pages currently occupied by the target application. The same is true if the target resource is CPU time slice or disk storage space, and no further examples are given here.
[0088] In other embodiments, the resource recycling strategy includes a plurality of sub-recycling strategies, and the plurality of sub-recycling strategies correspond one to one with the plurality of resources. Based on this, if the resource value of the target resource meets the sub-trigger condition corresponding to the target resource, each of the sub-recycling strategies is used respectively to recycle the resources corresponding to each sub-recycling strategy currently occupied in the target application. In other words, if the resource value of the target resource among the plurality of resources meets the sub-trigger condition corresponding to the target resource, in order to avoid the target application from occupying too much resource values of resources other than the target resource in subsequent operation, the sub-recycling strategy corresponding to the target resource can be used in advance to recycle the target resource occupied by the target application, and at the same time, various other resources occupied by the target application can also be recycled, that is, pre-recycling of resources is realized, which helps to improve the running smoothness of electronic devices.
[0089] In some other embodiments, the recycling trigger condition includes multiple sub-trigger conditions, and the multiple sub-trigger conditions correspond one-to-one to the multiple resources. After step S410, when the resource value occupied by each resource meets the sub-trigger condition corresponding to each resource, the resource recycling strategy corresponding to the recycling trigger condition can be used to recycle at least part of the resources currently occupied by the target application. It can be understood that after a more comprehensive evaluation of the resource occupancy of the target application, it is more comprehensive and accurate to determine whether the target application needs to recycle resources, thereby better realizing the recycling of resources occupied by the target application.
[0090] In this embodiment, a corresponding stop recycling condition may also be set for each resource, and the stop recycling condition includes at least one of the following conditions: the recycled resource value is greater than or equal to the fourth resource threshold; the ratio of the recycled resource value to the resource value currently occupied by the target application is greater than or equal to the first threshold; the ratio of the resource value occupied by the target application after resource recycling to the first resource threshold is less than or equal to the second threshold, and the second threshold is a positive number less than 1. Among them, the thresholds in the stop recycling conditions corresponding to various resources can be set to different values according to requirements, which will not be repeated here.
[0091] In this embodiment, it is possible to determine whether the resources occupied by the target application need to be recycled based on the resource values of the various resources occupied by the target application and the sub-trigger conditions corresponding to each resource; and if resource recycling is required, for each resource, a sub-recycling strategy corresponding to each resource can be used to perform more targeted resource recycling. In this way, more fine-grained resource recycling can be achieved, thereby more comprehensively avoiding the occurrence of problems such as the inability of the application to run normally due to insufficient resources, thereby greatly improving the running smoothness of the application in the electronic device.
[0092] Please refer to Figure 5 , which shows a structural block diagram of a resource management device 500 provided in an embodiment of the present application. The device 500 may include: a resource value acquisition module 510 and a resource recovery module 520.
[0093] The resource value acquisition module 510 is used to acquire the resource value currently occupied by the target application, where the target application is any application currently running.
[0094] The resource recovery module 520 is used to recycle at least part of the resources currently occupied by the target application using the resource recovery strategy corresponding to the recovery trigger condition if the resource value meets the recovery trigger condition, and the recovery trigger condition at least includes that the occupied resource value is greater than the first resource threshold.
[0095] In some embodiments, the resource management device 500 may further include: an operation status acquisition module and a recycling trigger condition acquisition module. Among them, the operation status acquisition module can be used to obtain the current operation status of the target application before the resource value meets the recycling trigger condition, and at least part of the resources currently occupied by the target application are recycled using the resource recycling strategy corresponding to the recycling trigger condition. The recycling trigger condition acquisition module can be used to obtain the foreground trigger condition corresponding to the foreground operation state as the recycling trigger condition if the current operation state is the foreground operation state; if the current operation state is the background operation state, obtain the background trigger condition corresponding to the background operation state as the recycling trigger condition, and the first resource threshold in the foreground trigger condition is less than the first resource threshold in the background trigger condition.
[0096] In this manner, the resource value is a memory value, and the resource recovery module 520 can be specifically used to: if the memory value meets the foreground trigger condition, recycle at least some of the memory pages in the inactive memory list corresponding to the target application; if the memory value meets the background trigger condition, recycle all memory pages in the memory group corresponding to the target application, or recycle at least some of the memory pages in the inactive memory list corresponding to the target application.
[0097] In some implementations, the resource value is a memory value, the first resource threshold is a first memory threshold, and the resource recovery module 520 can be specifically used to: if the currently occupied memory value is greater than the first memory threshold, the file pages in the inactive file page list are recovered.
[0098] In other embodiments, the recycling trigger condition includes at least one of the following conditions: the occupied resource value is greater than the first resource threshold and the remaining resource value is less than the second resource threshold; and the occupied resource value is greater than the first resource threshold and the remaining available resource value is less than a third resource threshold.
[0099] In this manner, the resource value is a memory value, the first resource threshold is a first memory threshold, the second resource threshold is a second memory threshold, the third resource threshold is a third memory threshold, the remaining resource value is a remaining memory value, and the remaining available resource value is a remaining available memory value. The resource recovery module 520 can be specifically used to: if the currently occupied memory value is greater than the first memory threshold and the remaining memory value is less than the second memory threshold, then reclaim the file pages in the inactive file page list and compress the anonymous pages in the inactive anonymous page list corresponding to the target application; if the currently occupied memory value is greater than the first memory threshold and the remaining available memory value is less than the third memory threshold, then reclaim all memory pages in the memory group corresponding to the target application.
[0100] In some implementations, the resource management device 500 may further include: a resource prediction module. The resource prediction module may be used to predict the resource value occupied by the target application at a target time after the current time, as the predicted resource value, if the resource value does not meet the recycling trigger condition after the resource currently occupied by the target application is obtained.
[0101] In this manner, the resource recovery module 520 may be specifically configured to, if the predicted resource value meets the recovery trigger condition, utilize the resource recovery strategy corresponding to the recovery trigger condition to recover at least part of the resources currently occupied by the target application.
[0102] In some implementations, the resource value includes the resource value of each resource among the multiple resources occupied by the target application, and the recycling trigger condition includes multiple sub-trigger conditions, and the multiple sub-trigger conditions correspond to the multiple resources one by one. The resource recycling module 520 can be specifically used to: if the resource value of the target resource meets the sub-trigger condition corresponding to the target resource, then use the resource recycling strategy corresponding to the recycling trigger condition to recycle at least part of the resources currently occupied by the target application, and the target resource is any one of the multiple resources.
[0103] In this manner, the resource recovery strategy includes multiple sub-recovery strategies, and the multiple sub-recovery strategies correspond one-to-one to the multiple resources. The resource recovery module 520 can also be specifically used for: if the resource value of the target resource meets the sub-trigger condition corresponding to the target resource, then using the sub-recovery strategy corresponding to the target resource, at least part of the target resources currently occupied by the target application are recovered.
[0104] In some implementations, the resource value includes the resource value of each resource among the multiple resources occupied by the target application, and the recycling trigger condition includes multiple sub-trigger conditions, and the multiple sub-trigger conditions correspond to the multiple resources one by one. The resource recycling module 520 can be specifically used to: if the resource value occupied by each resource meets the sub-trigger condition corresponding to each resource, then use the resource recycling strategy corresponding to the recycling trigger condition to recycle at least part of the resources currently occupied by the target application.
[0105] In some embodiments, the resource recovery module 520 can be specifically used to: if the resource value meets the recovery trigger condition, then use the resource recovery strategy corresponding to the recovery trigger condition to recycle at least part of the resources currently occupied by the target application until the recovered resource value meets the stop recovery condition.
[0106] In this mode, the condition for stopping recycling includes at least one of the following conditions: the recycled resource value is greater than or equal to the fourth resource threshold; the ratio of the recycled resource value to the resource value currently occupied by the target application is greater than or equal to the first threshold; and the ratio of the resource value occupied by the target application after resource recycling to the first resource threshold is less than or equal to the second threshold, and the second threshold is a positive number less than 1.
[0107] In some implementations, the resource value includes at least one of a memory value, a CPU time slice, and a disk storage space.
[0108] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0109] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical or other forms of coupling.
[0110] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0111] In summary, this embodiment recycles resources based on applications as units, which can achieve more refined resource management; and when the resource value occupied by any running application meets the recycling trigger condition, resource recycling can be performed using a resource recycling strategy that is adapted to the recycling trigger condition from a variety of resource recycling strategies, which can also better and more flexibly achieve resource recycling, thereby effectively avoiding the occurrence of problems such as insufficient system resources of electronic devices, which leads to application freezes or flashbacks. In addition, for target applications in different operating states, more adapted recycling trigger conditions can be used to more accurately determine whether resource recycling is required; and, when resource recycling is required, a more adapted recycling strategy can be used to more effectively and accurately achieve resource recycling. In this way, the intelligence and flexibility of resource management are greatly improved.
[0112] The following will be combined Figure 6 An electronic device provided by the present application is described.
[0113] Reference Figure 6 , Figure 6The structural block diagram of an electronic device 600 provided in an embodiment of the present application is shown, and the above method provided in an embodiment of the present application can be executed by the electronic device 600. The electronic device can be an electronic terminal with a data processing function, and the electronic terminal includes but is not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart watch, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Compression Standard Audio Layer 3) player, an MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Compression Standard Audio Layer 4) player, and smart home devices, etc.; of course, the electronic device can also be a server, and the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
[0114] The electronic device 600 in the embodiment of the present application may include one or more of the following components: a processor 601, a memory 602, and one or more applications, wherein the one or more applications may be stored in the memory 602 and configured to be executed by one or more processors 601, and the one or more programs are configured to execute the method described in the aforementioned method embodiment.
[0115] The processor 601 may include one or more processing cores. The processor 601 uses various interfaces and lines to connect the various parts of the entire electronic device 600, and executes various functions and processes data of the electronic device 600 by running or executing instructions, programs, code sets or instruction sets stored in the memory 602, and calling data stored in the memory 602. Optionally, the processor 601 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 601 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem can also be integrated into the processor 601 and implemented separately through a communication chip.
[0116] The memory 602 may include a random access memory (RAM) or a read-only memory (ROM). The memory 602 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as the various corresponding relationships described above) created by the electronic device 600 during use.
[0117] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0118] In several embodiments provided in the present application, the coupling or direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or modules, which may be electrical, mechanical or other forms.
[0119] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0120] Please refer to Figure 7 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 700 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.
[0121] The computer readable storage medium 700 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 700 includes a non-transitory computer-readable storage medium. The computer readable storage medium 700 has storage space for program code 710 that performs any method step of the above method. These program codes can be read from or written to one or more computer program products. The program code 710 can be compressed, for example, in an appropriate form.
[0122] In some embodiments, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs the steps in the above-mentioned method embodiments.
[0123] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A resource management method, characterized in that: The method comprises: Obtaining the resource value currently occupied by the target application, wherein the target application is any running application; If the resource value meets the recycling trigger condition, the resource recycling strategy corresponding to the recycling trigger condition is used to recycle at least part of the resources currently occupied by the target application. The recycling trigger condition at least includes that the occupied resource value is greater than a first resource threshold.
2. The method according to claim 1, before the resource value meets the recycling trigger condition, using the resource recycling strategy corresponding to the recycling trigger condition to recycle at least part of the resources currently occupied by the target application, the method further comprises: Obtaining the current running status of the target application; If the current running state is the foreground running state, obtaining the foreground triggering condition corresponding to the foreground running state as the recycling triggering condition; If the current running state is a background running state, the background trigger condition corresponding to the background running state is obtained as the recycling trigger condition, and the first resource threshold in the foreground trigger condition is less than the first resource threshold in the background trigger condition.
3. The method according to claim 2, characterized in that The resource value is a memory value; If the resource value meets the recycling trigger condition, then using the resource recycling strategy corresponding to the recycling trigger condition to recycle at least part of the resources currently occupied by the target application, including: If the memory value meets the foreground trigger condition, reclaiming at least part of the memory pages in the inactive memory list corresponding to the target application; If the memory value meets the background trigger condition, all memory pages in the memory group corresponding to the target application are recycled, or at least part of the memory pages in the inactive memory list corresponding to the target application are recycled.
4. The method according to claim 1, characterized in that The resource value is a memory value, and the first resource threshold is a first memory threshold; If the resource value meets the recycling trigger condition, then using the resource recycling strategy corresponding to the recycling trigger condition to recycle at least part of the resources currently occupied by the target application, including: If the currently occupied memory value is greater than the first memory threshold, the file pages in the inactive file page list are recycled.
5. The method according to claim 1, characterized in that: The recycling trigger condition includes at least one of the following conditions: The occupied resource value is greater than the first resource threshold and the remaining resource value is less than the second resource threshold; and The occupied resource value is greater than the first resource threshold and the remaining available resource value is less than the third resource threshold.
6. The method according to claim 5, characterized in that The resource value is a memory value, the first resource threshold is a first memory threshold, the second resource threshold is a second memory threshold, the third resource threshold is a third memory threshold, the remaining resource value is a remaining memory value, and the remaining available resource value is a remaining available memory value; If the resource value meets the recycling trigger condition, then using the resource recycling strategy corresponding to the recycling trigger condition to recycle at least part of the resources currently occupied by the target application, including: If the currently occupied memory value is greater than the first memory threshold and the remaining memory value is less than the second memory threshold, the file pages in the inactive file page list are recycled, and the anonymous pages in the inactive anonymous page list corresponding to the target application are compressed; If the currently occupied memory value is greater than the first memory threshold and the remaining available memory value is less than the third memory threshold, all memory pages in the memory group corresponding to the target application are recycled.
7. The method according to claim 1, characterized in that After obtaining the resources currently occupied by the target application, the method further includes: If the resource value does not meet the recycling trigger condition, predicting the resource value occupied by the target application at a target time after the current time as the predicted resource value; If the predicted resource value meets the recycling trigger condition, at least part of the resources currently occupied by the target application are recycled using the resource recycling strategy corresponding to the recycling trigger condition.
8. The method according to any one of claims 1 to 7, characterized in that: The resource value includes the resource value of each resource among the multiple resources occupied by the target application, and the recycling trigger condition includes multiple sub-trigger conditions, and the multiple sub-trigger conditions correspond to the multiple resources one by one; If the resource value meets the recycling trigger condition, then using the resource recycling strategy corresponding to the recycling trigger condition to recycle at least part of the resources currently occupied by the target application, including: If the resource value of the target resource meets the sub-trigger condition corresponding to the target resource, the resource recycling strategy corresponding to the recycling trigger condition is used to recycle at least part of the resources currently occupied by the target application, and the target resource is any one of the multiple resources.
9. The method according to claim 8, characterized in that The resource recycling strategy includes a plurality of sub-recycling strategies, and the plurality of sub-recycling strategies correspond one to one to the plurality of resources; If the resource value of the target resource meets the sub-trigger condition corresponding to the target resource, then using the resource recycling strategy corresponding to the recycling trigger condition to recycle at least part of the resources currently occupied by the target application, including: If the resource value of the target resource meets the sub-trigger condition corresponding to the target resource, the sub-recycling strategy corresponding to the target resource is used to recycle at least part of the target resource currently occupied by the target application.
10. The method according to any one of claims 1 to 7, characterized in that: The resource value includes the resource value of each resource among the multiple resources occupied by the target application, and the recycling trigger condition includes multiple sub-trigger conditions, and the multiple sub-trigger conditions correspond to the multiple resources one by one; If the resource value meets the recycling trigger condition, then using the resource recycling strategy corresponding to the recycling trigger condition to recycle at least part of the resources currently occupied by the target application, including: If the resource value occupied by each resource meets the sub-trigger condition corresponding to each resource, then the resource recycling strategy corresponding to the recycling trigger condition is used to recycle at least part of the resources currently occupied by the target application.
11. The method according to any one of claims 1 to 7, characterized in that: If the resource value meets the recycling trigger condition, then using the resource recycling strategy corresponding to the recycling trigger condition to recycle at least part of the resources currently occupied by the target application, including: If the resource value meets the recycling trigger condition, the resource recycling strategy corresponding to the recycling trigger condition is used to recycle at least part of the resources currently occupied by the target application until the recycled resource value meets the stop recycling condition.
12. The method according to claim 11, characterized in that The stopping recycling condition includes at least one of the following conditions: The recovered resource value is greater than or equal to the fourth resource threshold; The ratio of the recovered resource value to the resource value currently occupied by the target application is greater than or equal to a first threshold; as well as The ratio of the resource value occupied by the target application after resource recycling to the first resource threshold is less than or equal to a second threshold, and the second threshold is a positive number less than 1.
13. The method according to any one of claims 1 to 7, characterized in that: The resource value includes at least one of a memory value, a CPU time slice, and a disk storage space.
14. A resource management device, characterized in that: The device comprises: A resource value acquisition module, used to acquire the resource value currently occupied by a target application, wherein the target application is any running application; A resource recovery module is used to recycle at least part of the resources currently occupied by the target application using a resource recovery strategy corresponding to the recovery trigger condition if the resource value meets the recovery trigger condition, and the recovery trigger condition at least includes that the occupied resource value is greater than a first resource threshold.
15. An electronic device, characterized in that: include: one or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to execute the method according to any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, which can be called by a processor to execute the method according to any one of claims 1 to 13.