Memory data processing method and device, terminal equipment and storage medium
By dynamically adjusting the memory resource pressure detection window and monitoring frequency, the problems of false positives when the system is under too much pressure and slow detection and killing when the pressure is too low are solved, and the reasonable release and management of memory data are achieved.
Patent Information
- Application Number
- CN202510758122.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-09-19
AI Technical Summary
In the prior art, when the system pressure is too high, the memory check and kill is too hasty, resulting in false positives; or when the pressure is too low, the check and kill is slow, which cannot effectively relieve the system pressure.
By obtaining the current memory usage information, the target detection window information of resource pressure detection is determined, resource management and control are performed based on the target detection window information and resource pressure information, and the monitoring frequency is dynamically adjusted to avoid excessive or insufficient release.
It increases the resource monitoring frequency when the system pressure is too high to prevent insufficient resource release; reduces the monitoring frequency when the system pressure is too low to avoid excessive resource release and ensure reasonable management of memory data.
Smart Images

Figure CN120670156A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a memory data processing method, apparatus, terminal device, and storage medium. Background Art
[0002] PSI (Pressure Stall Information) information represents the current system pressure. Excessive system pressure triggers a memory check, or purge, in existing technology. However, this approach, based on PSI pressure monitoring, is overly responsive and can often lead to false positives. Alternatively, conventional memory purges can be slow and ineffective, often failing to relieve system pressure. Therefore, addressing the overly hasty or slow purge issues inherent in existing technology is crucial. Summary of the Invention
[0003] The present application provides a memory data processing method that can effectively avoid the situation where memory data is excessively released or not fully released.
[0004] In a first aspect, the present application provides a method for processing memory data, the method comprising:
[0005] Get current memory usage information;
[0006] Determining target detection window information for resource pressure detection based on the current memory usage information;
[0007] determining resource pressure information based on the target detection window information;
[0008] Resource control processing is performed according to the resource pressure information to obtain a resource control result.
[0009] In some embodiments of the present application, the current memory usage information includes the current memory usage percentage;
[0010] The obtaining of current memory usage information includes:
[0011] Get the current free memory capacity and total memory capacity;
[0012] The current memory usage ratio is calculated based on the current free memory capacity and the total memory capacity.
[0013] In some embodiments of the present application, obtaining the current free memory capacity includes:
[0014] Get the initial free memory capacity for multiple samplings;
[0015] The current free memory capacity is determined according to the average memory capacity of each of the initial free memory capacities.
[0016] In some embodiments of the present application, determining target detection window information for resource pressure detection based on the current memory usage information includes:
[0017] Obtaining a first coefficient and a second coefficient;
[0018] Target detection window information for resource pressure detection is determined according to the first coefficient, the second coefficient, and the current memory usage ratio.
[0019] In some embodiments of the present application, determining resource pressure information according to the target detection window information includes:
[0020] Get the initial detection window information for detecting resource pressure;
[0021] The initial detection window information is replaced with the target detection window information to determine the resource pressure information within a time window represented by the target detection window information.
[0022] In some embodiments of the present application, determining resource pressure information within the time window represented by the target detection window information includes:
[0023] Determine resource pressure thresholds;
[0024] Within the time window represented by the target detection window information, the magnitude between the current resource pressure and the resource pressure threshold is determined to obtain resource pressure information.
[0025] In some embodiments of the present application, performing resource control processing according to the resource pressure information to obtain a resource control result includes:
[0026] If the resource pressure information indicates that the resource is in a non-pressure state, continue to obtain current memory usage information to determine the target detection window information and the resource pressure information;
[0027] If the resource pressure information indicates that the resource is under pressure, determining the current resource pressure level;
[0028] Determine the data weight corresponding to all memory data in the current memory data;
[0029] Resource control processing is performed according to the current resource pressure level and the data weight corresponding to each memory data to obtain a resource control result.
[0030] In a second aspect, the present application further provides a memory data processing device, the device comprising:
[0031] Acquisition module, used to obtain current memory usage information;
[0032] a determination module, configured to determine target detection window information for resource pressure detection based on the current memory usage information;
[0033] The determination module is further configured to determine resource pressure information based on the target detection window information;
[0034] The processing module is used to perform resource control processing according to the resource pressure information to obtain a resource control result.
[0035] In a third aspect, the present application also provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and runnable on the processor, wherein the processor executes the computer program to implement the steps in any one of the memory data processing methods.
[0036] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to implement the steps in any one of the memory data processing methods.
[0037] The memory data processing method provided by this application can reflect the current resource usage of the system based on the current memory usage information, thereby determining the size of the target detection window information based on the specific current resource usage, so that the larger the memory usage, the smaller the target detection window information; the smaller the memory usage, the larger the target detection window information, so that the smaller the window value, the greater the monitoring frequency, and the larger the window value, the lower the monitoring frequency. In this way, when the system pressure is too high, the resource monitoring frequency can be increased to prevent the situation where resources are not released in place, and when the system pressure is too low, the resource monitoring frequency can be reduced to prevent excessive release of resources, thus avoiding the situation where memory data is excessively released or not released in place. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0039] Figure 1 This is a schematic diagram of a memory data processing system provided in an embodiment of the present application;
[0040] Figure 2 This is a flow chart of an embodiment of a method for processing memory data in an embodiment of the present application;
[0041] Figure 3This is a schematic diagram of a functional module of the memory data processing device in an embodiment of the present application;
[0042] Figure 4 It is a structural diagram of the terminal device in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0044] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "plurality" means two or more, unless otherwise specifically defined.
[0045] In this application, the word "exemplary" is used to mean "serving as an example, illustration, or illustration." Any embodiment described in this application as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. At the same time, it is understood that in the specific implementation of this application, when user information, user data, and other related data are involved, when the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use, and processing of relevant data must comply with relevant laws, regulations, and standards of relevant countries and regions.
[0046] The following description is provided to enable any person skilled in the art to implement and use the present application. In the following description, details are listed for the purpose of explanation. It should be understood that one of ordinary skill in the art will recognize that the present application can be implemented without using these specific details. In other examples, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present application with unnecessary details. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest range of principles and features disclosed in the present application.
[0047] The present application provides a memory data processing method, apparatus, device, and storage medium, which are described in detail below.
[0048] See also Figure 1 , Figure 1This is a schematic diagram of a memory data processing system provided in an embodiment of the present application. The memory data processing system may include a terminal device 100 and a storage device 200. The storage device 200 may transmit data to the terminal device 100. Figure 1 The terminal device 100 in the embodiment can obtain the program stored in the storage device 200 to execute the memory data processing method in this application.
[0049] In the embodiment of the present application, the terminal device 100 includes but is not limited to a desktop computer, a portable computer, a network server, a PDA (Personal Digital Assistant), a tablet computer, a wireless terminal device, an embedded device, a mobile phone, etc.
[0050] In the embodiments of the present application, communication between the terminal device 100 and the storage device 200 can be achieved through any communication method, including but not limited to mobile communications based on the 3rd Generation Partnership Project (3GPP), Long Term Evolution (LTE), and Worldwide Interoperability for Microwave Access (WiMAX), or computer network communications based on the TCP / IP Protocol Suite (TCP / IP) and User Datagram Protocol (UDP). It should be noted that the storage device 200 can also be built into the terminal device 100, and the specific embodiments of the present application are not limited thereto.
[0051] It should be noted that Figure 1 The scenario diagram of the memory data processing system shown is only an example. The memory data processing system and scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided by the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the memory data processing system and the emergence of new business scenarios, the technical solution provided by the embodiment of the present application is also applicable to similar technical problems.
[0052] like Figure 2 As shown, Figure 2 This is a flow chart of an embodiment of a method for processing memory data in an embodiment of the present application. The method for processing memory data may include the following steps 201 to 204:
[0053] 201. Get current memory usage information.
[0054] In the embodiments of the present application, the current memory usage information can be read using any memory reading method. For example, existing electronic devices all have memory allocation mechanisms that can constantly obtain the current memory usage information and thus perform relevant memory allocations. Therefore, the current memory usage information can be obtained through the memory allocation mechanism of the electronic device or other related programs, and the specific embodiments of the present application are not specifically limited thereto.
[0055] 202. Determine target detection window information for resource pressure detection based on current memory usage information.
[0056] In an embodiment of the present application, resource pressure detection can be a memory pressure monitoring program in an electronic device. For example: PSI (Pressure Stall Information) is an indicator for monitoring system load and pressure, mainly used in operating systems such as Linux, especially resource management in containerized environments (such as Kubernetes), which can monitor whether the system or container has resource bottlenecks when processing loads, especially in terms of CPU, memory, and I / O. Among them, real-time monitoring of resource pressure: PSI can reflect the pressure of resources in real time, helping administrators to quickly find bottlenecks and make adjustments. Including: Optimizing resource management: Through PSI data, system administrators can adjust resource configuration to prevent excessive load; Performance tuning: In a container environment, PSI can help identify specific resource bottlenecks, and further perform performance tuning and troubleshooting.
[0057] When the system performs PSI memory monitoring, it usually requires a window time for monitoring. For example, if PSI monitoring is performed periodically, this monitoring period can be regarded as window information. It can be seen that the smaller the window information, the higher the PSI monitoring frequency, and the larger the window information, the lower the PSI monitoring frequency. In actual situations, the system's resource pressure information may change quickly. If the PSI monitoring frequency is higher, once the resource pressure information changes, PSI can monitor the change in resource pressure information. Conversely, the lower the PSI monitoring frequency, the system may not be able to know that the resource pressure information has changed even after it changes, which may cause the problem of memory data not being released in time.
[0058] Based on this, in an embodiment of the present application, after obtaining the current memory usage information, by setting different memory occupancy threshold intervals, it is determined which specific interval the current memory usage information is in, thereby determining the target detection window information. For example, the interval of 0-2G, the interval of 2-4G, the interval of 4-6G, the interval of 8-10G, etc., each interval can correspond to a detection window information. If the current memory usage information belongs to the interval of 2-4G, then the detection window information corresponding to the interval of 2-4G is determined to be the target detection window information. Alternatively, if the current memory usage information belongs to the interval of 8-10G, then the detection window information corresponding to the interval of 8-10G is determined to be the target detection window information. Among them, the detection window information can decrease as the interval value increases. At this time, when the interval value belongs to is larger, it means that the system pressure is greater. At this time, if the corresponding detection window information is set to be smaller, the greater the system pressure, the higher the monitoring frequency can be achieved. In this way, the system pressure can be monitored in real time, thereby timely implementing operations such as resource release to relieve system pressure.
[0059] 203. Determine resource pressure information based on the target detection window information.
[0060] According to the above embodiment, after determining the target detection window information, PSI monitoring needs to be performed within the window period. This PSI monitoring can be the method for determining resource pressure information in the embodiments of the present application. Of course, system pressure can also be monitored by other methods. For details, any system pressure detection scheme can be referred to, and the embodiments of the present application are not limited thereto.
[0061] For ease of explanation, the following embodiments of this application will be described using PSI monitoring. Specifically, if the number of PSI monitoring cycles is fixed and the target detection window is smaller, the PSI monitoring frequency is higher. In other words, if memory usage is too high, the system pressure may increase, requiring a higher pressure monitoring frequency to improve the sensitivity of pressure monitoring.
[0062] Conversely, if the target detection window is larger, while the PSI monitoring intensity remains constant, the frequency of resource pressure information obtained through PSI monitoring will decrease, and the system's response to determining system pressure based on resource pressure information will become slower. In other words, when memory usage is low, the likelihood of excessive system pressure is low, and intensive PSI monitoring is unnecessary. Therefore, pressure information derived from PSI monitoring will not be as sensitive to system pressure, which can appropriately reduce the frequency of release program calculations.
[0063] 204. Perform resource control processing based on the resource pressure information to obtain a resource control result.
[0064] According to the above steps, resource pressure information can be obtained using either a high-frequency method or a low-frequency method. Therefore, if it is obtained using a high-frequency method, the frequency of resource control decisions based on resource pressure information will also increase. Conversely, if resource pressure information is obtained using a low-frequency method, the frequency of resource control decisions based on resource pressure information will also decrease.
[0065] For example, if resource pressure information is received 100 times per second, the system will perform a pressure assessment each time it receives it. If the system pressure is judged to be excessive, the system will respond quickly and implement resource control. If resource pressure information is only received 10 times per second, the system will assess pressure less frequently than 100 times per second, and the frequency of resource control will also decrease.
[0066] In addition, in an embodiment of the present application, resource management can be to release memory or directly close the program, for example, when the browser is in the background, clear the cached data in the browser page but do not close the browser; or directly close the browser, etc. The specific management process can be based on the system settings, and the embodiment of the present application does not limit it.
[0067] The memory data processing method provided by this application can reflect the current resource usage of the system based on the current memory usage information, thereby determining the size of the target detection window information based on the specific current resource usage, so that the larger the memory usage, the smaller the target detection window information; the smaller the memory usage, the larger the target detection window information, so that the smaller the window value, the greater the monitoring frequency, and the larger the window value, the lower the monitoring frequency. In this way, when the system pressure is too high, the resource monitoring frequency can be increased to prevent the situation where resources are not released in place, and when the system pressure is too low, the resource monitoring frequency can be reduced to prevent excessive release of resources, thus avoiding the situation where memory data is excessively released or not released in place.
[0068] To better implement the embodiments of the present application, in one embodiment of the present application, the current memory usage information includes the current memory usage percentage; obtaining the current memory usage information includes:
[0069] Get the current free memory capacity and total memory capacity; calculate the current memory usage ratio based on the current free memory capacity and total memory capacity.
[0070] The above embodiment provides a solution for treating the current memory usage information as a specific memory usage value. In an embodiment of the present application, there is also provided a solution for treating the current memory usage information as a current memory usage percentage. In different electronic devices, the memory size of different devices is different, so this can better adapt to the memory usage of different electronic devices themselves.
[0071] Specifically, please refer to formula (1), which is as follows:
[0072] ratio=(MemTotal-MemFree) / MemTotal……(1)
[0073] Where ratio is the current memory usage ratio in this embodiment; MemTotal is the total memory capacity in this embodiment; and MemFree is the current free memory capacity in this embodiment. The total memory capacity of the electronic device can be directly obtained based on the parameters of the memory device. The method for obtaining the current free memory capacity is the same as the method for obtaining the current memory usage information in the above embodiment, and will not be repeated in this embodiment.
[0074] Of course, after obtaining the current memory usage percentage, you can set different percentage threshold intervals, such as 0-20%, 20%-40%, 40%-60%, 60%-80%, and 80%-100%. Different intervals correspond to different detection window information. After determining the target detection window information, the subsequent program flow is the same as the above numerical interval method, and I will not elaborate on it here.
[0075] To better implement the embodiments of the present application, in one embodiment of the present application, obtaining the current free memory capacity includes:
[0076] Obtaining initial free memory capacities of multiple samples; and determining current free memory capacity according to an average memory capacity of each initial free memory capacity.
[0077] The above embodiment provides a solution for obtaining the current free memory capacity according to the corresponding program and calculating the current memory usage ratio. In order to avoid errors in the calculation of the current memory usage ratio, the embodiment of the present application also provides a solution.
[0078] Specifically, when obtaining the current free memory capacity, a windowing mechanism can be used to sample the most recent current free memory capacity. These current free memory capacities can be considered the initial current free memory capacity. The current free memory capacity can then be calculated by averaging these initial current free memory capacities. This method minimizes error in the current free memory capacity.
[0079] Therefore, when the error of the current free memory capacity is reduced, the error of the subsequent calculation of the current memory usage ratio based on the current free memory capacity can also be reduced.
[0080] To better implement the embodiments of the present application, in one embodiment of the present application, target detection window information for resource pressure detection is determined based on current memory usage information, including:
[0081] Obtain a first coefficient and a second coefficient; and determine target detection window information for resource pressure detection based on the first coefficient, the second coefficient, and the current memory usage ratio.
[0082] The above embodiment provides a method for determining target detection window information based on the correspondence between intervals and window information. However, this method requires setting the specific value of the detection window information in advance, which is less flexible in actual situations. Therefore, this application also provides another method.
[0083] Specifically, please refer to formula (2), which is as follows:
[0084] win=9e -k×ratio ×1000000(microseconds)……(2)
[0085] Among them, 9e is the first coefficient in the embodiment of the present application, e is a natural constant; k is the second coefficient in the embodiment of the present application, and k can be set according to actual conditions; ratio is the current memory usage ratio in the embodiment of the present application; win is the target detection window information in the embodiment of the present application.
[0086] Based on this, after obtaining the current memory usage percentage, the corresponding target detection window information can be obtained by substituting it into formula (2). After obtaining the target detection window information, resource management can be performed according to any of the above implementations, which will not be repeated here.
[0087] To better implement the embodiments of the present application, in one embodiment of the present application, determining resource pressure information based on target detection window information includes:
[0088] Initial detection window information for detecting resource pressure is obtained; the initial detection window information is replaced with target detection window information to determine resource pressure information within a time window represented by the target detection window information.
[0089] In practice, the system maintains a fixed detection window. This means that the PSI monitoring frequency cannot be adjusted under normal circumstances. If the system experiences excessive stress, the inability to adjust the monitoring frequency can lead to low monitoring sensitivity, making it difficult to promptly release memory or terminate programs. Furthermore, even when the system is not stressed, stress testing will continue at the fixed frequency, wasting system computing resources.
[0090] In the above embodiments, the target detection window information is directly calculated before the subsequent control operations are continued. Therefore, if any of the above embodiments are used on an existing electronic device, a system bug may occur. That is, if the existing electronic device has its own window information and a new target detection window information is obtained at this time, the system will not be able to perform pressure monitoring based on the two window information. Therefore, a system bug may occur.
[0091] To avoid the bug, the solution requires replacing the system's own window information with the calculated target detection window information when using existing electronic devices. This way, when there is only one window information, the system can directly perform subsequent operations based on that window information, thus avoiding the bug.
[0092] To better implement the embodiments of the present application, in one embodiment of the present application, determining resource pressure information within a time window represented by target detection window information includes:
[0093] Determine a resource pressure threshold; within a time window represented by the target detection window information, determine the magnitude of the current resource pressure and the resource pressure threshold to obtain resource pressure information.
[0094] In the above embodiment, the resource pressure information of the system is determined by PSI. In order to further determine the more detailed embodiment of the present application, a solution is also provided.
[0095] Specifically, the pressure information determined and monitored by the PSI can be used as initial pressure information. After determining the initial pressure information, it can be compared with a set resource pressure threshold. If the initial pressure information is greater than the resource pressure threshold, resource pressure information indicating excessive system pressure is obtained. Conversely, if the initial pressure information is less than or equal to the pressure threshold, resource pressure information indicating low system pressure is obtained.
[0096] If resource pressure information indicating excessive pressure is obtained, resource management and control can be performed based on the specific situation, and this embodiment of the present application will not be further described.
[0097] In order to better implement the embodiments of the present application, in one embodiment of the present application, resource control processing is performed based on resource pressure information to obtain resource control results, including:
[0098] If the resource pressure information indicates that the resource is in a non-stressed state, continue to obtain the current memory usage information to determine the target detection window information and resource pressure information; if the resource pressure information indicates that the resource is in a stressed state, determine the current resource pressure level; determine the data weights corresponding to all memory data in the current memory data; perform resource control processing based on the current resource pressure level and the data weights corresponding to each memory data to obtain the resource control results.
[0099] The above embodiment provides a solution for obtaining resource pressure information based on a pressure threshold. In order to refine resource management and control, the embodiment of the present application also provides a solution.
[0100] Specifically, if the resource pressure information indicates that the resource is in a non-pressure state, that is, is less than or equal to the pressure threshold, the system pressure monitoring process in the above steps is repeatedly executed.
[0101] If the resource pressure information indicates that the resource is in a stressed state, that is, greater than the pressure threshold, other pressure level threshold intervals can be obtained, and it can be determined to which specific pressure level threshold interval the initial pressure information belongs, thereby obtaining the target pressure level threshold interval. Each pressure level threshold interval can correspond to a specific amount of memory released data or a specific number of application program kill data. For example: the pressure level threshold interval corresponds to a specific pressure level, and the higher the pressure level, the greater the amount of memory data released, or the greater the number of applications killed.
[0102] Afterwards, the weight corresponding to each memory data or the weight of the currently running application can be determined according to the specific pressure level. For example: the weight of the memory data is determined according to the frequency of the system calling each memory data. The higher the calling frequency, the higher the weight of the data, and the lower the calling frequency, the lower the weight of the data; or, the more frequently an application is used, the higher the weight of the program, and the less frequently an application is used, the lower the weight of the program. At this time, according to the specific pressure level, determine the specific amount of data that needs to be released or the number of programs that need to be killed, and sort the data or programs according to the weight, and give priority to killing data with low weight or programs with low weight. In this way, the resource control processing is completed, and the remaining data or applications are the resource control results after the resource control processing is completed.
[0103] In order to better implement the memory data processing method in the embodiment of the present application, in addition to the memory data processing method, the embodiment of the present application also provides a memory data processing device, such as Figure 3 As shown, the apparatus 300 includes:
[0104] Acquisition module 301 is used to obtain current memory usage information:
[0105] A determination module 302 is configured to determine target detection window information for resource pressure detection based on current memory usage information;
[0106] The determination module 302 is further configured to determine resource pressure information based on the target detection window information;
[0107] The processing module 303 is used to perform resource control processing according to the resource pressure information to obtain a resource control result.
[0108] The memory data processing device provided by the present application can first obtain the current memory usage information through the acquisition module 301. Afterwards, the determination module 302 can determine the current resource usage of the system based on the current memory usage information, and thus determine the size of the target detection window information based on the specific current resource usage, so as to achieve the following: the larger the memory usage, the smaller the target detection window information; the smaller the memory usage, the larger the target detection window information, so as to achieve the effect that the smaller the window value, the greater the monitoring frequency, and the larger the window value, the smaller the monitoring frequency. In this way, the processing module 303 can increase the resource monitoring frequency when the system pressure is too high to prevent the situation where resources are not released in place, and reduce the resource monitoring frequency when the system pressure is too low to prevent excessive release of resources, thereby avoiding the situation where memory data is excessively released or not released in place.
[0109] In some embodiments of the present application, the current memory usage information includes the current memory usage percentage, and the acquisition module 301 is specifically used to:
[0110] Get the current free memory capacity and total memory capacity;
[0111] Calculate the current memory usage ratio based on the current free memory capacity and the total memory capacity.
[0112] In some embodiments of the present application, the acquisition module 301 is further configured to:
[0113] Get the initial free memory capacity for multiple samplings;
[0114] The current free memory capacity is determined according to the average memory capacity of each initial free memory capacity.
[0115] In some embodiments of the present application, the determination module 302 is specifically configured to:
[0116] Obtaining a first coefficient and a second coefficient;
[0117] Target detection window information for resource pressure detection is determined based on the first coefficient, the second coefficient, and the current memory usage ratio.
[0118] In some embodiments of the present application, based on the target detection window information, the determination module 302 is further configured to:
[0119] Get the initial detection window information for detecting resource pressure;
[0120] The initial detection window information is replaced with the target detection window information to determine the resource pressure information within the time window represented by the target detection window information.
[0121] In some embodiments of the present application, the determining module 302 is further configured to:
[0122] Determine resource pressure thresholds;
[0123] Within the time window represented by the target detection window information, the magnitude of the current resource pressure and the resource pressure threshold is determined to obtain resource pressure information.
[0124] In some embodiments of the present application, the processing module 303 is specifically configured to:
[0125] If the resource pressure information indicates that the resource is in a non-pressure state, continue to obtain the current memory usage information to determine the target detection window information and resource pressure information;
[0126] If the resource pressure information indicates that the resource is under pressure, then the current resource pressure level is determined;
[0127] Determine the data weight corresponding to all memory data in the current memory data;
[0128] Perform resource control based on the current resource pressure level and the data weight corresponding to each memory data to obtain the resource control result.
[0129] The present application also provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor. The processor executes the computer program to implement the steps of any one of the memory data processing methods in the present application. Figure 4 , which shows a schematic diagram of the structure of the terminal device involved in the embodiment of the present application, specifically:
[0130] The terminal device may include one or more processing core processors 401, one or more computer-readable storage media memories 402, a power supply 403, an input unit 404 and other components. Those skilled in the art will understand that Figure 4 The terminal device structure shown in the figure does not constitute a limitation on the terminal device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently.
[0131] Processor 401 is the control center of the terminal device. It connects the various components of the entire terminal device using various interfaces and lines. By running or executing software programs and / or modules stored in memory 402 and accessing data stored in memory 402, it performs various functions of the terminal device and processes data, thereby monitoring the terminal device as a whole. Optionally, processor 401 may include one or more processing cores. Processor 401 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. Preferably, processor 401 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 401.
[0132] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0133] The terminal device also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The power supply 403 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0134] The terminal device may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0135] Although not shown, the terminal device may further include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the terminal device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402 to implement various functions, such as:
[0136] Get current memory usage information;
[0137] Determine the target detection window information for resource pressure detection based on the current memory usage information;
[0138] Determine resource pressure information based on target detection window information;
[0139] Perform resource control processing based on resource pressure information to obtain resource control results.
[0140] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0141] To this end, an embodiment of the present application provides a computer-readable storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps of any memory data processing method provided in the embodiment of the present application. For example, the computer program loaded by the processor can execute the following steps:
[0142] Get current memory usage information;
[0143] Determine the target detection window information for resource pressure detection based on the current memory usage information;
[0144] Determine resource pressure information based on target detection window information;
[0145] Perform resource control processing based on resource pressure information to obtain resource control results.
[0146] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the detailed description of other embodiments above and will not be repeated here.
[0147] In specific implementation, the above units or structures can be implemented as independent entities, or can be arbitrarily combined to implement as the same or several entities. The specific implementation of the above units or structures can refer to the previous method embodiments and will not be repeated here.
[0148] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0149] The above is a detailed introduction to a memory data processing method and device provided in an embodiment of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A memory data processing method, characterized in that: The method comprises: Get current memory usage information: Determining target detection window information for resource pressure detection based on the current memory usage information; determining resource pressure information based on the target detection window information; Resource control processing is performed according to the resource pressure information to obtain a resource control result.
2. The memory data processing method according to claim 1, characterized in that: The current memory usage information includes the current memory usage ratio; The obtaining of current memory usage information includes: Get the current free memory capacity and total memory capacity; The current memory usage ratio is calculated based on the current free memory capacity and the total memory capacity.
3. The memory data processing method according to claim 2, characterized in that: The obtaining of the current free memory capacity includes: Get the initial free memory capacity for multiple samplings; The current free memory capacity is determined according to the average memory capacity of each of the initial free memory capacities.
4. The memory data processing method according to claim 2, wherein: The determining target detection window information for resource pressure detection according to the current memory usage information includes: Obtaining a first coefficient and a second coefficient; Target detection window information for resource pressure detection is determined according to the first coefficient, the second coefficient, and the current memory usage ratio.
5. The memory data processing method according to claim 1, wherein: Determining resource pressure information according to the target detection window information includes: Get the initial detection window information for detecting resource pressure; The initial detection window information is replaced with the target detection window information to determine the resource pressure information within a time window represented by the target detection window information.
6. The memory data processing method according to claim 5, characterized in that: Determining resource pressure information within the time window represented by the target detection window information includes: Determine resource pressure thresholds; Within the time window represented by the target detection window information, the magnitude between the current resource pressure and the resource pressure threshold is determined to obtain resource pressure information.
7. The memory data processing method according to claim 1, wherein: The performing resource control processing according to the resource pressure information to obtain a resource control result includes: If the resource pressure information indicates that the resource is in a non-pressure state, continue to obtain current memory usage information to determine the target detection window information and the resource pressure information; If the resource pressure information indicates that the resource is under pressure, determining the current resource pressure level; Determine the data weight corresponding to all memory data in the current memory data; Resource control processing is performed according to the current resource pressure level and the data weight corresponding to each memory data to obtain a resource control result.
8. A memory data processing device, characterized in that: The device comprises: Acquisition module, used to obtain current memory usage information; a determination module, configured to determine target detection window information for resource pressure detection based on the current memory usage information; The determination module is further configured to determine resource pressure information based on the target detection window information; The processing module is used to perform resource control processing according to the resource pressure information to obtain a resource control result.
9. A terminal device, characterized in that: The terminal device includes a processor, a memory, and a computer program stored in the memory and runnable on the processor, and the processor executes the computer program to implement the steps in the memory data processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps in the memory data processing method according to any one of claims 1 to 7.