Memory management method and device, computer device and storage medium
Patent Information
- Application Number
- CN202611149950.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-30
- Publication Date
- 2026-10-16
AI Technical Summary
然而,设备的硬件资源相对有限,升级硬件的成本过高,当多业务并发运行导致系统负载过高时,可能出现响应延迟增大、系统卡顿甚至崩溃等问题,严重影响设备的核心功能与用户体验
[0015]与相关技术相比,在本实施例中提供的一种内存管理方法、装置、计算机设备和存储介质,通过获取设备的实时运行状态,并根据所述实时运行状态确定所述设备当前的状态评估值;获取所述状态评估值在历史时域内的变化趋势信息,当所述变化趋势信息满足预设触发条件时,执行所述变化趋势信息对应的第一控制操作;所述第一控制操作用于在所述状态评估值对应的状态等级发生变更之前,预先调整所述设备上功能模块的运行状态;根据所述状态评估值所属的预设数值区间,确定所述设备当前的状态等级,并按照所述状态等级对应的控制策略,执行第二控制操作,调整所述设备上功能模块的运行状态。通过本实施例,利用设备的状态评估值分析设备内存压力的变化趋势信息,使设备能够在状态等级正式变更之前提前执行第一控制操作进行干预,并且,根据状态评估值确定设备的状态等级,以执行状态等级匹配的配梯度化第二控制操作,能够保障设备功能稳定运行的同时有效最大化智能功能的可用性,实现了有效的内存管理。
Smart Images

