Memory monitoring method and apparatus
By obtaining the RSS of the resident physical memory occupied by the process and determining the PSS or USS according to the preset correction value, the problem of large resource overhead in the existing technology is solved and the smooth operation of the terminal device is realized.
Patent Information
- Application Number
- PCT/CN2023/142902
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-22
- Filing Date
- 2023-12-28
- Publication Date
- 2024-08-29
AI Technical Summary
Existing memory monitoring methods cause high resource overhead by frequently querying the PSS or USS of the process, causing problems such as freezing and heating of the terminal device.
By obtaining the resident physical memory RSS occupied by the process and determining the PSS or USS based on the preset correction value, resource overhead is reduced and the terminal device is guaranteed to run smoothly.
It achieves efficient determination of memory usage without directly obtaining PSS or USS, reduces resource overhead, and avoids freezing and heating problems of terminal equipment.
Smart Images

Figure CN2023142902_29082024_PF_FP_ABST
Abstract
Description
Memory monitoring method and device
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 22, 2023, with application number 202310187242.5 and application name “Memory Monitoring Method and Device,” the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of communications, and in particular to a memory monitoring method and device. Background Art
[0003] With technological advancements, OEMs are increasingly focusing on monitoring process system resource usage. Process memory, as a crucial component of process system resources, is monitored in real time to obtain real-time monitoring results. These real-time monitoring results can be used in scenarios such as system performance optimization, memory leak detection, and degradation remediation. Real-time monitoring of process memory is achieved by frequently obtaining the memory size of a process. Three common metrics for measuring the memory size of a process are proportional set size (PSS), also known as the memory occupied by shared libraries; unique set size (USS), also known as the memory excluding shared libraries; and resident set size (RSS), also known as the memory including all shared libraries. Of these three metrics, PSS and USS are more suitable for memory monitoring scenarios. In such scenarios, the PSS or USS of a process is typically polled regularly as real-time monitoring results.
[0004] In existing memory monitoring methods, the large query resource overhead of the PSS or USS of the polling process may cause problems such as freezing and heating of terminal devices.
[0005] Summary of the Invention
[0006] The present application provides a memory monitoring method and device, which has low resource overhead during monitoring and can ensure smooth operation of terminal devices.
[0007] To achieve the above objectives, this application adopts the following technical solutions:
[0008] In a first aspect, a memory monitoring method is provided, the method comprising: obtaining a first resident physical memory RSS occupied by a process; and determining a first memory including a first PSS and / or a first USS according to the first RSS.
[0009] In the first aspect, the first resident physical memory RSS occupied by the process is first obtained, and then the first memory (first PSS and / or first USS) is determined based on the first RSS. Only RSS needs to be obtained without obtaining PSS or USS to determine the PSS or USS. The required resource overhead is small, which can ensure the smooth operation of the terminal device.
[0010] In a possible implementation, determining the first memory according to the first RSS includes: determining the first memory according to the first RSS and a preset correction value corresponding to a memory type of the first memory.
[0011] In this implementation, the first memory is determined according to the first RSS and the preset correction value. The first memory can be efficiently determined by obtaining the RSS without obtaining the PSS or the USS.
[0012] In a possible implementation, obtaining the first RSS occupied by the process includes: obtaining the first RSS occupied by the process through a preset node.
[0013] In this implementation, the first RSS occupied by the process is obtained through a preset node, and the efficiency of obtaining the first RSS is relatively high.
[0014] In one possible implementation, the preset correction value includes a PSS correction value and / or a USS correction value, the PSS correction value is calculated based on the second RSS and the second PSS, and the USS correction value is calculated based on the second RSS and the second USS, wherein the second RSS, the second PSS, and the second USS are obtained before the first RSS occupied by the acquisition process.
[0015] In this implementation, the preset correction value is calculated using the second RSS, the second PSS, and the second USS obtained before obtaining the first RSS, which can ensure that the preset correction value in the same process has high accuracy.
[0016] In a possible implementation, after determining the first memory according to the preset correction value and the first RSS, the method further includes: updating the preset correction value.
[0017] In this implementation, after the first memory is determined according to the first RSS and the preset correction value, the preset correction value is updated, which can ensure the accuracy of the preset correction value.
[0018] In a possible implementation, updating the preset correction value includes: updating the preset correction value according to a preset update frequency.
[0019] In this implementation, after the first memory is determined according to the first RSS and the preset correction value, the preset correction value is updated according to the preset update frequency, which can ensure the accuracy of the preset correction value.
[0020] In one possible implementation, the method also includes: when the first memory meets the preset memory exception condition, obtaining the second memory occupied by the process with the same memory type as the first memory; the second memory is obtained by accumulating the size of the number of pages of the virtual memory area linked list corresponding to the process; when the second memory does not meet the preset memory exception condition, adjusting the preset update frequency.
[0021] In this implementation, when the first memory meets the preset memory exception condition, the second memory occupied by the process is obtained, and when the second memory does not meet the preset memory exception condition, the preset update frequency of the preset correction value is adjusted to ensure the accuracy of the preset correction value.
[0022] In a possible implementation, different software information processes correspond to different or the same preset update frequencies.
[0023] In this implementation, processes of different software information correspond to different or the same preset update frequencies, so that the update frequency of the preset correction value is suitable for the corresponding process, thereby ensuring the accuracy of the preset correction value.
[0024] In one possible implementation, updating the preset correction value includes: executing a first operation for optimizing the memory occupied by the process when the first memory meets the preset memory exception condition; obtaining a third memory occupied by the process of the same memory type as the first memory; and updating the preset correction value when the difference between the third memory and the first memory does not meet the preset condition.
[0025] In this implementation, when the first memory meets the preset memory exception condition, the first operation for optimizing the memory occupied by the process is performed, and then the third memory occupied by the process is obtained, and when the difference between the third memory and the first memory does not meet the preset condition, the preset correction value is updated, which can ensure the accuracy of the preset correction value.
[0026] In a possible implementation, the method further includes: when the shared memory occupied by the process has not been completely allocated and the preset correction value needs to be updated, updating the preset correction value after a second preset time delay.
[0027] In this implementation, when the shared memory occupied by the process has not been allocated and the preset correction value needs to be updated, the updating of the preset correction value is delayed for a second preset time, thereby avoiding unnecessary updating of the preset correction value and saving terminal computing power.
[0028] In one possible implementation, obtaining the first RSS occupied by a process includes: obtaining the first RSS occupied by the process when the process is created; or obtaining the first RSS occupied by the process according to a first preset time; or obtaining the first RSS occupied by the process when the system memory meets a preset memory threshold; or obtaining the first RSS occupied by the process when a system component generates a memory acquisition request.
[0029] In this implementation, several possible opportunities for obtaining the first RSS are introduced, and the first RSS can be obtained in a timely manner based on the several possible opportunities.
[0030] In a second aspect, a memory monitoring device is provided, which can be a chip or system on chip of a terminal device. The device includes: a processing module for obtaining the first resident physical memory RSS occupied by the process; the processing module is also used to determine the first memory based on the first RSS, and the first memory includes a first proportional physical memory PSS and / or a physical memory USS occupied solely by the first process.
[0031] In a possible implementation, the processing module is specifically configured to determine the first memory according to the first RSS and a preset correction value, wherein the preset correction value corresponds to a memory type of the first memory.
[0032] In a possible implementation, the processing module is specifically configured to: obtain a first RSS occupied by a process through a preset node.
[0033] In one possible implementation, the preset correction value includes a PSS correction value and / or a USS correction value, the PSS correction value is calculated based on the second RSS and the second PSS, and the USS correction value is calculated based on the second RSS and the second USS, wherein the second RSS, the second PSS, and the second USS are obtained before the first RSS occupied by the acquisition process.
[0034] In a possible implementation, the processing module is further configured to: after determining the first memory according to the preset correction value and the first RSS, update the preset correction value.
[0035] In a possible implementation, the processing module is specifically configured to update the preset correction value according to a preset update frequency.
[0036] In one possible implementation, the processing module is also used to: when the first memory meets the preset memory exception condition, obtain the second memory occupied by the process, the second memory has the same memory type as the first memory; the second memory is obtained by accumulating the size of the number of pages of the virtual memory area linked list corresponding to the process; when the second memory does not meet the preset memory exception condition, adjust the preset update frequency.
[0037] In a possible implementation, different software information processes correspond to different or the same preset update frequencies.
[0038] In one possible implementation, the processing module is specifically used to: execute a first operation when the first memory meets the preset memory exception condition, and the first operation is used to optimize the memory occupied by the process; obtain a third memory occupied by the process, and the memory type of the third memory is the same as that of the first memory; and update the preset correction value when the difference between the third memory and the first memory does not meet the preset condition.
[0039] In a possible implementation, the processing module is further configured to: when the shared memory occupied by the process has not been completely allocated and the preset correction value needs to be updated, update the preset correction value after a second preset time delay.
[0040] In one possible implementation, the processing module is specifically used to: obtain the first RSS occupied by the process when the process is created; or obtain the first RSS occupied by the process according to a first preset time; or obtain the first RSS occupied by the process when the system memory meets the preset memory threshold; or obtain the first RSS occupied by the process when the system component generates a memory acquisition request.
[0041] In a third aspect, the present application provides a memory monitoring device, comprising a processor configured to support the memory monitoring device in executing the method of the first aspect. Furthermore, the memory monitoring device may further comprise a memory storing computer instructions, wherein the processor may execute the computer instructions to execute the method of the first aspect.
[0042] In a fourth aspect, the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed, the method of the first aspect is executed.
[0043] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method of the first aspect.
[0044] In a sixth aspect, the present application provides a chip, which includes a processor, and the processor is used to support a memory monitoring device to execute the method of the first aspect.
[0045] Among them, the beneficial effects described in the second to sixth aspects of this application can refer to the analysis of the beneficial effects of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] FIG1 is a flow chart of a memory monitoring method according to an embodiment of the present application;
[0047] FIG2 is a second flow chart of a memory monitoring method provided in an embodiment of the present application;
[0048] FIG3 is a third flow chart of a memory monitoring method provided in an embodiment of the present application;
[0049] FIG4 is a fourth flow chart of a memory monitoring method provided in an embodiment of the present application;
[0050] FIG5 is a fifth flow chart of a memory monitoring method provided in an embodiment of the present application;
[0051] FIG6 is a sixth flow chart of a memory monitoring method provided in an embodiment of the present application;
[0052] FIG7 is a seventh flow chart of a memory monitoring method provided in an embodiment of the present application;
[0053] FIG8 is a flowchart of a memory monitoring method according to an embodiment of the present application;
[0054] FIG9 is a ninth flowchart of a memory monitoring method provided in an embodiment of the present application;
[0055] FIG10 is a schematic structural diagram of a memory monitoring device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The network architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field will know that with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0057] Before introducing the embodiments of the present application, some terms involved in the embodiments of the present application are explained.
[0058] PSS: The sum of the PSS used by all processes represents the total memory usage of the entire machine and is a useful indicator of memory size in most situations. Querying PSS requires traversing the virtual memory area (VMA) list and summing the number of pages corresponding to each process, which consumes significant query resources and is time-consuming.
[0059] USS: Because it doesn't include other shared library content, it's suitable for detecting issues like memory bloat and memory leaks. When querying USS, you need to traverse the vma linked list and accumulate the corresponding page counts, which consumes more query resources and takes a long time.
[0060] RSS: Calculates the total number of file pages, anonymous pages, and shared memory pages corresponding to the process. This reduces query resource usage and time consumption when querying RSS.
[0061] The following examples illustrate PSS, USS, and RSS. Assume a system has only two processes: process1 (5MB of independent memory), process2 (5MB of independent memory), and a shared library, test.so (10MB of file size, 3MB of which is loaded into memory). Taking process1 as an example, its PSS, USS, and RSS usage are shown in Table 1:
[0062] Table 1
[0063] In monitoring scenarios, the PSS or USS of a process is typically polled periodically as real-time monitoring results. Taking the Android system as an example, the PSS or USS of a process is polled using the Android Application Profiler. The Android Application Profiler is an Android native application memory information monitoring module that collects the PSS or USS occupied by a process through periodic queries. Specifically, the PSS / USS value of a process is queried through the proc / pid / smaps node. When querying the PSS or USS occupied by multiple processes, the query resource overhead is high, causing issues such as lag and overheating on the terminal device.
[0064] To address the above technical issues, an embodiment of the present application provides a memory monitoring method that obtains the RSS occupied by a process and determines the PSS or USS occupied by the process based on a preset correction value and the RSS. Compared to directly collecting the PSS or USS occupied by a process, this method reduces resource overhead during monitoring and ensures smooth operation of the terminal device. The method provided by an embodiment of the present application is described below in conjunction with the accompanying drawings.
[0065] The execution subject of the memory monitoring method provided in the embodiment of the present application can be a terminal device (terminal equipment). The terminal device can be a user equipment (UE), a mobile station (MS) or a mobile terminal (MT), etc. Specifically, the terminal device can be a mobile phone, a tablet computer or a computer with wireless transceiver function, and can also be a virtual reality (VR) terminal, an augmented reality (AR) terminal, a wireless terminal in industrial control, a wireless terminal in unmanned driving, a wireless terminal in telemedicine, a wireless terminal in a smart grid, a wireless terminal in a smart city, a smart home, or a vehicle-mounted terminal, etc. In the embodiment of the present application, the device for realizing the function of the terminal device can be a terminal device, or it can be a device that can support the terminal device to realize the function, such as a chip system, which can be installed in the terminal device or used in combination with the terminal device. The present application does not limit the execution subject of the memory monitoring method. The following describes the method provided in the embodiment of the present application by taking the device for realizing the function of the terminal device as an example.
[0066] FIG1 shows a flow chart of a memory monitoring method according to an embodiment of the present application. As shown in FIG1 , the method may include the following steps:
[0067] S110, obtaining the first resident physical memory RSS occupied by the process.
[0068] Among them, the current RSS is obtained through the proc / pid / smaps node. The proc / pid / smaps node will perform vma traversal during collection, scan each vma node and accumulate the number of pages corresponding to the process to obtain the RSS. This is an O(n) algorithm operation. The larger the process memory usage, the longer the collection time, which is very time-consuming. However, the embodiment of the present application directly obtains the first RSS from the kernel. Specifically, it directly reads the file pages, anonymous pages, and shared memory pages belonging to the process and adds the read contents to obtain the first RSS. The operation speed is the speed of the O(1) algorithm. Regardless of the process memory usage, the collection time is a constant value and the value is very small.
[0069] S120: Determine a first memory according to the first RSS.
[0070] Among them, combined with the example in Table 1, it can be seen that in the same process, RSS, PSS, and USS have a numerical correspondence. Based on this numerical correspondence, the first memory including the first PSS and / or the first USS can be determined based on the first RSS. The specific memory type of the first memory can be pre-set according to the monitoring scenario requirements, and can include the first PSS, the first USS, or the first PSS and the first USS.
[0071] The determined first memory can be viewed through system logs, kernel logs, systrace, or kernel flame graphs. Experiments have shown that the current method for collecting RSS and PSS (or USS) through the proc / pid / smaps node and the method provided by the embodiments of this application are executed simultaneously on the same process. Upon comparison, the RSS collected by the two methods is the same, while the PSS (or USS) determined by each method is generally different, but relatively close.
[0072] In an embodiment of the present application, the first resident physical memory RSS occupied by the process is first obtained, and then the first memory (first PSS and / or first USS) is determined based on the first RSS. It is only necessary to obtain the RSS without obtaining the PSS or USS to determine the PSS or USS. The required resource overhead is relatively small, which can ensure the smooth operation of the terminal device.
[0073] In one embodiment, as shown in FIG2 , FIG2 shows a second flow chart of the memory monitoring method provided in an embodiment of the present application, S110 may include: S210 , obtaining a first RSS occupied by a process through a preset node.
[0074] The preset node may be a node dedicated to obtaining the first resident physical memory RSS occupied by the process, and is used to obtain the first RSS. The node may be set in the kernel in the form of a folder to read the file pages, anonymous pages, and shared memory pages belonging to the process, and add the read contents to obtain the first RSS. For example, it may be set to proc / pid / rss.
[0075] In the embodiment of the present application, the first RSS occupied by the process is obtained through a preset node, and the efficiency of obtaining the first RSS is relatively high.
[0076] In one embodiment, the first RSS occupied by the process in S110 may be obtained at the following times:
[0077] The first RSS occupied by the process can be obtained when the process is created. When the process is created, it is necessary to monitor the PSS or USS, and then the first RSS can be obtained at this time to determine the first PSS or the first USS.
[0078] The first RSS occupied by the process can also be obtained periodically according to a first preset time. The first preset time can be pre-set and can be specifically set according to the software information corresponding to the process. Processes with different software information can correspond to different or the same first preset time. For example, the first preset time can be set to every 5 seconds.
[0079] You can also obtain the first RSS of the process's usage when the system memory meets the preset memory threshold. This scenario generally corresponds to a scenario with high system memory pressure. For example, if a mobile phone has an 8GB physical memory capacity and 7GB is occupied, the system memory pressure is high and the system memory is considered to have met the preset memory threshold. The preset memory threshold can be flexibly customized based on the terminal's system memory capacity.
[0080] The first RSS occupied by a process can also be obtained when a system component generates a memory acquisition request. During operation, a system component may need to obtain the first PSS or the first USS. In this case, the system component will generate a memory acquisition request, which can request the first PSS, the first USS, or both.
[0081] In the embodiment of the present application, several possible opportunities for obtaining the first RSS are introduced, and the first RSS can be obtained in a timely manner based on these possible opportunities.
[0082] In one embodiment, as shown in FIG3 , FIG3 shows a flow chart 3 of the memory monitoring method provided in the embodiment of the present application. S120: Determining the first memory according to the first RSS may include:
[0083] S310: Determine a first memory according to a first RSS and a preset correction value.
[0084] The preset correction value corresponds to the memory type of the first memory. For example, if the first memory includes a first PSS, the preset correction value is a PSS correction value used to correct the PSS; if the first memory includes a first USS, the preset correction value is a USS correction value used to correct the USS; if the first memory includes a first PSS and a first USS, the preset correction value includes both a PSS correction value and a USS correction value.
[0085] As can be seen from the example in Table 1, there is a numerical correspondence between the RSS, PSS, and USS occupied by the same software process, and the preset correction value can indicate this numerical correspondence. Based on the preset correction value and the first RSS, the first memory can be determined. For example, the preset correction value can represent the difference between the first memory and the first RSS. The PSS correction value corresponding to the first PSS is OFFSETpss, so the first PSS = first RSS – OFFSETpss; the USS correction value corresponding to the first USS is OFFSETuss, so the first USS = first RSS – OFFSETuss. For another example, the preset correction value can also represent the percentage of the first memory relative to the first RSS. The PSS correction value corresponding to the first PSS is OFFSETpss, so the first PSS = first RSS × OFFSETpss; the USS correction value corresponding to the first USS is OFFSETuss, so the first USS = first RSS × OFFSETuss.
[0086] In the embodiment of the present application, the first memory is determined according to the first RSS and the preset correction value. The first memory can be efficiently determined by obtaining the RSS without obtaining the PSS or USS.
[0087] In step S310, the role of the preset correction value in determining the first memory is described from an application perspective. Before applying the preset correction value, the preset correction value must first be determined. The following describes the process of determining the preset correction value.
[0088] In one embodiment, when determining the first memory, the PSS correction value and / or the USS correction value need to be applied, as shown in FIG4 , which shows a fourth flow chart of the memory monitoring method provided by an embodiment of the present application. Prior to S110 , the method may further include:
[0089] S410: Acquire a second RSS occupied by the process, and acquire a second PSS and / or a second USS occupied by the process.
[0090] Among them, the process described in S410 is the same process as the process described in S110. Referring to the description of S210, the second RSS occupied by the process can be read through the customized kernel node proc / pid / rss. The second PSS and the second USS can be obtained through the proc / pid / smaps node. The difference between the second PSS and the first PSS (the second USS and the first USS) is that the acquisition (determination) time of the two is different, the former is earlier and the latter is later, and the former is actually read through the kernel node proc / pid / smaps (or proc / pid / rss), while the latter is determined by the preset correction value and the first RSS (which can be understood as estimated).
[0091] S420: Calculate a PSS correction value based on the second RSS and the second PSS, and / or calculate a USS correction value based on the second RSS and the second USS.
[0092] Among them, combined with the example in Table 1, it can be seen that there is a numerical correspondence between the RSS, PSS, and USS occupied by the same software process. Based on this numerical correspondence, the PSS correction value and USS correction value can be determined. Continuing with the example in the description of S310, the PSS correction value corresponding to the first PSS is OFFSETpss, then OFFSETpss = second RSS - second PSS; the USS correction value corresponding to the first USS is OFFSETuss, then OFFSETuss = second RSS - second USS.
[0093] In the embodiment of the present application, the preset correction value is calculated based on the second RSS, the second PSS, and the second USS obtained before obtaining the first RSS, which can ensure that the preset correction value in the same process has high accuracy.
[0094] In steps S410-S420, how to obtain the preset correction value is described from the perspective of generation. After the preset correction value is generated and applied in S310, as the process runs, the preset correction value generated at an earlier time may not accurately reflect the data correspondence between the RSS, PSS, and USS at the current time. In order to improve the accuracy of the preset correction value, as shown in Figure 5, Figure 5 shows a flowchart diagram of the memory monitoring method provided in the embodiment of the present application. After S310, the embodiment of the present application may also include:
[0095] S510, updating the preset correction value.
[0096] Among them, the principle of updating the preset correction value can refer to the description of calculating the preset correction value in S410-S420. The difference is that the time of taking RSS, PSS, and USS is changed. The specific calculation process is the same and will not be repeated here.
[0097] Furthermore, the preset correction value can be updated according to a preset update frequency. This preset update frequency can be flexibly set for different software information, and different software information processes can correspond to different or the same preset update frequency. The software information includes the software version and the system the software is applicable to. This allows the preset correction value update frequency to be adapted to the corresponding process, thereby ensuring the accuracy of the preset correction value.
[0098] For example, the preset update frequencies corresponding to Android version 1.0 software A and Android version 1.0 software B can be once every 5 minutes and once every 30 minutes respectively; the preset update frequencies corresponding to Android version 1.0 software A and Android version 2.0 software A can be once every 5 minutes and once every 6 minutes respectively; the preset update frequencies corresponding to Android version 1.0 software A and Android version 1.0 software A can be once every 10 minutes and once every 6 minutes respectively.
[0099] In the embodiment of the present application, after the first memory is determined according to the first RSS and the preset correction value, the preset correction value is updated to ensure the accuracy of the preset correction value.
[0100] In one embodiment, in order to further improve the accuracy of the preset correction value, the update frequency of the preset correction value can also be adjusted. As shown in Figure 6, Figure 6 shows a flow chart of the memory monitoring method provided by the embodiment of the present application. The method may also include:
[0101] S610: When the first memory meets a preset memory abnormality condition, obtain a second memory occupied by the process.
[0102] Among them, the preset memory abnormality conditions may include the memory of the process increasing rapidly in a short period of time (memory leak) or accumulating little by little over a long period of time without self-recovery (memory expansion). The second memory has the same memory type as the first memory. For example, if the memory type of the first memory includes PSS, the memory type of the second memory also includes PSS; if the memory type of the first memory includes PSS and USS, the memory type of the second memory also includes PSS and USS. The second memory is obtained by accumulating the size of the vma linked list pages corresponding to the process, that is, the second memory is actually read.
[0103] S620: If the second memory does not meet the preset memory abnormality condition, adjust the preset update frequency.
[0104] The second memory is the actual memory read. If it does not show any abnormality, it indicates that the memory is actually normal, while the first memory meets the preset memory abnormality conditions. This indicates that the first memory determined by the preset correction value is inaccurate. The original preset correction value's preset update frequency may be too low, resulting in a low accuracy of the preset correction value. In this case, the preset update frequency should be adjusted to ensure the accuracy of the preset correction value.
[0105] In an embodiment of the present application, when the first memory meets the preset memory abnormality condition, the second memory occupied by the process is obtained, and when the second memory does not meet the preset memory abnormality condition, the preset update frequency of the preset correction value is adjusted, so as to ensure the accuracy of the preset correction value.
[0106] In one embodiment, a strategy for triggering the update of the preset correction value is also provided. As shown in FIG7 , FIG7 shows a flow diagram of the memory monitoring method provided in an embodiment of the present application. S510 may include:
[0107] S710: Execute a first operation when the first memory meets a preset memory abnormality condition.
[0108] The first operation is used to optimize the memory used by the process. Optimizing the memory used by the process can eliminate memory anomalies. For example, the first operation can be to start a process cleanup interface or restart the process. Both operations can clear process garbage to achieve the purpose of optimizing the memory used by the process.
[0109] S720: Obtain the third memory occupied by the process.
[0110] The third memory has the same memory type as the first memory. For example, if the first memory includes PSS, the third memory also includes PSS; if the first memory includes PSS and USS, the third memory also includes PSS and USS. The third memory is obtained by adding the number of vma linked list pages corresponding to the process. In other words, the third memory is actually read.
[0111] S730: When the difference between the third memory and the first memory does not meet the preset condition, update the preset correction value.
[0112] Among them, if the memory is abnormal, after optimizing the memory occupied by the process, the memory occupied by the process is usually much different from the memory before optimization. If the accuracy of the preset correction value is high, the third memory obtained after optimizing the memory occupied by the process should also have a large difference with the first memory. The preset condition is used to determine whether the difference between the first memory and the third memory is "large enough". The preset condition can be flexibly set for different software information, and processes with different software information can correspond to different or the same preset conditions. For example, the process of a certain software A occupies more than 1000MB of memory during operation, and after optimizing the memory occupied by the process, the memory occupied can be reduced to about 800MB, then the preset condition can be set to be greater than 100MB. If the difference between the third memory and the first memory does not meet the preset condition, it means that the accuracy of the preset correction value is not enough, and the first memory determined by the preset correction value does not match the corresponding actual memory. In this case, update the preset correction value to ensure the accuracy of the preset correction value.
[0113] In an embodiment of the present application, when the first memory meets the preset memory abnormality condition, the first operation for optimizing the memory occupied by the process is performed, and then the third memory occupied by the process is obtained, and when the difference between the third memory and the first memory does not meet the preset condition, the preset correction value is updated, which can ensure the accuracy of the preset correction value.
[0114] In one embodiment, as shown in FIG8 , FIG8 shows a flowchart of a memory monitoring method provided by an embodiment of the present application. The embodiment of the present application may further include:
[0115] S810 , when the shared memory occupied by the process has not been completely allocated and the preset correction value needs to be updated, execute S510 after a second preset time delay.
[0116] Among them, the shared memory occupied by the process has not been allocated to the end, for example, the process has just started, the priority (adjustment, adj) score of the process has been switched, etc. In this case, since the shared memory is allocated in real time, the memory occupied by the process fluctuates greatly, and the updated preset correction value has a poor match with the memory after the shared memory allocation is completed. If the shared memory occupied by the process has not been allocated to the end and the preset correction value needs to be updated, the update of the preset correction value is executed after a delay of the second preset time, eliminating unnecessary updates of the preset correction value and saving terminal computing power. The second preset time can be flexibly set for different software information, and processes of different software information can correspond to different or the same second preset time. For example, the time required for the shared memory occupied by the process of a certain software A to be allocated is generally about 20S, so the second preset time can be set to 30s.
[0117] In an embodiment of the present application, when the shared memory occupied by the process has not been allocated and the preset correction value needs to be updated, the updating of the preset correction value is delayed for a second preset time, thereby avoiding unnecessary updates of the preset correction value and saving terminal computing power.
[0118] In one embodiment, some or all of the parameters obtained and determined in the various embodiments of the present application (for example, the first RSS, the first memory, the preset correction value, the second RSS, the second PSS, and the second USS, etc.) can be used for big data analysis to adjust some or all of the adjustable parameters set in the embodiments of the present application (for example, the preset update frequency, the preset memory abnormality condition, the preset condition, the first preset time, and the second preset time, etc.) to improve the accuracy of the output first memory. When performing big data analysis, training can be performed with the help of a big data analysis model to adjust the adjustable parameters, for example, a neural network model. Specifically, the adjustable parameters are used as model parameters, the parameters obtained in the various embodiments of the present application are used as label data, and the parameters determined in the various embodiments of the present application are used as training data. Iterative training is performed to adjust the adjustable parameters until the model converges. The adjustable parameters at this time are the adjusted adjustable parameters. The specific training method of the neural network model is relatively mature, and reference can be made to the corresponding existing technology, which will not be repeated here.
[0119] To help understanding, each of the above embodiments introduces the memory monitoring method provided by the embodiment of the present application from different angles. To help further understanding, the following summarizes some of the processes in the above embodiments to provide a general description of the memory monitoring method provided by the embodiment of the present application. In each step of the general description, the specific introduction and corresponding beneficial effects can be referred to the introduction of the above embodiments, and no further details will be given. Accordingly, in one embodiment, as shown in Figure 9, Figure 9 shows a flow chart nine of the memory monitoring method provided by the embodiment of the present application. The method provided by the embodiment of the present application may also include:
[0120] S910: Generate a memory monitoring task for the process.
[0121] The scenario for generating the memory monitoring task of the process may be when the process is created, when a first preset time is met, when the system memory meets a preset memory threshold, when a system component generates a memory acquisition request, and the like.
[0122] S920: Determine whether there is a preset correction value corresponding to the process.
[0123] If it exists, execute S930; if it does not exist, execute S940.
[0124] The preset correction value may be associated with the process and stored in a storage medium of the terminal.
[0125] S930: Determine whether the preset correction value needs to be updated.
[0126] If necessary, execute S940; if not necessary, execute S950.
[0127] S940, obtaining the RSS occupied by the process; and obtaining the PSS and / or USS; and calculating a PSS correction value based on the RSS and the PSS, and / or calculating a USS correction value based on the RSS and the USS.
[0128] Among them, the specific description of S940 can refer to the description of calculating the preset correction value in S410-S420 in the embodiment of this application.
[0129] S950: Obtain the RSS occupied by the process, and determine the PSS and / or USS according to a preset correction value.
[0130] For the specific description of S950, reference may be made to the descriptions of steps S110-S120, S130, etc. in the embodiments of the present application.
[0131] S960, output PSS and / or USS.
[0132] In the embodiment of the present application, a means of outputting PSS and / or USS is designed for situations where a preset correction value corresponding to a process exists or does not exist, which can ensure the stable output of PSS and / or USS.
[0133] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the execution process. It is understandable that, in order to implement the above functions, the terminal device includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the algorithm steps of each example described in the embodiment disclosed herein, the method of the embodiment of the present application can be implemented in the form of hardware, software, or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0134] The embodiment of the present application can divide the functional modules of the terminal device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. In actual implementation, there may be other division methods.
[0135] In a specific implementation, each network element shown in this application, such as a terminal device, may adopt the structure shown in Figure 10 or include the components shown in Figure 10. Figure 10 is a schematic diagram of the structure of a memory monitoring device provided in an embodiment of this application. When the memory monitoring device has the functions of the terminal device described in an embodiment of this application, the memory monitoring device can be a terminal device or a chip or system-on-chip in the terminal device.
[0136] As shown in Figure 10, the memory monitoring device may include a processor 101, a communication line 102, a transceiver 103, and a memory 104. The processor 101, the memory 104, and the transceiver 103 may be connected via the communication line 102. In one example, the processor 101 may include one or more CPUs, such as CPU0 and CPU1 in Figure 10.
[0137] As an optional implementation, the memory monitoring device includes multiple processors. For example, in addition to the processor 101 in FIG. 10 , it may also include a processor 107 .
[0138] The processor 101 may be a central processing unit (CPU), a general-purpose processor, a network processor (NP), a digital signal processor (DSP), a microprocessor, a microcontroller, a programmable logic device (PLD), or any combination thereof. The processor 101 may also be other devices with processing functions, such as circuits, devices, or software modules.
[0139] The communication line 102 is used to transmit information between the components included in the memory monitoring device.
[0140] Transceiver 103 is used to communicate with other devices or other communication networks. Such other communication networks may be Ethernet, radio access networks (RAN), wireless local area networks (WLAN), etc. Transceiver 103 may be an interface circuit, a pin, a radio frequency module, a transceiver, or any other device capable of communication.
[0141] Furthermore, the memory monitoring device may further include a memory 104. The memory 104 is configured to store instructions, wherein the instructions may be computer programs.
[0142] The memory 104 may be a read-only memory (ROM) or other types of static storage devices that can store static information and / or instructions, or a random access memory (RAM) or other types of dynamic storage devices that can store information and / or instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc storage, optical disk storage, magnetic disk storage media, or other magnetic storage devices. Optical disc storage includes compact discs, laser discs, optical discs, digital versatile discs, or Blu-ray discs, etc.
[0143] It should be noted that memory 104 can exist independently of processor 101 or can be integrated with processor 101. Memory 104 can be used to store instructions, program code, or data, etc. Memory 104 can be located within or outside the memory monitoring device, without limitation. When processor 101 executes instructions stored in memory 104, the method provided in the embodiments of the present application can be implemented.
[0144] As an optional implementation, the memory monitoring apparatus further includes an output device 105 and an input device 106. For example, the input device 106 is a touch panel, a microphone, or the like, and the output device 105 is a display screen, a speaker, or the like.
[0145] It should be noted that the memory monitoring device can be a desktop computer, a portable computer, a network server, a mobile phone, a tablet computer, a wireless terminal, an embedded device, a chip system, or a device having a structure similar to that shown in FIG10 . Furthermore, the component structure shown in FIG10 does not limit the memory monitoring device. In addition to the components shown in FIG10 , the memory monitoring device may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0146] In the embodiment of the present application, the chip system can be composed of chips, or can include chips and other discrete devices.
[0147] The embodiment of the present application also provides a memory monitoring device, which is applied to a terminal device. Each module in the memory monitoring device has the function of implementing the corresponding steps in the embodiment of the method of the present application and can achieve its corresponding technical effect. The beneficial effects corresponding to the execution steps of each module can be referred to the description of the corresponding steps in the embodiment of the method of the present application, and will not be repeated here. The function can be implemented by hardware or by hardware executing the corresponding software. The hardware or software includes one or more modules corresponding to the above functions. The memory monitoring device can be a terminal device or a chip or system on chip in the terminal device. For example, the memory monitoring device includes:
[0148] The processing module is used to obtain the first resident physical memory RSS occupied by the process; the processing module is also used to determine the first memory according to the first RSS, the first memory including the first proportional physical memory PSS and / or the physical memory USS occupied solely by the first process.
[0149] In one embodiment, the processing module is specifically configured to determine the first memory according to the first RSS and a preset correction value, wherein the preset correction value corresponds to the memory type of the first memory.
[0150] In one embodiment, the processing module is specifically configured to obtain a first RSS occupied by a process through a preset node.
[0151] In one embodiment, the preset correction value includes a PSS correction value and / or a USS correction value, the PSS correction value is calculated based on the second RSS and the second PSS, and the USS correction value is calculated based on the second RSS and the second USS, wherein the second RSS, the second PSS, and the second USS are obtained before the first RSS occupied by the acquisition process.
[0152] In one embodiment, the processing module is further configured to: after determining the first memory according to the preset correction value and the first RSS, update the preset correction value.
[0153] In one embodiment, the processing module is specifically configured to update the preset correction value according to a preset update frequency.
[0154] In one embodiment, the processing module is also used to: when the first memory meets the preset memory exception condition, obtain the second memory occupied by the process, the second memory has the same memory type as the first memory; the second memory is obtained by accumulating the size of the number of vma linked list pages corresponding to the process; when the second memory does not meet the preset memory exception condition, adjust the preset update frequency.
[0155] In one embodiment, different software information processes correspond to different or the same preset update frequencies.
[0156] In one embodiment, the processing module is specifically used to: execute a first operation when a first memory meets a preset memory exception condition, and the first operation is used to optimize the memory occupied by the process; obtain a third memory occupied by the process, and the memory type of the third memory is the same as that of the first memory; and update the preset correction value when the difference between the third memory and the first memory does not meet the preset condition.
[0157] In one embodiment, the processing module is further configured to: when the shared memory occupied by the process has not been completely allocated and the preset correction value needs to be updated, update the preset correction value after a second preset time delay.
[0158] In one embodiment, the processing module is specifically used to: obtain the first RSS occupied by the process when the process is created; or, obtain the first RSS occupied by the process according to a first preset time; or, obtain the first RSS occupied by the process when the system memory meets the preset memory threshold; or, obtain the first RSS occupied by the process when the system component generates a memory acquisition request.
[0159] The embodiments of the present application also provide a computer-readable storage medium. All or part of the processes in the above-mentioned method embodiments can be completed by a computer program to instruct the relevant hardware, and the program can be stored in the above-mentioned computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned method embodiments. The computer-readable storage medium can be a terminal device of any of the above-mentioned embodiments, such as: an internal storage unit including a data sending end and / or a data receiving end, such as a hard disk or memory of the terminal device. The above-mentioned computer-readable storage medium can also be an external storage device of the above-mentioned terminal device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the above-mentioned terminal device. Furthermore, the above-mentioned computer-readable storage medium can also include both the internal storage unit of the above-mentioned terminal device and an external storage device. The above-mentioned computer-readable storage medium is used to store the above-mentioned computer program and other programs and data required by the above-mentioned terminal device. The above-mentioned computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.
[0160] The present application also provides a computer instruction. All or part of the process in the above method embodiment can be completed by the computer instruction to instruct the relevant hardware (such as a computer, processor, network device, and terminal, etc.). The program can be stored in the above computer-readable storage medium.
[0161] The present application also provides a chip system. The chip system may consist of a chip or may include a chip and other discrete components, without limitation. The chip system includes a processor, and all or part of the processes in the above method embodiments may be performed by the chip system. For example, the chip system may be used to implement the functions performed by the terminal device in the above method embodiments.
[0162] In one possible design, the above-mentioned chip system also includes a memory, which is used to store program instructions and / or data. When the chip system is running, the processor executes the program instructions stored in the memory so that the chip system performs the functions performed by the terminal device in the above-mentioned method embodiment.
[0163] In the embodiments of the present application, the processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present application may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0164] In an embodiment of the present application, the memory may be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), or a volatile memory (volatile memory), such as a random-access memory (RAM). The memory is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory in an embodiment of the present application may also be a circuit or any other device that can implement a storage function, for storing instructions and / or data.
[0165] It should be noted that the terms "first" and "second" in the specification, claims, and drawings of this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products, or devices.
[0166] It should be understood that in the embodiments of the present application, "at least one (item)" refers to one or more, "more than one" refers to two or more, "at least two (items)" refers to two or three and more than three, and "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple. It should be understood that in the embodiments of the present application, "B corresponding to A" means that B is associated with A. For example, B can be determined based on A. It should also be understood that determining B based on A does not mean determining B based solely on A; B can also be determined based on A and / or other information. In addition, the "connection" in the embodiments of the present application refers to various connection methods, such as direct connection or indirect connection, to achieve communication between devices, and the embodiments of the present application do not impose any limitation on this.
[0167] Unless otherwise specified, the "transmission" (transmit / transmission) appearing in the embodiments of the present application refers to bidirectional transmission, including the actions of sending and / or receiving. Specifically, the "transmission" in the embodiments of the present application includes the sending of data, the receiving of data, or the sending of data and the receiving of data. In other words, the data transmission here includes uplink and / or downlink data transmission. Data may include channels and / or signals, uplink data transmission is uplink channel and / or uplink signal transmission, and downlink data transmission is downlink channel and / or downlink signal transmission. The "network" and "system" appearing in the embodiments of the present application express the same concept, and the communication system is the communication network.
[0168] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0169] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0170] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0171] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a device, such as a single-chip microcomputer, a chip, etc., or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
[0172] The above is only a specific embodiment of the present application, but the scope of protection of this application is not limited to this. Any changes or substitutions within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A memory monitoring method, characterized in that: include: Get the first resident physical memory RSS occupied by the process; A first memory is determined according to the first RSS, where the first memory includes a first proportion of physical memory PSS and / or a physical memory USS solely occupied by the first process.
2. The memory monitoring method according to claim 1, characterized in that: The determining the first memory according to the first RSS comprises: A first memory is determined according to the first RSS and a preset correction value, wherein the preset correction value corresponds to a memory type of the first memory.
3. The memory monitoring method according to claim 1 or 2, characterized in that: The first RSS occupied by the acquisition process includes: Get the first RSS occupied by the process through the preset node.
4. The memory monitoring method according to claim 2, characterized in that: The preset correction value includes a PSS correction value and / or a USS correction value, the PSS correction value is calculated based on the second RSS and the second PSS, and the USS correction value is calculated based on the second RSS and the second USS, wherein the second RSS, the second PSS, and the second USS are acquired before the first RSS occupied by the acquisition process.
5. The memory monitoring method according to claim 2 or 4, characterized in that: After determining the first memory according to the preset correction value and the first RSS, the method further includes: The preset correction value is updated.
6. The memory monitoring method according to claim 5, characterized in that: The updating of the preset correction value comprises: The preset correction value is updated according to a preset update frequency.
7. The memory monitoring method according to claim 6, characterized in that: The method further comprises: When the first memory meets the preset memory abnormality condition, obtaining the second memory occupied by the process, where the second memory has the same memory type as the first memory; the second memory is obtained by accumulating the size of the number of pages of the virtual memory area linked list corresponding to the process; When the second memory does not meet the preset memory abnormality condition, the preset update frequency is adjusted.
8. The memory monitoring method according to claim 6 or 7, characterized in that: The processes of different software information correspond to different or the same preset update frequencies.
9. The memory monitoring method according to any one of claims 5 to 8, characterized in that: The updating of the preset correction value comprises: When the first memory meets a preset memory abnormality condition, executing a first operation, wherein the first operation is used to optimize the memory occupied by the process; Acquire a third memory occupied by the process, where the memory type of the third memory is the same as that of the first memory; When the difference between the third memory and the first memory does not meet the preset condition, the preset correction value is updated.
10. The memory monitoring method according to any one of claims 5 to 9, characterized in that: The method further comprises: In the case that the shared memory occupied by the process has not been completely allocated and the preset correction value needs to be updated, the updating of the preset correction value is executed after a second preset time delay.
11. The memory monitoring method according to any one of claims 1 to 10, characterized in that: The first RSS occupied by the acquisition process includes: When the process is created, obtaining the first RSS occupied by the process; Alternatively, the first RSS occupied by the process is obtained regularly according to a first preset time; Alternatively, when the system memory meets a preset memory threshold, obtaining the first RSS occupied by the process; Alternatively, when a system component generates a memory acquisition request, the first RSS occupied by the process is acquired.
12. A memory monitoring device, characterized in that: include: A processing module, used for obtaining the first resident physical memory RSS occupied by the process; The processing module is further used to determine a first memory according to the first RSS, where the first memory includes a first proportion of physical memory PSS and / or a physical memory USS occupied solely by the first process.
13. The memory monitoring device according to claim 12, characterized in that: The processing module is specifically used for: A first memory is determined according to the first RSS and a preset correction value, wherein the preset correction value corresponds to a memory type of the first memory.
14. The memory monitoring device according to claim 12 or 13, characterized in that: The processing module is specifically used for: Get the first RSS occupied by the process through the preset node.
15. The memory monitoring device according to claim 13, characterized in that: The preset correction value includes a PSS correction value and / or a USS correction value, the PSS correction value is calculated based on the second RSS and the second PSS, and the USS correction value is calculated based on the second RSS and the second USS, wherein the second RSS, the second PSS, and the second USS are acquired before the first RSS occupied by the acquisition process.
16. The memory monitoring device according to claim 13 or 15, characterized in that: The processing module is further used for: After determining the first memory according to the preset correction value and the first RSS, the preset correction value is updated.
17. The memory monitoring device according to claim 16, characterized in that: Processing module, specifically used for: The preset correction value is updated according to a preset update frequency.
18. The memory monitoring device according to claim 17, characterized in that: The processing module is further used for: When the first memory meets the preset memory abnormality condition, obtaining a second memory occupied by the process, where the second memory has the same memory type as the first memory; The second memory is obtained by accumulating the size of the number of pages of the virtual memory area linked list corresponding to the process; When the second memory does not meet the preset memory abnormality condition, the preset update frequency is adjusted.
19. The memory monitoring device according to claim 17 or 18, characterized in that: The processes of different software information correspond to different or the same preset update frequencies.
20. The memory monitoring device according to any one of claims 16 to 19, characterized in that: The processing module is specifically used for: When the first memory meets a preset memory abnormality condition, executing a first operation, wherein the first operation is used to optimize the memory occupied by the process; Acquire a third memory occupied by the process, where the memory type of the third memory is the same as that of the first memory; When the difference between the third memory and the first memory does not meet the preset condition, the preset correction value is updated.
21. The memory monitoring device according to any one of claims 16 to 20, characterized in that: The processing module is further used for: In the case that the shared memory occupied by the process has not been completely allocated and the preset correction value needs to be updated, the updating of the preset correction value is executed after a second preset time delay.
22. The memory monitoring device according to any one of claims 12 to 21, characterized in that: The processing module is specifically used for: When the process is created, obtaining the first RSS occupied by the process; Alternatively, the first RSS occupied by the process is obtained regularly according to a first preset time; Alternatively, when the system memory meets a preset memory threshold, obtaining the first RSS occupied by the process; Alternatively, when a system component generates a memory acquisition request, the first RSS occupied by the process is acquired.
23. A memory monitoring device, characterized in that: The memory monitoring device includes a processor, and the processor is used to support the memory monitoring device to execute the method according to any one of claims 1-11.
24. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed, the method according to any one of claims 1 to 11 is executed.
Citation Information
Patent Citations
Memory monitoring method and device
CN118535409A
Memory management method and device
CN109558297A
Memory consumption tracking
US9471237B1
