Multi-dimensional system memory optimization methods, devices, terminals, and media

By constructing a multi-dimensional memory data map and automating root cause analysis, the problems of fragmented memory monitoring data and low manual efficiency have been solved, enabling accurate location and efficient optimization of memory anomalies and improving system stability.

CN122309172APending Publication Date: 2026-06-30KYLIN CORP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
KYLIN CORP
Filing Date
2026-04-28
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Existing technologies suffer from limited memory monitoring dimensions, fragmented data, lack of root cause-specific optimization, and low manual efficiency, making it difficult to effectively resolve system memory anomalies.

Method used

A multi-dimensional memory optimization approach is adopted, which collects system-level, process-level, and fine-grained memory data to construct a memory data map. Based on the map, the memory pressure level is determined, abnormal processes are screened, fine-grained anomaly judgment rules are invoked to trace the root cause, and optimization strategies are matched for automated optimization.

Benefits of technology

It enables precise location and efficient optimization of memory problems, improves the root cause targeting and optimization efficiency of memory monitoring, reduces manual intervention, and enhances system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122309172A_ABST
    Figure CN122309172A_ABST
Patent Text Reader

Abstract

This invention discloses a multi-dimensional system memory optimization method, apparatus, terminal, and medium, belonging to the field of memory optimization technology. It includes: collecting system-level, process-level, and fine-grained memory data respectively; matching and associating memory data corresponding to the same process PID; constructing a memory data map based on the matched memory data of each process; determining the system memory pressure level; filtering the process set to be analyzed; comparing the process-level memory data in the process set to be analyzed with a preset threshold; marking abnormal processes and generating an abnormal process PID list; for the abnormal processes in the abnormal process PID list, performing root cause tracing to determine the root cause of system memory anomalies; and optimizing the abnormal processes based on the root cause of memory anomalies by matching a reference optimization strategy. Through multi-dimensional memory data fusion and hierarchical pressure-driven rule matching, automated and accurate localization and efficient optimization of the root cause of memory anomalies are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of memory optimization technology, and in particular to a multi-dimensional system memory optimization method, apparatus, terminal, and medium. Background Technology

[0002] During the iterative upgrade of the operating system, new versions of the system often experience abnormal spikes in memory usage for multiple basic desktop processes. Some processes are also accompanied by derivative anomalies such as ineffective sharing of dynamic link libraries, redundant allocation of heap memory, and excessive overhead of memory allocators. These issues directly lead to a reduction in available system memory and process lag, severely impacting the user experience.

[0003] To address the aforementioned issues, existing system memory optimization technologies primarily revolve around two main aspects: memory monitoring and manual optimization. The core process involves collecting system-level or process-level memory data using traditional tools such as `free` and `top`. Technical personnel then manually integrate the data from these different tools, relying on experience to identify the root causes of memory anomalies. They then manually perform piecemeal optimization operations, such as clearing caches and adjusting allocator parameters. Finally, the optimization effects are verified through tool testing.

[0004] However, current technologies primarily rely on single-dimensional metrics for memory monitoring, with data from various tools being fragmented, leading to biased analysis. Optimization efforts are often limited to general operations such as cache clearing and memory release, failing to address the specific root causes of memory anomalies through customized solutions. Furthermore, the entire process is highly dependent on manual intervention, resulting in extremely low overall optimization efficiency and poor optimization outcomes. Summary of the Invention

[0005] This invention provides a multi-dimensional system memory optimization method, device, terminal, and medium to solve the technical problems of single memory monitoring dimensions, fragmented data, lack of root cause targeting in optimization, and low manual efficiency in the prior art.

[0006] In a first aspect, embodiments of the present invention provide a multi-dimensional system memory optimization method, including: System-level memory data, process-level memory data, and fine-grained memory data are collected separately. Using the process PID as the association identifier, the system-level memory data, process-level memory data, and fine-grained memory data corresponding to the same process PID are matched and associated. A memory data map is constructed based on the memory data matched for each process. The system memory pressure level is determined based on the system-level memory data in the memory data map. The process set to be analyzed is filtered according to the system memory pressure level. The process-level memory data in the process set to be analyzed is compared with a preset threshold, abnormal processes are marked, and an abnormal process PID list is generated. For the abnormal processes in the abnormal process PID list, the fine-grained anomaly judgment rule is invoked. Based on the fine-grained anomaly judgment rule and the memory data map, the root cause of the abnormal process is traced to determine the root cause of the system memory anomaly. Based on the root cause of the system memory anomaly, a reference optimization strategy corresponding to the root cause is matched, and the abnormal process is optimized according to the reference optimization strategy.

[0007] Secondly, embodiments of the present invention also provide a system memory optimization device based on multiple dimensions, comprising: The acquisition module is used to collect system-level memory data, process-level memory data, and fine-grained memory data respectively. Using the process PID as the association identifier, it matches and associates the system-level memory data, process-level memory data, and fine-grained memory data corresponding to the same process PID, and constructs a memory data map based on the memory data matched for each process. The comparison module is used to determine the system memory pressure level based on the system-level memory data in the memory data map, filter the process set to be analyzed according to the system memory pressure level, compare the process-level memory data in the process set to be analyzed with a preset threshold, mark abnormal processes and generate an abnormal process PID list. The source tracing module is used to call the fine-grained anomaly judgment rules for the abnormal processes in the abnormal process PID list, and perform root cause tracing of the abnormal processes according to the fine-grained anomaly judgment rules and the memory data map to determine the root cause of system memory anomalies. An optimization module is used to match a reference optimization strategy corresponding to the root cause of the system memory anomaly, and optimize the abnormal process according to the reference optimization strategy.

[0008] Thirdly, embodiments of the present invention also provide a terminal, including: One or more processors; Storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the multi-dimensional system memory optimization method provided in the above embodiments.

[0009] Fourthly, embodiments of the present invention also provide a medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the multi-dimensional system memory optimization method provided in the above embodiments.