Figure CN122925174A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of memory management technology, and in particular to a memory management method, apparatus, computer device, and storage medium. Background Technology
[0002] With the rapid development of artificial intelligence technology, smart hardware devices, while ensuring basic business functions, also need to run some intelligent functions, such as intelligent algorithms for object detection, behavior recognition, and image analysis. These intelligent algorithms have an ever-increasing demand for system resources such as memory and computing power. However, the hardware resources of these devices are relatively limited, and upgrading hardware is too costly. When multiple services run concurrently, leading to excessive system load, problems such as increased response latency, system lag, or even crashes may occur, seriously affecting the core functions of the device and the user experience.
[0003] Currently, for the management of intelligent functions on resource-constrained devices, existing technologies mainly adopt static resource configuration based on preset thresholds or passive response adjustment based on the current load status. Intervention only begins when the device pressure has risen to the trigger condition, which can easily cause intelligent functions to be suddenly interrupted when the pressure increases or to recover slowly after the pressure is relieved. It is difficult to effectively maximize the availability of intelligent functions while ensuring the stable operation of the device. Summary of the Invention
[0004] In view of this, this application provides a memory management method, apparatus, computer device, and storage medium that can effectively maximize the availability of intelligent functions while ensuring the stable operation of the device.
[0005] Firstly, this embodiment provides a memory management method, including:
[0006] The device's real-time operating status is obtained, and the device's current status assessment value is determined based on the real-time operating status.
[0007] The system acquires the trend information of the status evaluation value in the historical time domain. When the trend information meets the preset triggering conditions, it executes the first control operation corresponding to the trend information. The first control operation is used to adjust the operating status of the functional modules on the device in advance before the status level corresponding to the status evaluation value changes.
[0008] Based on the preset value range to which the status assessment value belongs, the current status level of the device is determined, and according to the control strategy corresponding to the status level, the second control operation is executed to adjust the operating status of the functional modules on the device.
[0009] Secondly, this embodiment provides a memory management device, including:
[0010] The status assessment module is used to acquire the real-time operating status of the device and determine the current status assessment value of the device based on the real-time operating status.
[0011] The first operation module is used to acquire the trend information of the change of the state evaluation value in the historical time domain. When the trend information meets the preset triggering condition, the first control operation corresponding to the trend information is executed. The first control operation is used to adjust the running state of the functional modules on the device in advance before the state level corresponding to the state evaluation value changes.
[0012] The second operation module is used to determine the current state level of the device according to the preset value range to which the state evaluation value belongs, and to perform a second control operation according to the control strategy corresponding to the state level to adjust the operating state of the functional modules on the device.
[0013] Thirdly, this embodiment provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the memory management method described in the first aspect above.
[0014] Fourthly, this embodiment provides a storage medium on which a computer program is stored, which, when executed by a processor, implements the memory management method described in the first aspect above.
[0015] Compared with related technologies, the memory management method, apparatus, computer device, and storage medium provided in this embodiment acquire the real-time operating status of the device and determine the current state evaluation value of the device based on the real-time operating status; acquire the change trend information of the state evaluation value in the historical time domain; and execute a first control operation corresponding to the change trend information when the change trend information meets a preset trigger condition. The first control operation is used to pre-adjust the operating status of the functional modules on the device before the state level corresponding to the state evaluation value changes. Based on the preset numerical range to which the state evaluation value belongs, the current state level of the device is determined, and a second control operation is executed according to the control strategy corresponding to the state level to adjust the operating status of the functional modules on the device. Through this embodiment, by using the device's state evaluation value to analyze the change trend information of the device's memory pressure, the device can perform a first control operation to intervene in advance before the state level officially changes. Furthermore, by determining the device's state level based on the state evaluation value to execute a gradient-based second control operation matching the state level, the stable operation of the device function can be ensured while effectively maximizing the availability of intelligent functions, thus achieving effective memory management.
[0016] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0018] Figure 1 A flowchart of an embodiment of the memory management method provided in this application;
[0019] Figure 2 A flowchart of Embodiment 2 of the memory management method provided in this application;
[0020] Figure 3 A flowchart of Embodiment 3 of the memory management method provided in this application;
[0021] Figure 4 A flowchart of Embodiment 4 of the memory management method provided in this application;
[0022] Figure 5 A hardware structure diagram of a computer device containing the memory management device provided in this application;
[0023] Figure 6 A schematic diagram of the memory management device provided in this application. Detailed Implementation
[0024] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.
[0025] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used herein are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0026] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0027] The following specific embodiments are given to illustrate the technical solution of this application in detail.
[0028] Figure 1 A flowchart illustrating an embodiment of the memory management method provided in this application. (Refer to...) Figure 1 The method provided in this embodiment may include:
[0029] Step S101: Obtain the real-time operating status of the device and determine the current status assessment value of the device based on the real-time operating status.
[0030] Specifically, the method in this embodiment can be applied to resource-constrained devices such as edge computing devices, embedded devices, and smart terminals that run intelligent functional modules. These functional modules include, but are not limited to, intelligent AI algorithm modules such as face recognition modules, license plate recognition modules, target detection modules, behavior analysis modules, and passenger flow statistics modules.
[0031] A data monitoring thread is initiated within the device to collect real-time operational status data at fixed time intervals (e.g., every hour). This real-time operational status data includes at least the following parameters: memory utilization (the ratio of used memory to total memory), CP load rate (ranging from 0.0 to 1.0), and remaining memory. Based on the collected parameters, a device status assessment value is calculated. This value characterizes the current load pressure on the device; a higher value indicates less idle time and lower load pressure, while a lower value indicates more busy time and higher load pressure.
[0032] Step S102: Obtain the trend information of the status evaluation value in the historical time domain. When the trend information meets the preset triggering conditions, execute the first control operation corresponding to the trend information. The first control operation is used to adjust the operating status of the functional modules on the device in advance before the status level corresponding to the status evaluation value changes.
[0033] Specifically, a sliding window of length M (e.g., M≥10) is maintained in the device to record the state evaluation values of the most recent M data acquisition time periods, forming a historical evaluation value sequence: S(t-M+1), S(t-M+2), ..., S(t-1), S(t), where S(t) is the state evaluation value of the current period.
[0034] Based on the historical assessment value sequence, the change trend information within the historical time domain is calculated. The change trend information includes at least short-term change amount and short-term trend change amount. The short-term change amount reflects the most real-time change direction of the state assessment value, and the short-term trend change amount reflects the short-term change trend of the state assessment value.
[0035] Furthermore, based on the calculated trend information, it is determined whether the preset trigger conditions are met. These preset trigger conditions include a first preset trigger condition and a second preset trigger condition. The first preset trigger condition is met when the state assessment value shows a continuous downward trend (i.e., the equipment load pressure continues to worsen); the second preset trigger condition is met when the state assessment value shows a continuous upward trend (i.e., the equipment load pressure continues to ease). Specifically, the first preset trigger condition is: the short-term change is negative for several consecutive periods, and the short-term trend change is negative; the second preset trigger condition is: the short-term change is positive for several consecutive periods, and the short-term trend change is positive.
[0036] When the trend information meets the preset trigger conditions, the device executes the first control operation corresponding to the trend. The purpose of the first control operation is to adjust the operating status of the functional modules running on the device in advance before the status level corresponding to the status evaluation value has officially changed (i.e., the current status level label remains unchanged), so as to make proactive adjustments in advance through pre-judgment.
[0037] Optionally, when the state assessment value shows a downward trend (i.e., the device pressure is about to worsen), the first control operation includes releasing memory resources occupied by some functional modules (e.g., unloading non-core AI operators, clearing cache, etc.) to alleviate further deterioration of device pressure. When the state assessment value shows an upward trend (i.e., the device pressure is about to ease), the first control operation includes preloading resources required by some functional modules (e.g., loading model shards from disk to memory in advance, pre-allocating memory pools, etc.) to accelerate the recovery of various business functions. Compared to the complete control strategy after the formal state level switch, the first control operation is a lightweight buffer action, performing only partial adjustments rather than a complete control strategy. By performing the first control operation before the state level switch, the device can buffer resources in advance, making the transition of the device state smoother when the subsequent level formally switches, avoiding the abrupt shutdown of intelligent functions on the device, which would result in a poor user experience.
[0038] In step S103, the current state level of the device is determined according to the preset numerical interval to which the state evaluation value belongs, and a second control operation is executed according to the control strategy corresponding to the state level to adjust the operating state of the functional modules on the device.
[0039] Specifically, the device pre-stores at least one threshold, and these thresholds divide the value range of the state evaluation value into a plurality of preset numerical intervals, each corresponding to a state level. Exemplarily, the device stores three thresholds T1, T2, T3 (0<T1<T2<T3<1), which divide the state evaluation value into four intervals: (0,T1], (T1,T2], (T2,T3], (T3,1), corresponding to the fourth state level, the third state level, the second state level and the first state level respectively. A higher state level indicates that the device can provide a higher level of resource supply and can enable more functional modules. It should be noted that the threshold division manner and the number of state levels are only illustrative, and can be flexibly adjusted according to the device type, hardware configuration and application scenarios in practical applications.
[0040] The device acquires the state evaluation value of the current cycle, and determines the corresponding state level by judging which preset numerical interval it falls into. The device executes the second control operation according to the control strategy corresponding to the current state level, to fully adjust the operating state of the functional modules on the device. The second control operation and the pre-executed first control operation are both for adjusting the operating state of the functional modules, and the difference between the two lies in the execution timing and execution amplitude: the first control operation is executed before the level is formally changed, which is a lightweight buffering action that only performs partial adjustment; the second control operation is executed after the level is formally determined, which is a standard action in accordance with the complete strategy of the level.
[0041] In this way, when the prediction is triggered, the first control operation executes part of the adjustment actions in advance for buffering; after the target state level is formally determined, the second control operation then executes the remaining standard control actions according to the complete strategy corresponding to the latest state level. The first control operation and the second control operation together constitute the current complete resource scheduling response, wherein the adjustment range of the first control operation is less than or equal to the adjustment range of the second control operation.
[0042] It should be noted that when the device is started for the first time or there is no historical evaluation value, the device skips the execution of the first control operation, directly determines the state level according to the current state evaluation value and executes the second control operation.
[0043] It should also be noted that this invention does not exclude scenarios where, in specific implementations, the formal switching of the state level occurs before the completion of the first control operation. For example, in some cases, when the device detects a trend that meets a preset trigger condition in a certain cycle, the system immediately initiates the first control operation (e.g., gradually unloading non-core operators of low-priority functional modules). However, since the state evaluation value has been continuously declining for several previous cycles, the downward trend of the state evaluation value may continue after the first control operation is triggered, and the hard condition for state level switching in step S103 may be met within a very short time before the first control operation is completed (e.g., the state evaluation value has been below the decline threshold for N consecutive cycles). At this time, the system performs a formal state level switch according to the state switching rules and executes the second control operation according to the complete control strategy corresponding to the target state level. In this case, the execution of the second control operation may occur before the first control operation ends, or overlap with the subsequent part of the first control operation. As long as the first control operation has been initiated before the formal change of state level, the technical effect of "advance prediction and buffered transition" of this invention can be achieved. Therefore, there is no strict sequential timing dependency between steps S102 and S103. The first control operation only needs to occur before the formal change of the state level. It is permissible for it and the second control operation to partially overlap or cross over in execution on the time axis.
[0044] This embodiment determines the device's state assessment value and analyzes the changing trend of device memory pressure using this value. A first control operation based on this trend information is introduced, enabling the device to intervene before the formal change in state level. This upgrades the traditional "reactive" adjustment to a proactive "predictive" adjustment. When it is detected that the device's memory pressure will continue to worsen, the first control operation can release resources in advance to buffer further pressure increases, preventing abrupt shutdown of intelligent functions during level switching. When it is detected that the pressure will continue to ease, the first control operation can prepare resources in advance to accelerate function recovery. This mechanism ensures stable device operation while effectively maximizing the availability of intelligent functions, achieving effective memory management. Combined with control strategies for different state levels, it allows the device to operate intelligent functions elastically and adaptively under limited memory conditions, effectively improving response speed and user experience in scenarios with sudden load changes. Furthermore, the device's state level is determined based on the state assessment value, and a gradient-based second control operation matching the state level is executed. This maximizes AI capabilities when resources are abundant and retains only basic device services when memory is on the verge of collapse, balancing the availability of intelligent functions and the stability of device operation.
[0045] Figure 2 A flowchart illustrating a second embodiment of the memory management method provided in this application. (Refer to...) Figure 2Based on the above embodiments, the step of determining the current state assessment value of the device according to the real-time operating status includes:
[0046] Step S201: Determine the basic stress value of the device based on the device's memory usage and processor load rate.
[0047] Specifically, the device obtains pre-configured memory weighting coefficients. and processor (CPU) load weighting coefficient Optionally, the weighting coefficient can be configured based on the actual hardware characteristics of the device: if the device has a small memory capacity and memory resources are the main performance bottleneck, then a larger memory weighting coefficient should be configured. Smaller processor (CPU) load weighting factor If the device's CPU performance is weak, and CPU resources are the main performance bottleneck, then a smaller memory weighting coefficient should be configured. A large CPU load weighting coefficient .
[0048] The device reads the current total memory usage, total available memory, and CPU load rate through the operating system interface, and calculates the memory utilization rate based on the total memory usage and total available memory.
[0049] Based on the device's memory utilization, processor load rate, and memory weight coefficient and processor load weighting coefficient Determine the basic pressure value of the equipment. The specific calculations are as follows:
[0050] ;
[0051] in, For memory usage, This refers to the processor load rate.
[0052] Step S202: Determine the correction factor based on the device's current remaining memory and the preset reference memory value.
[0053] Specifically, since the above-mentioned basic stress value only reflects the current relative idle status of the device, if different devices have different memory and different remaining memory sizes, but the basic stress value is the same, this will lead to inaccurate judgment of memory usage. Therefore, a correction factor is introduced to correct the basic stress value.
[0054] The device obtains the current remaining memory and two pre-stored preset reference memory values: a memory crash threshold and a memory safety value. The memory crash threshold is the minimum memory required for the system to maintain basic business operations. When the remaining memory falls below the memory crash threshold, the system cannot enable any intelligent functions and can only ensure the normal operation of basic services (such as video capture, encoding, and storage). The value of the memory crash threshold is pre-calibrated based on the operating system kernel running on the device and the memory usage of basic services. The memory safety value is a threshold indicating ample memory. When the remaining memory exceeds the memory safety value, the device can fully enable all intelligent functions without considering memory limitations. The value of the memory safety value is pre-calibrated based on the maximum memory usage required for all intelligent function modules on the device to run fully.
[0055] Optional, correction factor The calculation is as follows:
[0056] ;
[0057] in, This represents the current remaining memory. This is the threshold for memory crash. This is a memory-safe value. The correction factor maps the device's absolute remaining memory to the [0,1] interval, when... hour, When it approaches 0 hour, It tends to 1.
[0058] Step S203: Determine the state assessment value based on the baseline pressure value and the correction factor.
[0059] Specifically, the baseline pressure value is multiplied by the correction factor to obtain the state assessment value. Alternatively, the state assessment value can be calculated using a weighted summation method or a nonlinear mapping function.
[0060] The state assessment value calculation provided in this embodiment, by constructing a dual assessment model that includes relative pressure and absolute risk, can simultaneously take into account the relative load ratio of the equipment (provided by the base pressure value) and the absolute memory margin (provided by the correction factor). The introduction of the correction factor solves the problem of risk asymmetry for devices with different memory capacities under the same memory occupancy rate, thereby enabling the calculated state assessment value to better reflect the memory status of the equipment and making it applicable to devices with different hardware configurations, thus improving the versatility of the solution.
[0061] Figure 3 A flowchart illustrating a third embodiment of the memory management method provided in this application. (Refer to...) Figure 3 Based on the above embodiments, the step of obtaining the trend information of the state evaluation value in the historical time domain includes:
[0062] Step S301: Obtain the status evaluation values of the historical cycle and form a historical evaluation value sequence.
[0063] Specifically, during operation, the device calculates and stores the current period's state evaluation value for each data acquisition period (e.g., every hour). The device maintains a sliding window of length M (exemplarily, M≥10) to store the historical state evaluation values of the most recent M periods, forming a historical evaluation value sequence: S(t-M+1), S(t-M+2), ..., S(t-1), S(t), where S(t) is the current period's state evaluation value, S(t-1) is the previous period's state evaluation value, and so on.
[0064] Step S302: Determine the short-term change based on the difference between the state assessment values of adjacent periods in the historical assessment value sequence.
[0065] Specifically, the trend information includes short-term change and short-term trend change. In practice, the device extracts the state evaluation values S(t) and S(t-1) of the two most recent adjacent periods from the historical evaluation value sequence, and calculates the short-term change Δ_short:
[0066] Δ_short = S(t) - S(t-1);
[0067] Among them, the short-term change Δ_short reflects the direction and severity of the most real-time pressure change: Δ_short>0 indicates that the pressure is easing (the state assessment value is rising), Δ_short<0 indicates that the pressure is worsening (the state assessment value is falling), and the larger the |Δ_short| is, the more severe the pressure change.
[0068] Step S303: Determine the short-term trend change based on the difference between the mean of the state assessment values within the first window and the mean of the state assessment values within the second window in the historical assessment value sequence; wherein, the first window is a number of recent consecutive periods in the historical assessment value sequence, and the second window is a number of periods in the historical assessment value sequence that are adjacent to the first window and located before the first window.
[0069] Specifically, the window length of the first window and the window length of the second window can be the same or different. For example, the first window represents the most recent three periods: S(t), S(t-1), S(t-2); the second window represents the three periods adjacent to the first window: S(t-3), S(t-4), S(t-5). The device calculates the mean value of the state evaluation values within the first window (avg_recent) and the mean value of the state evaluation values within the second window (avg_prev); and calculates the short-term trend change Δ_trend.
[0070] Δ_trend=avg_recent-avg_prev;
[0071] Herein, the short-term trend variation Δ_trend reflects the overall recent trend direction: Δ_trend>0 indicates that the average state evaluation value of the most recent several periods is higher than the average value of the earlier several periods, which means the pressure is gradually alleviating; Δ_trend<0 indicates that the average state evaluation value of the most recent several periods is lower than the average value of the earlier several periods, which means the pressure is gradually deteriorating.
[0072] In this embodiment, the short-term variation Δ_short and the short-term trend variation Δ_trend jointly form the variation trend information of the state evaluation value in the historical time domain. The two reflect the variation characteristics of pressure from different time scales: Δ_short provides the most real-time variation direction information, which can capture sudden changes in pressure; Δ_trend provides mean variation information across windows, which can filter out accidental fluctuations and reflect the trending direction. The two indicators complement each other, making subsequent pre-judgment decisions more accurate and reliable.
[0073] Optionally, as a possible embodiment, when the variation trend information meets a preset trigger condition, the step of executing the first control operation corresponding to the variation trend information may include:
[0074] (1) When the short-term variation is a negative value for several consecutive periods and the short-term trend variation is a negative value, it is determined that the state evaluation value is in a downward trend, and the first control operation includes releasing the memory resources occupied by at least part of the functional modules on the device.
[0075] Specifically, the device monitors the values of the short-term variation Δ_short in several consecutive periods. Exemplarily, the device monitors that Δ_short for 3 consecutive periods is all negative, that is: S(t)<S(t-1)<S(t-2)<S(t-3), which indicates that the state evaluation value is continuously decreasing and the load pressure is continuously deteriorating. At the same time, the device checks whether the short-term trend variation Δ_trend is a negative value. Δ_trend<0 indicates that the average state evaluation value of the most recent several periods is lower than the average value of the earlier several periods, and the overall trend is developing in a worse direction. When the above two conditions are satisfied at the same time (Δ_short is negative for 3 consecutive periods and Δ_trend<0), the device determines that the state evaluation value is in a downward trend. Even if the current state evaluation value has not reached the threshold for triggering the state level to drop, the deteriorating trend of the device memory pressure has been established, so the first control operation of releasing memory resources is performed in advance.
[0076] For example, suppose the current state evaluation value Score(t) = 0.5, which is in the second state level range (Score ≥ T2 = 0.45), but the Score values of the last 4 cycles are 0.58, 0.55, 0.52 and 0.5 respectively. Δ_short is negative for 3 consecutive cycles, and Δ_trend is also negative. It is determined that the pressure will continue to deteriorate, and the device will perform resource release operation in advance.
[0077] The first control operation includes releasing memory resources occupied by at least some functional modules on the device to slow down the decline in state evaluation values. This includes, but is not limited to, one or more of the following operations: unloading non-core AI operators from functional modules and reducing the data input rate of functional modules. For example, a face recognition functional module contains multiple atomic operators such as object detection operators, attribute analysis operators, angle recognition operators, and image enhancement operators. The device unloads these operators sequentially, starting with the lowest priority, according to their pre-set priorities, until sufficient memory resources are released. Since the operator priorities of each functional module are pre-configured in the device, the device can directly determine the number and type of operators to be unloaded based on the current decline rate. For example, the device reduces the intelligent analysis frame rate from full frame rate to frame skipping (e.g., taking 1 frame out of 5 frames) to reduce memory usage.
[0078] (2) When the short-term change is positive for several consecutive periods and the short-term trend change is positive, the state assessment value is determined to be on an upward trend. The first control operation includes preloading the resources required by at least some of the functional modules on the device.
[0079] Specifically, the equipment monitors the short-term change Δ_short over several consecutive periods. For example, if the equipment monitors Δ_short for three consecutive periods and all values are positive (i.e., S(t) > S(t-1) > S(t-2) > S(t-3), this indicates that the status assessment score is continuously increasing and the load pressure is continuously easing. Simultaneously, the equipment checks if the short-term trend change Δ_trend is positive. Δ_trend > 0 indicates that the average status assessment value for the most recent periods is higher than the average value for earlier periods, and the overall trend is improving.
[0080] When both of the above conditions are met simultaneously (Δ_short is positive for three consecutive cycles and Δ_trend>0), the device determines that the status assessment value is trending upward. Even if the current status assessment value has not yet reached the threshold for triggering a status level increase, the trend of pressure relief has been established, so the first control operation of preloading resources is executed in advance.
[0081] The first control operation includes preloading resources required by at least some functional modules on the device to accelerate the upward trend of the state evaluation value. This includes, but is not limited to, one or more of the following operations: loading model shards from disk into memory, pre-allocating a memory pool, and pre-establishing the context environment required for the functional modules to run. For example, the device preloads AI model shards (such as attribute analysis models, angle recognition models, etc.) that were previously unloaded due to memory shortages from the edge server or local disk into memory, so that when the state evaluation value returns to a higher state level, the intelligent function can resume full operation in a shorter time; the device pre-allocates a memory block of a certain size from the operating system and puts it into a memory pool to prepare sufficient memory resources for the functional modules that are about to resume operation; the device pre-initializes the running parameters of the functional modules, loads dependent libraries, etc.
[0082] This embodiment utilizes a dual verification mechanism combining trend information with preset trigger conditions to achieve a shift from "post-event response" to "pre-event prediction." In traditional solutions, equipment only initiates degradation after the status assessment value has fallen below the level threshold, representing a passive response. This solution, however, uses trend prediction to execute the first control operation before the status assessment value falls below the threshold but the downward trend is already established, resulting in a smoother resource release process. Furthermore, the equipment can accurately distinguish between genuine trends and accidental fluctuations, avoiding false triggers caused by single-point data spikes.
[0083] Optionally, as a possible embodiment, the step of executing the second control operation according to the control strategy corresponding to the state level may include:
[0084] When the status level is the first status level, all functional modules on the control device are enabled; when the status level is the second status level, non-core operators in the functional modules are disabled; when the status level is the third status level, the data input rate and / or data resolution of the functional modules are reduced; when the status level is the fourth status level, all functional modules on the device are disabled.
[0085] Specifically, the device pre-stores multiple thresholds, which divide the range of status assessment values into multiple preset numerical intervals. Each numerical interval corresponds to a status level. The higher the preset numerical interval in which the status assessment value falls, the higher the corresponding status level. That is, a higher value indicates a lower device load pressure, and the corresponding level can provide a higher level of resource supply; a lower value indicates a higher device load pressure, and the corresponding level has a lower level of resource supply.
[0086] For example, the device stores three thresholds T1, T2, T3 (0<T1<T2<T3<1), and divides the value range of the state evaluation value into four intervals: (0,T1], (T1,T2], (T2,T3], and (T3,1), which respectively correspond to the fourth state level, the third state level, the second state level, and the first state level. The first state level has the highest resource supply level, followed by the second state level, then the third state level, and the fourth state level has the lowest resource supply level. The higher the resource supply level, the greater the number of functional modules that can be enabled on the device, and the higher the operation accuracy of the functional modules.
[0087] The first to fourth state levels respectively correspond to an intelligent mode (L1) with all intelligent functions fully enabled, a stable mode (L2) for stable operation, a minimal mode (L3) that retains only core functions, and a fuse mode (L4) that turns off all intelligent functions. The number of state levels is not limited to four, and the device can set two, three or more levels according to actual needs.
[0088] The first state level indicates that the device has sufficient remaining memory and low load pressure, and all intelligent functions can be fully enabled at this time. The device performs a second control operation to control all functional modules on the device to be fully enabled, including: enabling all AI algorithm functions (full-amount attribute detection, complex behavior analysis, multi-target tracking, etc.), restoring to the maximum analysis input rate and data accuracy supported by the device (such as 1080P, full frame rate), restoring the local storage policy for all alarm images and snapshot images, etc. Under the first state level, the device provides the best intelligent experience.
[0089] The second state level indicates that the memory pressure of the device starts to appear, but the basic intelligent functions can still be maintained. The device performs the second control operation to turn off non-core operators in the functional modules. The non-core operators are operators that play roles in auxiliary enhancement, additional attribute analysis or edge scenario optimization in the functional module, and even if they are turned off, the core business objective of the module can still be achieved. Core operators are retained to ensure the normal operation of main functions, and the core operators are the minimum computing units that are indispensable for realizing the most basic business objective of the functional module. In specific implementation, taking the face recognition functional module as an example, this functional module contains multiple atomic operators inside: a target detection operator (locating the position of a face in an image), an attribute analysis operator (analyzing age, gender, etc.), an angle recognition operator (judging the orientation of the face), an image enhancement operator (adjusting brightness and contrast to improve image quality), etc. The device preconfigures priorities for these operators, the target detection operator is the core operator (highest priority), and attribute analysis and angle recognition are non-core operators (lower priority). When entering the second state level, the device unloads the non-core operators (attribute analysis, angle recognition) and retains only the target detection operator, thereby releasing memory resources while ensuring the core function of face detection.
[0090] The third state level indicates that the device load is high and further reduction of resource consumption is needed. The device executes a second control operation to reduce the data input rate and / or data resolution of the functional modules. Reducing the data input rate includes lowering the intelligent analysis frame rate, for example, from full frame rate processing to frame skipping processing (e.g., analyzing 1 frame out of every 5 frames), to reduce data throughput and computational load per unit time. Reducing the data resolution includes lowering the resolution of the input image, for example, from 1080P (1920×1080) to 720P (1280×720), to reduce the storage and computational overhead of single-frame data.
[0091] The two reduction methods described above can be implemented individually or in combination. For example, for intrusion detection services with high real-time requirements, only the data resolution can be reduced without reducing the frame rate; for passenger flow statistics services with low accuracy requirements, both the frame rate and resolution can be reduced simultaneously.
[0092] The fourth state level indicates that the device memory is about to crash and the pressure has reached its limit. The device executes the second control operation, shutting down all intelligent function modules on the device and releasing the video memory and memory resources occupied by the algorithm. At this time, the device only retains basic business functions (such as video capture, encoding, storage, network transmission, and other non-intelligent business functions) to ensure the normal operation of core business. The recovery of intelligent functions requires waiting for the state assessment value to rise back to the range corresponding to the third state level and stabilize for a period of time before attempting to restart them.
[0093] Optionally, as a possible embodiment, in order to prevent frequent switching of state levels due to small fluctuations in the state evaluation value near the threshold, and to eliminate system oscillations caused by resource jitter, this embodiment provides a state level switching scheme using a hysteresis interval setting, which may include the following steps:
[0094] The current state level is determined based on a preset numerical range, which sets the descent threshold and the ascent threshold. The ascent threshold is greater than the descent threshold. When the state evaluation value is lower than the descent threshold for several consecutive periods, the current state level is switched to a lower state level. When the state evaluation value is higher than the ascent threshold for several consecutive periods, the current state level is switched to a higher state level. When the state evaluation value is between the descent threshold and the ascent threshold, the current state level is maintained.
[0095] Specifically, the device pre-stores basic thresholds T1, T2, T3, and hysteresis bandwidth Δ (Δ>0, e.g., 0.1). For each state level, the device calculates a descent threshold and a rise threshold. Optionally, the descent threshold is the original basic threshold T, and the rise threshold... For example, for the first state level, the falling threshold is T3, and the rising threshold is T3+Δ.
[0096] As another alternative implementation, the hysteresis bandwidth Δ can be set to different values for different thresholds, so that the hysteresis effect in different level ranges can be adjusted independently.
[0097] The device monitors whether the current status assessment value is lower than the decline threshold corresponding to the current status level. For example, the device is currently in the second status level, and the decline threshold is T2 = 0.45. When the status assessment value is less than 0.45, the device initiates a decline count. If the status assessment value remains below 0.45 for multiple consecutive cycles (for example, 10 consecutive cycles, i.e., N = 10), the device switches the current status level from the second status level to the third status level.
[0098] The device monitors whether the current status assessment value is higher than the escalation threshold corresponding to the current status level. For example, the device is currently in the third status level, and the escalation threshold is T2 + Δ = 0.45 + 0.1 = 0.55. When the status assessment value is greater than 0.55, the device initiates an upgrade count. If the status assessment value remains higher than 0.55 for multiple consecutive cycles (for example, 10 consecutive cycles), the device switches the current status level from the third status level to the second status level.
[0099] When the state evaluation value is between the decreasing threshold and the increasing threshold, the current state level remains unchanged and no switch is performed.
[0100] Through the asymmetric design in this embodiment, where the rising threshold is higher than the falling threshold, a hysteresis interval is formed near the threshold boundary of state level switching. Thus, when the state evaluation value fluctuates within this hysteresis interval, the device maintains its current state level, effectively avoiding frequent upgrades and downgrades caused by minor fluctuations in the state evaluation value near the threshold boundary, which would negatively impact user experience. Furthermore, by dividing the state into multiple levels and configuring different second control operation strategies for each level, the device can perform different degrees of resource release under different pressure levels, achieving gradual degradation rather than abrupt shutdown. In addition, the configuration of atomic operators provides fine-grained resource scheduling under the second state level, maximizing the availability of retained functions.
[0101] Optionally, as a possible implementation, in actual device scenarios, multiple functional modules typically run simultaneously on the device, such as a face recognition module, a license plate recognition module, a behavior analysis module, and a passenger flow statistics module. These functional modules have varying degrees of importance to the device, and their importance dynamically changes with the actual scenario. This embodiment solves the problem that traditional fixed-priority schemes cannot adapt to the dynamic changes in business importance by introducing a dynamic priority mechanism, which may include the following steps:
[0102] Obtain the priority of each functional module on the device; the priority is determined by at least one of the following: the business type of each functional module, the hit rate in the current scenario, and the timeliness requirement; execute the first control operation and / or the second control operation according to the priority.
[0103] Specifically, the device calculates a dynamic priority score P for each functional module. This priority is determined by at least one of the following: the business type of each functional module, the hit rate in the current scenario, and the timeliness requirement.
[0104] Optionally, the priority score can be calculated using the following formula:
[0105] ;
[0106] in, For the weighting coefficients, satisfying The factors of business type weight, real-time hit rate, and timeliness requirement are controlled to influence the final priority. For example, α=0.5, β=0.3, and γ=0.2, but the specific values can be adjusted according to the actual scenario.
[0107] The business type weight (TypeWeight) is a pre-configured basic weight based on the business function attributes of the functional module, reflecting the inherent importance of the business itself. For example: security alarm business (e.g., intrusion detection, smoke detection): TypeWeight=1.0; identity recognition business (e.g., face recognition, license plate recognition): TypeWeight=0.8; behavior analysis business (e.g., fight detection, fall detection): TypeWeight=0.6; statistical business (e.g., passenger flow statistics, heat map analysis): TypeWeight=0.4. The above values are only examples; the actual configuration can be adjusted according to the specific application scenario of the device.
[0108] The real-time hit rate (HitRate) is the proportion of actual detection hits by a functional module to the total number of detections within a preset time window. When a functional module continuously detects targets in the current scene (e.g., a face recognition module continuously hits targets when someone is present in the current scene), its hit rate increases, and its priority automatically increases; conversely, if a functional module has no effective targets for a long time (e.g., a face recognition module in an unmanned scene), its hit rate decreases, and its priority automatically decreases.
[0109] RealTimeReq: The tolerance level of the functional module for response latency, with a value ranging from 0 to 1. For services with higher timeliness requirements (such as real-time alarm services), this value is larger (e.g., 1.0); for services that tolerate latency (such as offline statistical analysis services), this value is smaller (e.g., 0.2).
[0110] During operation, the equipment periodically updates the priority of each functional module according to a preset cycle (for example, 1 hour or 2 hours). In each decision cycle, the equipment recalculates the dynamic priority score P for all currently running functional modules and sorts them from high to low according to P to form a dynamic priority queue.
[0111] In a preferred embodiment of this invention, the device also includes a timeout degradation mechanism: when the hit rate of a functional module remains zero for a period exceeding a preset timeout, the priority of the functional module is temporarily reduced to the lowest value. Specifically, when the hit rate of a functional module remains zero for a period exceeding a preset timeout T_timeout (exemplarily, T_timeout = 60 seconds), the device marks the functional module as idle and temporarily reduces its priority to the lowest value to avoid unnecessarily occupying resources. Once the hit rate of the functional module recovers, its priority automatically recovers to the normal calculated value in the next update cycle.
[0112] When the equipment performs the first control operation and / or the second control operation, it can adjust the order of priority of each functional module from low to high.
[0113] For example, in the operator pruning phase of the second state level, operator unloading is performed starting with the lowest priority functional modules. For each functional module, its internal operators are sorted according to pre-configured priorities, and non-core operators are unloaded step by step. The lower the priority of the functional module, the greater the extent of operator pruning. For example, the lowest priority passenger flow statistics module may be completely shut down, while the highest priority intrusion detection module only unloads the least important operators.
[0114] For example, in the third-level service shutdown phase, the system shuts down functional modules sequentially according to dynamic priority from low to high: first, it shuts down the lowest-priority statistical services (such as passenger flow statistics and heat analysis); second, it shuts down the non-real-time analysis functions of behavioral analysis services (such as fight detection and fall detection); and only retains the core functions of the highest-priority security alarm and identification services. The memory resources released by the shut-down services are reallocated to the retained high-priority services as needed.
[0115] For example, in the first control operation phase, when the trend prediction indicates that the pressure is about to worsen, the system also releases some memory resources occupied by low-priority functional modules (such as unloading some of their caches or non-core operators) in order of priority from low to high, so that the pre-degradation buffering action is more accurate and targeted.
[0116] By introducing dynamic priorities for different functional modules in this embodiment, the system can dynamically adjust based on service type, real-time hit rate, and timeliness requirements. This prevents the device from mistakenly downgrading currently active services when memory is tight, and instead prioritizes cutting out long-term ineffective or low-priority services.
[0117] Figure 4 A flowchart of Embodiment 4 of the memory management method provided in this application. (Refer to...) Figure 4 The method includes:
[0118] Step S401: Determine the basic stress value of the device based on the device's memory occupancy rate and processor load rate; determine the correction factor based on the device's current remaining memory and the preset reference memory value; determine the status assessment value for the current period based on the basic stress value and the correction factor.
[0119] Step S402: Obtain the state assessment values of historical cycles to form a historical assessment value sequence; determine the short-term change amount based on the difference between the state assessment values of adjacent cycles in the historical assessment value sequence; determine the short-term trend change amount based on the difference between the mean of the state assessment values in the first window and the mean of the state assessment values in the second window in the historical assessment value sequence.
[0120] Step S403: When the short-term change is negative for several consecutive periods and the short-term trend change is negative, the state evaluation value is determined to be declining. The first control operation of releasing the memory resources occupied by at least some functional modules on the device is executed according to the priority of each functional module.
[0121] Step S404: When the short-term change is positive for several consecutive periods and the short-term trend change is positive, the state evaluation value is determined to be on an upward trend. The first control operation of the resources required by at least some functional modules on the preload device is executed according to the priority of each functional module.
[0122] Step S405: Determine the decreasing threshold and increasing threshold corresponding to the current state level according to the preset numerical range, where the increasing threshold is greater than the decreasing threshold; when the state evaluation value is lower than the decreasing threshold for multiple consecutive periods, switch the current state level to a lower state level; when the state evaluation value is higher than the increasing threshold for multiple consecutive periods, switch the current state level to a higher state level; when the state evaluation value is between the decreasing threshold and the increasing threshold, maintain the current state level unchanged.
[0123] Step S406: When the status level is the first status level, all functional modules on the control device are turned on; when the status level is the second status level, non-core operators in the functional modules are turned off; when the status level is the third status level, the data input rate and / or data resolution of the functional modules are reduced; when the status level is the fourth status level, all functional modules on the device are turned off.
[0124] Specifically, the implementation principles and processes of steps S401 to S406 can be found in the descriptions in the previous embodiments, and will not be repeated here.
[0125] This embodiment achieves proactive intervention through trend prediction, ensures stable switching through a hysteresis mechanism, and achieves fine-grained scheduling through dynamic priority. These three elements work synergistically to form a complete adaptive memory management closed loop. While ensuring the continuous and stable operation of the device's core services, this solution maximizes the availability of intelligent functions, significantly improving the overall performance and user experience of resource-constrained devices in multi-service concurrent scenarios. Specifically, it can identify the direction of pressure evolution before the load pressure reaches the trigger threshold and execute lightweight buffering actions in advance. When the pressure shows a continuously worsening trend, the pre-processing action can release some resources in advance, effectively slowing down the rate of pressure increase and avoiding the abrupt shutdown of intelligent functions caused by passive response in traditional solutions. When the pressure shows a continuously easing trend, the pre-processing action can load the necessary resources in advance, enabling intelligent functions to quickly recover after the conditions are met, significantly shortening the user-perceived function interruption time. This shift from reactive response to proactive prediction fundamentally improves the system's robustness and user experience in scenarios with sudden load changes.
[0126] It should be noted that the steps shown in the above process or in the flowchart of the accompanying figures can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0127] Corresponding to the aforementioned embodiment of a memory management method, this application also provides an embodiment of a memory management device.
[0128] An embodiment of a memory management device disclosed in this application can be applied to a computer device. The device embodiment can be implemented through software, hardware, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by the processor of the computer device loading corresponding computer program instructions from non-volatile memory into memory for execution. From a hardware perspective, such as... Figure 5 As shown, Figure 5 This is a hardware structure diagram of a computer device containing the memory management device of this application, except... Figure 5 In addition to the processor, memory, network interface, and non-volatile memory shown, the computer device in which the device is located in the embodiment may also include other hardware depending on the actual function of the memory management device, which will not be described in detail here.
[0129] Figure 6 A schematic diagram of the memory management device provided in this application. (Refer to...) Figure 6 The apparatus provided in this embodiment includes:
[0130] The status assessment module 10 is used to acquire the real-time operating status of the device and determine the current status assessment value of the device based on the real-time operating status.
[0131] The first operation module 20 is used to acquire the trend information of the status evaluation value in the historical time domain. When the trend information meets the preset trigger conditions, the first control operation corresponding to the trend information is executed. The first control operation is used to adjust the running status of the functional modules on the device in advance before the status level corresponding to the status evaluation value changes.
[0132] The second operation module 30 is used to determine the current status level of the device according to the preset value range to which the status evaluation value belongs, and to execute the second control operation according to the control strategy corresponding to the status level, thereby adjusting the operating status of the functional modules on the device.
[0133] The apparatus of this embodiment can be used to perform... Figure 1 The steps of the method embodiment shown are similar in principle and process, and will not be repeated here.
[0134] Optionally, as a possible embodiment, the aforementioned state assessment module 10 is further configured to:
[0135] Determine the basic stress value of the device based on its memory usage and processor load.
[0136] The correction factor is determined based on the device's current remaining memory and the preset reference memory value;
[0137] The state assessment value is determined based on the baseline pressure value and the correction factor.
[0138] Optionally, as one possible embodiment, the first operation module 20 described above is further configured to:
[0139] Obtain historical periodic status assessment values to form a historical assessment value sequence;
[0140] The short-term change is determined by the difference between the state assessment values of adjacent periods in the historical assessment value sequence;
[0141] The short-term trend change is determined by the difference between the mean of the state assessment values within the first window and the mean of the state assessment values within the second window in the historical assessment value sequence.
[0142] The first window consists of several recent consecutive periods in the historical evaluation value sequence, and the second window consists of several periods in the historical evaluation value sequence that are adjacent to the first window and precede it.
[0143] Optionally, as one possible embodiment, the first operation module 20 described above is further configured to:
[0144] When the short-term change is negative for several consecutive periods and the short-term trend change is negative, the state assessment value is determined to be declining. The first control operation includes releasing the memory resources occupied by at least some functional modules on the device.
[0145] When the short-term change is positive for several consecutive periods and the short-term trend change is positive, the state assessment value is determined to be on an upward trend. The first control operation includes preloading the resources required by at least some functional modules on the device.
[0146] Optionally, as one possible embodiment, the second operation module 30 described above is further configured to:
[0147] When the status level is the first status level, all functional modules on the control device are enabled.
[0148] When the state level is the second state level, disable the non-core operators in the functional module;
[0149] When the status level is the third status level, reduce the data input rate and / or data resolution of the functional modules;
[0150] When the status level is the fourth status level, all functional modules on the device are shut down.
[0151] Optionally, as one possible embodiment, the second operation module 30 described above is further configured to:
[0152] The current state level is determined based on a preset numerical range, with the decreasing and increasing thresholds corresponding to the current state level being greater than the decreasing threshold.
[0153] When the status assessment value is below the decline threshold for several consecutive periods, the current status level will be switched to a lower status level.
[0154] When the status assessment value is higher than the rising threshold for several consecutive periods, the current status level will be switched to a higher status level.
[0155] When the state evaluation value is between the decreasing threshold and the increasing threshold, the current state level remains unchanged.
[0156] Optionally, as a possible embodiment, the above apparatus further includes: a service priority module, used for:
[0157] Obtain the priority of each functional module on the device; the priority is determined by at least one of the following: the business type of each functional module, the hit rate in the current scenario, and the timeliness requirement.
[0158] Perform the first control operation and / or the second control operation according to the priority.
[0159] Please continue to refer to Figure 5 This application also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method in any of the embodiments provided in this application.
[0160] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the methods in any of the embodiments provided in this application.
[0161] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0162] It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. All other embodiments derived by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.
[0163] Obviously, the accompanying drawings are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar situations based on these drawings without any creative effort. Furthermore, it is understood that although the work done in this development process may be complex and lengthy, for those skilled in the art, certain design, manufacturing, or production modifications made based on the technical content disclosed in this application are merely conventional technical means and should not be considered as insufficient disclosure of this application.
[0164] The term "embodiment" in this application refers to a specific feature, structure, or characteristic described in connection with an embodiment that may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily imply the same embodiment, nor does it imply that it is mutually exclusive with or alternative to other embodiments. It will be clearly or implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0165] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of patent protection. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the appended claims.
Claims
1. A memory management method, characterized in that, include: The device's real-time operating status is obtained, and the device's current status assessment value is determined based on the real-time operating status. Obtain the trend information of the state evaluation value in the historical time domain. When the trend information meets the preset triggering condition, execute the first control operation corresponding to the trend information. The first control operation is used to pre-adjust the operating state of the functional modules on the device before the state level corresponding to the state evaluation value changes; Based on the preset value range to which the status assessment value belongs, the current status level of the device is determined, and according to the control strategy corresponding to the status level, the second control operation is executed to adjust the operating status of the functional modules on the device.
2. The memory management method according to claim 1, characterized in that, Determining the current status assessment value of the device based on the real-time operating status includes: The basic stress value of the device is determined based on the device's memory usage and processor load rate; The correction factor is determined based on the device's current remaining memory and a preset reference memory value; The state assessment value is determined based on the baseline pressure value and the correction factor.
3. The memory management method according to claim 1, characterized in that, The change trend information includes short-term change amount and short-term trend change amount; obtaining the change trend information of the state assessment value in the historical time domain includes: Obtain historical periodic status assessment values to form a historical assessment value sequence; The short-term change is determined based on the difference between the state assessment values of adjacent periods in the historical assessment value sequence; The short-term trend change is determined based on the difference between the mean of the state assessment values within the first window and the mean of the state assessment values within the second window in the historical assessment value sequence. Wherein, the first window is a number of recent consecutive periods in the historical evaluation value sequence, and the second window is a number of periods in the historical evaluation value sequence that are adjacent to the first window and located before the first window.
4. The memory management method according to claim 3, characterized in that, When the trend information meets a preset trigger condition, the first control operation corresponding to the trend information is executed, including: When the short-term change is negative for several consecutive periods and the short-term trend change is negative, the state evaluation value is determined to be declining. The first control operation includes releasing the memory resources occupied by at least some functional modules on the device. When the short-term change is positive for several consecutive periods and the short-term trend change is positive, the state evaluation value is determined to be on an upward trend. The first control operation includes preloading the resources required by at least some functional modules on the device.
5. The memory management method according to claim 1, characterized in that, Each of the aforementioned numerical intervals corresponds to a state level. The higher the preset numerical interval in which the state evaluation value falls, the higher the corresponding state level. The step of executing the second control operation according to the control strategy corresponding to the state level includes: When the status level is the first status level, all functional modules on the device are enabled. When the state level is the second state level, the non-core operators in the functional module are turned off. When the state level is the third state level, reduce the data input rate and / or data resolution of the functional module; When the status level is the fourth status level, all functional modules on the device are shut down.
6. The memory management method according to claim 5, characterized in that, The method further includes: The current state level is determined based on the preset numerical range, and the decrease threshold and increase threshold are determined accordingly, wherein the increase threshold is greater than the decrease threshold. When the state evaluation value is lower than the decline threshold for multiple consecutive cycles, the current state level will be switched to a lower state level. When the status evaluation value is higher than the rising threshold for multiple consecutive cycles, the current status level will be switched to a higher status level. When the state evaluation value is between the decreasing threshold and the increasing threshold, the current state level remains unchanged.
7. The memory management method according to claim 1, characterized in that, The method further includes: Obtain the priority of each functional module on the device; the priority is determined by at least one of the following: the service type of each functional module, the hit rate in the current scenario, and the timeliness requirement; The first control operation and / or the second control operation are executed according to the stated priority.
8. A memory management device, characterized in that, include: The status assessment module is used to acquire the real-time operating status of the device and determine the current status assessment value of the device based on the real-time operating status. The first operation module is used to obtain the trend information of the change of the state evaluation value in the historical time domain, and when the trend information meets the preset triggering conditions, execute the first control operation corresponding to the trend information. The first control operation is used to pre-adjust the operating state of the functional modules on the device before the state level corresponding to the state evaluation value changes; The second operation module is used to determine the current state level of the device according to the preset value range to which the state evaluation value belongs, and to perform a second control operation according to the control strategy corresponding to the state level to adjust the operating state of the functional modules on the device.
9. A computer device, comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the memory management method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the memory management method according to any one of claims 1 to 7.