[0010] The present invention provides a multi-dimensional system memory optimization method, apparatus, terminal, and medium that collects system-level memory data, process-level memory data, and fine-grained memory data. Using process PIDs as association identifiers, the system-level memory data, process-level memory data, and fine-grained memory data corresponding to the same process PID are matched and associated. A memory data map is constructed based on the matched memory data of each process. The system memory pressure level is determined based on the system-level memory data in the memory data map. A set of processes to be analyzed is selected according to the system memory pressure level. The process-level memory data in the set of processes to be analyzed is compared with a preset threshold to mark abnormal processes and generate an abnormal process PID list. For abnormal processes in the abnormal process PID list, the fine-grained anomaly judgment rule is invoked. Based on the fine-grained anomaly judgment rule and the memory data map, the root cause of the abnormal process is traced to determine the root cause of the system memory anomaly. Based on the root cause of the system memory anomaly, a reference optimization strategy corresponding to the root cause is matched, and the abnormal process is optimized according to the reference optimization strategy. By constructing a multi-dimensional memory data map and automatically tracing the root causes of memory anomalies based on rule matching, we can achieve accurate location and efficient optimization of memory problems. Attached Figure Description

[0011] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.

[0012] Figure 1 This is a flowchart of a multi-dimensional system memory optimization method provided in Embodiment 1 of the present invention; Figure 2 This is a flowchart of a multi-dimensional system memory optimization method provided in Embodiment 2 of the present invention; Figure 3 This is a structural diagram of the multi-dimensional system memory optimization device provided in Embodiment 3 of the present invention; Figure 4 This is a structural diagram of the terminal provided in Embodiment 4 of the present invention. Detailed Implementation

[0013] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0014] Example 1 Figure 1This is a flowchart of a multi-dimensional system memory optimization method provided in Embodiment 1 of the present invention. This embodiment can be applied to the automatic diagnosis and optimization of process memory anomalies in operating systems, and specifically includes the following steps: Step 110: Collect system-level memory data, process-level memory data, and fine-grained memory data respectively. Using the process PID as the association identifier, match and associate the system-level memory data, process-level memory data, and fine-grained memory data corresponding to the same process PID. Construct a memory data map based on the memory data matched for each process.

[0015] System-level memory data reflects the overall memory resource status of the entire operating system, encompassing core metrics such as total physical memory, available memory, swap space usage, and kernel cache. It is used to assess system memory pressure from a macro perspective. Process-level memory data measures the memory usage characteristics of a single running process, including metrics such as process-exclusive memory, proportionate set memory, and resident memory. It serves as a crucial basis for initial identification of process-level memory anomalies and comparison of optimization effects. Fine-grained memory data delves into the internal memory structure of a process, covering detailed metrics such as heap memory, stack memory, dynamic library mapping, effective heap memory, allocator overhead, and anonymous memory blocks. This data is used to precisely trace the root causes of memory anomalies, providing developers with clear directions for code optimization.

[0016] For example, firstly, system-level memory data is collected. Optionally, this can be achieved by reading the meminfo virtual file provided by the Linux system kernel, i.e., the / proc / meminfo file, to achieve non-intrusive collection of system-level memory data. During collection, the contents of this file are read and key fields are extracted: total physical memory data corresponds to the MemTotal field, available memory data corresponds to the MemAvailable field, swap space usage data corresponds to the SwapUsed field, buffer data corresponds to the Buffers field, and page cache data corresponds to the Cached field. Secondly, process-level memory data is collected. Optionally, the open-source memory analysis tool smem can be used. This tool reads the smaps virtual file corresponding to each process in the Linux system, i.e., / proc / <pid>The ` / smaps` file is used to perform statistical calculations based on internal algorithms, enabling batch acquisition of memory usage details for all processes across the entire system. Specifically, the `smem -r` command is executed to extract key metrics for each process. Exclusive memory data reflects the physical memory size that a process completely monopolizes and does not share with other processes. Proportional set memory data is the size of shared memory distributed proportionally to the number of processes using it. Resident memory data reflects the total physical memory currently occupied by a process. Finally, fine-grained memory data is collected. To reduce system overhead, fine-grained data collection adopts an on-demand triggering strategy, meaning that in-depth collection is only performed on processes initially screened as potentially abnormal after process-level data analysis. Specifically, the `smaps` virtual file corresponding to the target process can be directly read to extract memory mapping segment details, and heap memory data, including the Size field for the `[heap]` segment, stack memory data, the Size field for the `[stack]` segment, anonymous memory block size data, and the sum of the Size fields for segments with an Anonymous field greater than 0. Alternatively, the memory mapping analysis tool `pmap` can be called to execute `pmap -X` on the target process. <pid>The command retrieves detailed information about all memory mappings of the process, including the starting address, size, permissions, and mapped file paths of each memory segment, from which dynamic library mapping information can be obtained. Alternatively, the massif module of the heap memory monitoring tool valgrind can be used to perform additional data collection on the target process, obtaining detailed statistics on heap memory allocation and usage, from which valid heap memory data and allocator overhead data can be extracted.

[0017] For example, after collecting system-level memory data, process-level memory data, and fine-grained memory data, the first step is to complete the standardized parsing of the three levels of memory data. For system-level memory data, a lightweight parsing algorithm based on line segmentation, keyword matching, and numerical extraction is used to process the raw unstructured text output by the / proc / meminfo file. The first step is to segment the entire text line by line according to newline characters, forming a list of independent line data. The second step is to filter out blank lines and lines that do not contain valid memory indicators. The third step is to split each line into two parts: the indicator name on the left and the value and unit on the right, using colons as delimiters. The fourth step is to identify and remove the unit character "kB" and convert the values ​​to floating-point numbers in MB. The fifth step is to filter or zero out abnormal data such as negative numbers and null values. Finally, the processed indicator names are used as keys and the standardized values ​​are used as values ​​to construct system-level key-value pair structured data. For process-level memory data, after executing the `smem -r` command, the raw output data is deduplicated and cleaned. Using the process PID as a unique index, metrics such as Unique Memory Set (USS), Proportional Set Memory Set (PSS), and Residual Memory Set (RSS) are categorized and organized to form a structured process memory data set that can be independently searched for each process. For fine-grained memory data, unstructured text output by tools such as `pmap` and `valgrind` is similarly converted into key-value pair structured data associated with the PID using a similar parsing process. Based on this, using the process PID as the core association key, a data association algorithm traverses all standardized three-layer memory data. System-level key-value pair data with the same PID identifier, such as the total system memory, available memory, and swap usage at the process's runtime (global status), process-level key-value pair data, such as the process's USS, PSS, and RSS values, and fine-grained key-value pair data, such as the process's heap size, effective heap memory, and dynamic library mapping information, are integrated and concatenated to form a single aggregated data structure, which is the memory data map constructed for that process. Through the above-mentioned fusion processing, centralized management and associated retrieval of data across all dimensions of a single process, from the macro system environment to the micro memory structure, are achieved. This effectively solves the problem of data fragmentation across different dimensions and provides complete and coordinated data support for subsequent root cause localization of memory anomalies.

[0018] Step 120: Determine the system memory pressure level based on the system-level memory data in the memory data map, filter the process set to be analyzed according to the system memory pressure level, compare the process-level memory data in the process set to be analyzed with a preset threshold, mark abnormal processes and generate an abnormal process PID list.

[0019] In real-world system operation scenarios, deep memory analysis of all processes is not always necessary. If overall memory resources are ample, only a small number of abnormal processes need attention. If memory resources are scarce, the analysis scope needs to be expanded to prevent overlooking potential risks. Therefore, before proceeding to process-level memory anomaly detection, the overall system memory pressure is quantitatively assessed and categorized based on system-level memory data from the memory data map. This allows for dynamic adjustments to subsequent process filtering strategies based on different pressure states, enabling on-demand focus of analysis resources, avoiding unnecessary computational overhead, and improving the overall efficiency of root cause localization. For example, firstly, system-level memory data is extracted from the constructed memory data map, obtaining the recorded total physical memory data, available memory data, and swap space usage data. Next, the available memory data is subtracted from the total physical memory data to obtain the system's currently used memory data. Then, the used memory data is divided by the total physical memory data and multiplied by 100% to calculate the percentage of memory used. Finally, combining swap space usage data and used memory percentage as two core indicators, the system's current memory stress level is determined according to a preset grading standard: when swap space usage is 0 and used memory percentage is less than 20%, it indicates that the system has sufficient memory resources and is considered to be in a stress-free state; when swap space usage is 0 and used memory percentage is between 20% and 50%, it indicates that the system's memory resources are being consumed to some extent and is considered to be in a mild stress state; when swap space usage is greater than 0, or used memory percentage exceeds 50%, it indicates that the system's physical memory is insufficient to support the current operating load and the swap space is being used, and is considered to be in a severe stress state. This grading determination provides a clear basis for subsequent differentiated process selection strategies.

[0020] After determining the system memory pressure level, performing a deep analysis of all processes in the entire system one by one would introduce a large amount of unnecessary computational overhead, especially when the number of system processes is large, which would seriously affect the efficiency of root cause localization. Therefore, it is necessary to dynamically adjust the process screening scope based on the current memory pressure status of the system and prioritize locking suspected abnormal processes to achieve on-demand focus of analysis resources. For example, firstly, a differentiated process screening strategy is implemented based on the determined system memory pressure level. When the system is under no pressure, the exclusive memory data and resident memory data of each process are extracted from the memory data map, and two types of processes are selected for inclusion in the process set to be analyzed: one type is processes whose USS or RSS indicators exceed the corresponding process baseline value by 1.2 times, and the other type is processes whose USS or RSS indicators rank in the top 10% of the system. When the system is under mild pressure, USS and RSS data are also extracted, but the screening threshold is appropriately relaxed, and processes whose USS or RSS exceeds the baseline value, as well as processes whose USS or RSS ranks in the top 20%, are included in the process set to be analyzed. When the system is under heavy pressure, indicating extremely tight memory resources, all user-space processes are included in the analysis set after excluding kernel threads. These processes are then sorted by memory usage from highest to lowest to ensure no potentially abnormal processes are missed. After determining the analysis set, the exclusive memory data, proportional set memory data, and resident memory data for each process are extracted from the memory data map. For each process, these three core memory metrics are compared one by one with preset baseline thresholds. If any of the process's USS, PSS, or RSS exceeds its preset threshold, the process is marked as abnormal, and the corresponding anomaly type is indicated, such as a surge in USS memory or abnormally high PSS memory. Finally, all marked abnormal processes are summarized, their PID information is extracted, and an abnormal process PID list is generated, completing the initial screening of abnormal processes and providing a precise entry point for subsequent fine-grained root cause analysis.

[0021] Step 130: For the abnormal processes in the abnormal process PID list, call the fine-grained anomaly judgment rule, and perform root cause tracing of the abnormal processes according to the fine-grained anomaly judgment rule and the memory data map to determine the root cause of system memory anomalies.

[0022] Although steps 120 have identified processes with abnormal memory metrics, these abnormalities are merely symptoms. To truly resolve the issue, it is necessary to delve deeper and pinpoint the specific technical root causes of the memory anomalies. Different root causes require drastically different optimization paths. Skipping precise source tracing and directly employing general optimization methods will not fundamentally eliminate memory problems.

[0023] For example, for each abnormal process in the abnormal process PID list, fine-grained memory data corresponding to the process is extracted from the constructed memory data map. Through fine-grained anomaly judgment rules, the rule matching algorithm is used to realize the automatic identification and accurate location of five typical memory anomaly root causes. The specific judgment process is as follows: First, the judgment of dynamic library not being effectively shared is to extract the USS and PSS of the abnormal process from the map. When the ratio of USS to PSS is greater than 50% and the process is a general desktop process, it is judged that the dynamic library is not effectively shared. The name of the dynamic library exclusively loaded by the process and the corresponding memory usage are parsed by the pmap tool. Secondly, the determination of heap memory redundancy employs a two-dimensional determination mechanism. Heap memory data and effective heap memory data of abnormal processes are extracted from the graph. When the difference between the two is greater than 20MB, the process is determined to have heap memory redundancy. Optionally, the redundancy type can be further subdivided. If the redundant memory is a free memory block that the memory allocator has requested from the system in advance but has not yet been used by the business, it is determined to be free heap memory pre-allocated by the allocator. If the redundant memory is a memory block that the business code has released but the memory allocator has not reclaimed and is still temporarily stored in the allocator cache, it is determined to be cached heap memory that has been released but not returned to the system. This achieves precise and fine-grained localization of the root cause of heap memory redundancy. Thirdly, the determination of excessive allocator overhead involves extracting effective heap memory data and allocator overhead data of abnormal processes from the graph, calculating the ratio of extra-heap to useful-heap. When the ratio is greater than 10%, the allocator overhead is determined to be excessive. This 10% threshold is a reasonable threshold determined through long-term testing and verification, taking into account the lightweight desktop applications of domestic desktop operating systems and medium-frequency memory allocation scenarios. Fourth, the determination of large anonymous memory block redundancy involves extracting the size data of anonymous memory blocks of abnormal processes from the graph, filtering out memory blocks larger than 20MB, and using gdb to attach to the process and the strings command to parse the content characteristics of the memory block. If it is confirmed that the block is not effectively used by business logic, it is determined to be a large anonymous memory block redundancy. Fifth, the determination of stack memory anomalies involves extracting stack memory data of abnormal processes from the graph and comparing it with the baseline value of the process's stack memory in the baseline database. When the stack memory size exceeds twice the baseline value, it is determined to be a stack memory anomaly, and the specific code segment allocated by the abnormal stack memory is located using the valgrind tool. After tracing the root causes of all abnormal processes, the root causes of memory anomalies can be prioritized according to their impact on the stability of system memory operation. Ineffective sharing of dynamic libraries and redundant heap memory are classified as primary core root causes, excessive overhead of memory allocator is classified as secondary root causes, and minor stack memory anomalies are classified as minor root causes. Finally, a structured root cause localization result containing the PID of the abnormal process, root cause type, detailed root cause information and priority level is generated, providing a clear basis for subsequent customized optimization.

[0024] Step 140: Based on the root cause of the system memory anomaly, match the reference optimization strategy corresponding to the root cause of the anomaly, and optimize the abnormal process according to the reference optimization strategy.

[0025] After accurately locating the root cause of memory anomalies, if only the root cause analysis results are output without clear optimization guidance, developers will still need to spend a lot of effort exploring optimization paths on their own, making it difficult to efficiently translate diagnostic conclusions into actual memory optimization results. Therefore, it is necessary to automatically match and output corresponding non-intrusive reference optimization strategies for different types of located memory anomaly root causes, providing developers with clear and actionable code optimization directions, and achieving a complete closed loop from problem location to problem resolution.

[0026] For example, based on the system memory anomaly root causes generated in step 130, the system automatically extracts the memory anomaly root cause type corresponding to each abnormal process, matches it with a preset root cause strategy mapping relationship, and outputs a corresponding non-intrusive reference optimization strategy for developers to refer to and execute. Specifically, the matching and optimization logic is as follows: when the memory anomaly root cause type is ineffective sharing of dynamic libraries, the matched reference optimization strategy is to adjust the dynamic library loading path and linking method, and enable the system dynamic library sharing mechanism to reduce the process's exclusive use of dynamic libraries, avoid repeated loading, and reduce the process's USS memory usage. When the memory anomaly root cause type is heap memory redundancy, the matched reference optimization strategy is to filter the free heap memory pre-allocated by the allocator and the cached heap memory that has been released but not returned to the system, to safely release this redundant memory without affecting the normal operation of the process, so that the actual heap memory usage is closer to the effective heap memory. When the root cause of a memory anomaly is excessive allocator overhead, the recommended optimization strategy is to enable a memory pool management mechanism to uniformly manage the allocation and release of small memory blocks, and optimize the memory allocator management strategy to reduce memory fragmentation and the allocator's own metadata management overhead, thereby lowering the ratio of extra-heap to useful-heap to a reasonable level. When the root cause of a memory anomaly is redundant large anonymous memory blocks, the recommended optimization strategy is to release redundant anonymous memory blocks through code optimization based on the storage source of the memory blocks, thereby cleaning up redundant metadata, releasing idle UI component memory, clearing temporary data cache, and eliminating unused large anonymous memory blocks. When the root cause of a memory anomaly is stack memory anomaly, the recommended optimization strategy is to optimize the stack memory allocation logic and size settings based on the identified abnormal code segment, thereby controlling stack memory usage within a reasonable baseline range. Based on the above recommended optimization strategies and their professional understanding of the process code, developers can implement targeted code-level optimization adjustments to complete the memory optimization work for the abnormal process, thereby achieving system memory optimization.

[0027] This embodiment collects system-level memory data, process-level memory data, and fine-grained memory data separately. Using process PIDs as association identifiers, it matches and associates the system-level memory data, process-level memory data, and fine-grained memory data corresponding to the same process PID. A memory data map is constructed based on the matched memory data for each process. The system memory pressure level is determined based on the system-level memory data in the memory data map. A set of processes to be analyzed is then selected based on the system memory pressure level. The process-level memory data in the set of processes to be analyzed is compared with a preset threshold to mark abnormal processes and generate a list of abnormal process PIDs. For abnormal processes in the abnormal process PID list, the fine-grained anomaly judgment rules are invoked. Based on the fine-grained anomaly judgment rules and the memory data map, the root cause of the abnormal process is traced to determine the root cause of the system memory anomaly. Based on the root cause of the system memory anomaly, a reference optimization strategy corresponding to the root cause is matched, and the abnormal process is optimized according to the reference optimization strategy. By constructing a multi-dimensional memory data map and automating the tracing of the root cause of memory anomalies based on rule matching, accurate location and efficient optimization of memory problems are achieved.

[0028] Example 2 Figure 2 This is a flowchart of a multi-dimensional system memory optimization method provided in Embodiment 2 of the present invention. This embodiment is based on the above embodiment and is optimized. The step of matching the reference optimization strategy corresponding to the abnormal root cause of the system memory abnormality and optimizing the abnormal process according to the reference optimization strategy also includes: collecting optimized memory data, comparing the optimized memory data with the memory data of the same dimension before optimization and the benchmark value, calculating the change amount and change ratio of memory indicators, and generating an optimization effect verification report.

[0029] See Figure 2 The multi-dimensional system memory optimization method includes: Step 210: Collect system-level memory data, process-level memory data, and fine-grained memory data respectively. Using the process PID as the association identifier, match and associate the system-level memory data, process-level memory data, and fine-grained memory data corresponding to the same process PID. Construct a memory data map based on the memory data matched for each process.

[0030] Step 220: Determine the system memory pressure level based on the system-level memory data in the memory data map, filter the process set to be analyzed according to the system memory pressure level, compare the process-level memory data in the process set to be analyzed with a preset threshold, mark abnormal processes and generate an abnormal process PID list.

[0031] Step 230: For the abnormal processes in the abnormal process PID list, call the fine-grained anomaly judgment rule, and perform root cause tracing of the abnormal processes according to the fine-grained anomaly judgment rule and the memory data map to determine the root cause of system memory anomalies.

[0032] Step 240: Based on the root cause of the system memory anomaly, match the reference optimization strategy corresponding to the root cause of the anomaly, optimize the abnormal process according to the reference optimization strategy, collect the optimized memory data, compare the optimized memory data with the memory data of the same dimension before optimization and the benchmark value, calculate the change amount and change ratio of memory indicators, and generate an optimization effect verification report.

[0033] After the optimization operation is completed, in order to objectively verify the actual effect of the optimization measures, the system further collects the optimized memory data, quantitatively compares the optimized data with the memory data of the same dimension before optimization and the benchmark value, calculates the change amount and change ratio of various memory indicators, and automatically generates an optimization effect verification report, providing R&D personnel with an objective and quantitative basis for evaluating the optimization effect.

[0034] For example, targeted data collection is first performed, using the same memory collection tools, frequency, and range as before optimization. Memory data is collected only from the target process specified in the instructions, excluding other unrelated processes to reduce system resource consumption. After collection, a preset standardized parsing algorithm is called to perform line-by-line segmentation, keyword matching, numerical extraction, unit standardization, and outlier cleaning on the raw unstructured text data output by each tool, uniformly converting it into structured data in key-value pair format, generating optimized targeted verification structured data. Subsequently, a dimensional quantitative comparison is performed, using the process PID as the unique identifier. The memory data and process characteristic baseline data corresponding to the target process before optimization are retrieved from the memory data map. A dedicated data comparison algorithm is used to perform dimensional quantitative calculations on the data before and after optimization, including calculating the real-time reduction and percentage of process-level core indicators USS, PSS, and RSS. For the previously identified root causes of memory anomalies, corresponding fine-grained indicators are automatically matched, and the changes and percentages of these indicators are calculated. Simultaneously, each dimensional indicator after optimization is compared with the process characteristic baseline data to determine whether the optimized indicators have returned to the reasonable range of the baseline. Finally, all comparison data are integrated to generate standardized quantitative comparison results. Finally, a verification report is generated and exported. Based on the quantitative comparison results, a report generation algorithm is called to automatically integrate verification configuration information, a comparison table of indicators before and after optimization, root cause optimization achievement status, and baseline matching results to form a lightweight targeted optimization effect verification report. A formatting algorithm is used to standardize the report format, and an application-level viewing and export interface is enabled. Developers can directly view the report details or export it with one click through the application layer, providing accurate data support for subsequent continuous optimization iterations.

[0035] This embodiment collects system-level memory data, process-level memory data, and fine-grained memory data separately. Using process PIDs as association identifiers, it matches and associates the system-level memory data, process-level memory data, and fine-grained memory data corresponding to the same process PID. Based on the memory data of each process, a memory data map is constructed. The system memory pressure level is determined based on the system-level memory data in the memory data map. A set of processes to be analyzed is selected according to the system memory pressure level. The process-level memory data of the processes to be analyzed is compared with a preset threshold to mark abnormal processes and generate an abnormal process PID list. For the abnormal processes in the abnormal process PID list, the fine-grained anomaly judgment rule is invoked. Based on the fine-grained anomaly judgment rule and the memory data map, the root cause of the abnormal process is traced to determine the root cause of the system memory anomaly. Based on the root cause of the system memory anomaly, a reference optimization strategy corresponding to the root cause is matched. The abnormal process is optimized according to the reference optimization strategy. The optimized memory data is collected and compared with the memory data of the same dimension before optimization and the baseline value. The change in memory indicators and the percentage change are calculated, and an optimization effect verification report is generated. Using the above methods, we can achieve automated quantitative comparison and baseline regression verification of memory data before and after optimization, evaluate the actual effect of optimization measures, and provide R&D personnel with data-driven optimization decision-making basis and iteration direction.

[0036] Example 3 Figure 3 This is a schematic diagram of the structure of the multi-dimensional system memory optimization device provided in Embodiment 3 of the present invention, as shown below. Figure 3 As shown, the device includes: The acquisition module 310 is used to acquire system-level memory data, process-level memory data and fine-grained memory data respectively. Using the process PID as the association identifier, the system-level memory data, process-level memory data and fine-grained memory data corresponding to the same process PID are matched and associated. Based on the memory data matched by each process, a memory data map is constructed. The comparison module 320 is used to determine the system memory pressure level based on the system-level memory data in the memory data map, filter the process set to be analyzed according to the system memory pressure level, compare the process-level memory data in the process set to be analyzed with a preset threshold, mark abnormal processes and generate an abnormal process PID list. The source tracing module 330 is used to call the fine-grained anomaly judgment rule for the abnormal process in the abnormal process PID list, and perform root cause tracing of the abnormal process according to the fine-grained anomaly judgment rule and the memory data map to determine the root cause of the system memory anomaly. The optimization module 340 is used to match the reference optimization strategy corresponding to the root cause of the system memory anomaly based on the root cause of the anomaly, and optimize the abnormal process according to the reference optimization strategy.

[0037] This embodiment provides a multi-dimensional system memory optimization device that collects system-level memory data, process-level memory data, and fine-grained memory data separately. Using process PIDs as association identifiers, it matches and associates the system-level memory data, process-level memory data, and fine-grained memory data corresponding to the same process PID. A memory data map is constructed based on the matched memory data for each process. The system memory pressure level is determined based on the system-level memory data in the memory data map. A set of processes to be analyzed is selected based on the system memory pressure level. The process-level memory data in the set of processes to be analyzed is compared with a preset threshold to mark abnormal processes and generate a list of abnormal process PIDs. For abnormal processes in the abnormal process PID list, the fine-grained anomaly judgment rules are invoked. Based on the fine-grained anomaly judgment rules and the memory data map, the root cause of the abnormal process is traced to determine the root cause of the system memory anomaly. Based on the root cause of the system memory anomaly, a reference optimization strategy corresponding to the root cause is matched, and the abnormal process is optimized according to the reference optimization strategy. By constructing a multi-dimensional memory data map and automatically tracing the root cause of memory anomalies based on rule matching, accurate location and efficient optimization of memory problems are achieved.

[0038] Based on the above embodiments, the acquisition module includes: The system-level memory data acquisition unit is used to collect system-level memory data by reading the meminfo virtual file of the Linux system. The system-level memory data includes total physical memory data, available memory data, swap space usage data, buffer data, and page cache data. The process-level memory data acquisition unit is used to read the smaps virtual file corresponding to the Linux system process through the smem tool and collect process-level memory data, including exclusive memory data, proportional set memory data and resident memory data. The fine-grained memory data acquisition unit is used to collect fine-grained memory data by reading the smaps virtual file corresponding to the process, calling memory mapping analysis tools and heap memory detection tools. The fine-grained memory data includes heap memory data, stack memory data, dynamic library mapping information data, effective heap memory data, allocator overhead data, anonymous memory block size data, and page cache usage data. The matching and association unit is used to perform data processing and format conversion on the system-level memory data, process-level memory data and fine-grained memory data, and then match and associate the system-level memory data, process-level memory data and fine-grained memory data corresponding to the same process PID using the process PID as the association identifier.

[0039] Based on the above embodiments, the comparison module includes: The data extraction unit is used to extract the swap space usage data, total physical memory data, and available memory data corresponding to the system-level memory data in the memory data map. The stress level determination unit is used to calculate the used memory data based on the total physical memory data and available memory data, calculate the used memory percentage based on the used memory data and total physical memory data, and determine the memory stress level based on the swap space usage data and the used memory percentage. The system is under no pressure unit, which determines that the system is under no pressure when the usage data of the swap area is 0 and the percentage of used memory is less than 20%. The system under mild stress unit is used to determine that the system is under mild stress when the usage data of the swap area is 0 and the percentage of used memory is greater than 20% and less than 50%. The system under heavy pressure determination unit is used to determine that the system is under heavy pressure when the usage data of the swap area is greater than 0 or the percentage of used memory is less than or equal to 50%. The first process set determination unit is used to extract exclusive memory data and resident memory data from the memory data map when the system memory pressure level is no pressure, and select processes whose exclusive memory data exceeds 1.2 times the benchmark value or whose resident memory data exceeds 1.2 times the benchmark value or whose exclusive memory data ranks in the top 10% or whose resident memory data ranks in the top 10% in the system as the process set to be analyzed. The second process set determination unit is used to extract exclusive memory data and resident memory data from the memory data map when the system memory pressure level is light pressure, and select the processes whose exclusive memory data exceeds the benchmark value or whose resident memory data exceeds the benchmark value or whose exclusive memory data ranks in the top 20% or whose resident memory data ranks in the top 20% of the system as the process set to be analyzed. The third process set determination unit is used to select all user-mode processes, excluding kernel threads, as the process set to be analyzed when the system memory pressure level is severe. The process set extraction unit is used to extract the exclusive memory data, proportional set memory data and resident memory data corresponding to each process in the process set to be analyzed from the memory data map. An abnormal process marking unit is used to mark a process as an abnormal process when any one of the exclusive memory data, proportional set memory data, and resident memory data exceeds a corresponding preset threshold. The abnormal process PID list generation unit is used to generate an abnormal process PID list based on all processes marked as abnormal processes.

[0040] Based on the above embodiments, the traceability module includes: The dynamic library not effectively shared determination unit is used to extract the exclusive memory data and proportional set memory data of the abnormal process in the memory data map. According to the fine-grained abnormal determination rule, when the ratio of the exclusive memory data and the proportional set memory data is greater than 50% and the abnormal process is a general desktop process, the root cause of the system memory abnormality is determined to be the dynamic library not effectively shared. The heap memory redundancy determination unit is used to extract the heap memory data and effective heap memory data of the abnormal process in the memory data map. According to the fine-grained anomaly determination rule, when the difference between the heap memory data and the effective heap memory data is greater than 20MB, the root cause of the system memory anomaly is determined to be heap memory redundancy. The allocator overhead excessive determination unit is used to extract the effective heap memory data and allocator overhead data of the abnormal process in the memory data map. According to the fine-grained anomaly determination rule, when the ratio of the effective heap memory data and the allocator overhead data is greater than 10%, the root cause of the system memory anomaly is determined to be excessive allocator overhead. The large anonymous memory block redundancy determination unit is used to extract the size data of the anonymous memory blocks of abnormal processes in the memory data map, extract memory blocks with more than 20MB of memory in the anonymous memory block size data according to the fine-grained anomaly determination rules, parse the content characteristics of the memory blocks, and determine the root cause of system memory anomalies as large anonymous memory block redundancy when the memory blocks are not used. The stack memory anomaly determination unit is used to extract the stack memory data of the abnormal process from the memory data map, and to determine the root cause of the system memory anomaly as a stack memory anomaly when the stack memory data is greater than twice the benchmark value, according to the fine-grained anomaly determination rule.

[0041] Based on the above embodiments, the optimization module includes: The Dynamic Library Not Effectively Shared Optimization Module is used to match the optimization strategy when the root cause of the memory exception is Dynamic Library Not Effectively Shared. This strategy is to adjust the loading path and linking method of the dynamic library and enable the system dynamic library sharing mechanism to reduce the exclusive use of dynamic libraries by processes and avoid repeated loading. The heap memory redundancy optimization module, when the root cause of the memory anomaly is heap memory redundancy, uses the reference optimization strategy to filter the free heap memory pre-allocated by the allocator and the cached heap memory that has been released but not returned to the system, in order to safely release this part of redundant memory without affecting the process operation. The allocator overhead optimization module is used to match the optimization strategy to enable the memory pool management mechanism when the memory anomaly root cause type is allocator overhead, so as to uniformly manage the allocation and release of small blocks of memory and optimize the memory allocator management strategy to reduce memory fragmentation and allocator management overhead. The large anonymous memory block redundancy optimization module is used to match the optimization strategy to release redundant anonymous memory blocks through code optimization based on the storage source of the memory blocks when the root cause of the memory anomaly is large anonymous memory block redundancy. This is used to clean up redundant metadata, release idle UI component memory, and clean up temporary data cache. The stack memory exception optimization module is used to match the optimization strategy when the root cause of the memory exception is a stack memory exception. The optimization strategy is matched to optimize the stack memory allocation logic and size settings according to the located exception code segment, so as to control the stack memory usage within a reasonable baseline range.

[0042] The system memory optimization device based on multi-dimensionality provided in the embodiments of the present invention can execute the system memory optimization method based on multi-dimensionality provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0043] Example 4 Figure 4 This is a schematic diagram of the structure of a terminal provided in Embodiment 4 of the present invention. Figure 4 A block diagram is shown that is suitable for implementing an exemplary terminal 12 of the present invention. Figure 4 The terminal 12 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0044] like Figure 4 As shown, terminal 12 is presented in the form of a general-purpose computing terminal. The components of terminal 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).

[0045] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.

[0046] Terminal 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by terminal 12, including volatile and non-volatile media, removable and non-removable media.

[0047] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache 32. Terminal 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (… Figure 4 Not shown; usually referred to as a "hard drive"). Although Figure 4 As not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.

[0048] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.

[0049] Terminal 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing terminal, display 24, etc.), and with one or more terminals that enable a user to interact with terminal 12, and / or with any terminal (e.g., network card, modem, etc.) that enables terminal 12 to communicate with one or more other computing terminals. This communication can be performed via input / output (I / O) interface 22. Furthermore, terminal 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of terminal 12 via bus 18. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with terminal 12, including but not limited to: microcode, terminal drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0050] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the multi-dimensional system memory optimization method provided in the embodiments of the present invention.

[0051] Example 5 Embodiment 5 of the present invention also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform any of the multi-dimensional system memory optimization methods provided in the above embodiments.

[0052] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0053] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0054] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0055] Computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or terminal. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0056] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.< / pid> < / pid>

Claims

1. A multi-dimensional based system memory optimization method, comprising: include: System-level memory data, process-level memory data, and fine-grained memory data are collected separately. Using the process PID as the association identifier, the system-level memory data, process-level memory data, and fine-grained memory data corresponding to the same process PID are matched and associated. A memory data map is constructed based on the memory data matched for each process. The system memory pressure level is determined based on the system-level memory data in the memory data map. The process set to be analyzed is filtered according to the system memory pressure level. The process-level memory data in the process set to be analyzed is compared with a preset threshold, abnormal processes are marked, and an abnormal process PID list is generated. For the abnormal processes in the abnormal process PID list, the fine-grained anomaly judgment rule is invoked. Based on the fine-grained anomaly judgment rule and the memory data map, the root cause of the abnormal process is traced to determine the root cause of the system memory anomaly. Based on the root cause of the system memory anomaly, a reference optimization strategy corresponding to the root cause is matched, and the abnormal process is optimized according to the reference optimization strategy.

2. The method of claim 1, wherein, The process involves collecting system-level memory data, process-level memory data, and fine-grained memory data respectively, and using the process PID as the association identifier to match and associate the system-level memory data, process-level memory data, and fine-grained memory data corresponding to the same process PID. This includes: System-level memory data is collected by reading the meminfo virtual file of the Linux system. The system-level memory data includes total physical memory data, available memory data, swap space usage data, buffer data, and page cache data. The smem tool is used to read the smaps virtual file corresponding to the Linux system process to collect process-level memory data, which includes exclusive memory data, proportional set memory data and resident memory data. Fine-grained memory data is collected by reading the smaps virtual file corresponding to the process, calling memory mapping analysis tools and heap memory detection tools. The fine-grained memory data includes heap memory data, stack memory data, dynamic library mapping information data, effective heap memory data, allocator overhead data, anonymous memory block size data, and page cache usage data. After processing and format conversion of the system-level memory data, process-level memory data, and fine-grained memory data, the system-level memory data, process-level memory data, and fine-grained memory data corresponding to the same process PID are matched and associated using the process PID as the association identifier.

3. The method of claim 2, wherein, The determination of system memory pressure level based on system-level memory data in the memory data map includes: Extract the swap space usage data, total physical memory data, and available memory data corresponding to the system-level memory data in the memory data map; The used memory data is calculated based on the total physical memory data and available memory data. The percentage of used memory is calculated based on the used memory data and total physical memory data. The memory pressure level is determined based on the swap space usage data and the percentage of used memory. When the usage data of the swap area is 0 and the percentage of used memory is less than 20%, the system is determined to be under no pressure. When the usage data of the swap area is 0, and the percentage of used memory is greater than 20% and less than 50%, the system is judged to be under mild pressure. When the usage data of the swap area is greater than 0 or the percentage of used memory is less than or equal to 50%, the system is considered to be under heavy pressure.

4. The method of claim 3, wherein, The step of filtering the process set to be analyzed based on the system memory pressure level, comparing the process-level memory data in the process set to be analyzed with a preset threshold, marking abnormal processes, and generating a list of abnormal process PIDs includes: When the system memory pressure level is no pressure, extract the exclusive memory data and resident memory data from the memory data map, and select the processes whose exclusive memory data exceeds the baseline value by 1.2 times, or whose resident memory data exceeds the baseline value by 1.2 times, or whose exclusive memory data ranks in the top 10% of the system, or whose resident memory data ranks in the top 10% of the system as the process set to be analyzed. When the system memory pressure level is mild, extract the exclusive memory data and resident memory data from the memory data map, and select the processes whose exclusive memory data exceeds the benchmark value, or whose resident memory data exceeds the benchmark value, or whose exclusive memory data ranks in the top 20% of the system, or whose resident memory data ranks in the top 20% of the system as the process set to be analyzed. When the system memory pressure level is severe, all user-mode processes, excluding kernel threads, are selected as the process set to be analyzed. Extract the exclusive memory data, proportional set memory data, and resident memory data corresponding to each process in the process set to be analyzed from the memory data map; For each process, if any one of the exclusive memory data, proportional set memory data, and resident memory data exceeds the corresponding preset threshold, the process is marked as an abnormal process. Generate a list of process IDs (PIDs) for all processes marked as abnormal.

5. The method of claim 4, wherein, Based on the fine-grained anomaly detection rules and the memory data map, the root cause of the abnormal process is traced to determine the root cause of the system memory anomaly, including: Extract the exclusive memory data and proportional set memory data of the abnormal process from the memory data map. According to the fine-grained anomaly judgment rule, when the ratio of the exclusive memory data and the proportional set memory data is greater than 50% and the abnormal process is a general desktop process, the root cause of the system memory anomaly is determined to be that the dynamic library is not effectively shared. Extract the heap memory data and effective heap memory data of the abnormal process from the memory data map. According to the fine-grained anomaly judgment rule, when the difference between the heap memory data and the effective heap memory data is greater than 20MB, the root cause of the system memory anomaly is determined to be heap memory redundancy. Extract the effective heap memory data and allocator overhead data of the abnormal process from the memory data map. According to the fine-grained anomaly judgment rule, when the ratio of the effective heap memory data to the allocator overhead data is greater than 10%, the root cause of the system memory anomaly is determined to be excessive allocator overhead. Extract the anonymous memory block size data of the abnormal process from the memory data map. According to the fine-grained anomaly judgment rule, extract memory blocks with more than 20MB of memory from the anonymous memory block size data. Analyze the content characteristics of the memory blocks. When the memory blocks are not used, determine the root cause of the system memory anomaly as large anonymous memory block redundancy. Extract the stack memory data of the abnormal process from the memory data map. According to the fine-grained anomaly determination rule, when the stack memory data is greater than twice the benchmark value, the root cause of the system memory anomaly is determined to be a stack memory anomaly.

6. The method of claim 5, wherein, The step of matching the reference optimization strategy corresponding to the root cause of the system memory anomaly includes: When the root cause of the memory exception is that the dynamic library is not effectively shared, the reference optimization strategy is to adjust the dynamic library loading path and linking method, and enable the system dynamic library sharing mechanism to reduce the process's exclusive use of dynamic libraries and avoid repeated loading. When the root cause of the memory anomaly is heap memory redundancy, the reference optimization strategy is matched to filter the free heap memory pre-allocated by the allocator and the cached heap memory that has been released but not returned to the system, so as to safely release this part of redundant memory without affecting the process operation. When the root cause of the memory anomaly is excessive allocator overhead, the reference optimization strategy is to enable the memory pool management mechanism to uniformly manage the allocation and release of small blocks of memory and optimize the memory allocator management strategy to reduce memory fragmentation and allocator management overhead. When the root cause of the memory anomaly is large anonymous memory block redundancy, the reference optimization strategy is matched to release the redundant anonymous memory block through code optimization based on the memory block storage source, which is used to clean up redundant metadata, release idle UI component memory and clean up temporary data cache. When the root cause of the memory exception is a stack memory exception, the reference optimization strategy is matched to optimize the stack memory allocation logic and size settings according to the located exception code segment, so as to control the stack memory usage within a reasonable baseline range.

7. The method of claim 6, wherein, The step of matching the reference optimization strategy corresponding to the system memory anomaly root cause, and optimizing the abnormal process according to the reference optimization strategy, further includes: Collect optimized memory data, compare the optimized memory data with the memory data of the same dimension before optimization and the benchmark value, calculate the change in memory indicators and the change ratio, and generate an optimization effect verification report.

8. A multi-dimensional based system memory optimization apparatus, comprising: include: The acquisition module is used to collect system-level memory data, process-level memory data, and fine-grained memory data respectively. Using the process PID as the association identifier, it matches and associates the system-level memory data, process-level memory data, and fine-grained memory data corresponding to the same process PID, and constructs a memory data map based on the memory data matched for each process. The comparison module is used to determine the system memory pressure level based on the system-level memory data in the memory data map, filter the process set to be analyzed according to the system memory pressure level, compare the process-level memory data in the process set to be analyzed with a preset threshold, mark abnormal processes and generate an abnormal process PID list. The source tracing module is used to call the fine-grained anomaly judgment rules for the abnormal processes in the abnormal process PID list, and perform root cause tracing of the abnormal processes according to the fine-grained anomaly judgment rules and the memory data map to determine the root cause of system memory anomalies. An optimization module is used to match a reference optimization strategy corresponding to the root cause of the system memory anomaly, and optimize the abnormal process according to the reference optimization strategy.

9. A terminal, characterized in that, The terminal includes: One or more processors; Storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the multi-dimensional system memory optimization method as described in any one of claims 1-7.

10. A storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the multi-dimensional system memory optimization method as described in any one of claims 1-7.