Visual analysis method for use condition of process memory
By using a visualization analysis method for process memory usage, this approach addresses the issues of existing tools being complex to operate, lacking intuitive display, and insufficient real-time performance. It provides an intuitive graphical interface and interactive functions, enabling rapid location of memory anomalies and optimization of memory usage, thereby improving program performance and stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU ARTECH
- Filing Date
- 2026-04-03
- Publication Date
- 2026-05-12
AI Technical Summary
Existing memory monitoring and analysis tools are complex to operate, have unintuitive data display, lack real-time performance, and are not targeted enough to meet the memory analysis needs of specific platform programs.
This paper provides a method for visual analysis of process memory usage. It collects memory usage data in real time, displays memory trends and anomalies in an intuitive graphical interface, and uses a memory object relationship graph for anomaly detection. It supports user interaction and custom settings, and generates accurate analysis reports and optimization suggestions.
It provides simple, intuitive, and real-time memory analysis, enabling rapid identification of memory anomalies, improving program performance and stability, and is suitable for platform programs that run stably for extended periods.
Smart Images

Figure CN122019313A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer memory management technology, specifically relating to a method for visual analysis of process memory usage. Background Technology
[0002] As software systems become increasingly feature-rich and their architectures more complex, memory management has become one of the core challenges in software development and maintenance. Problems such as memory leaks and invalid memory usage not only lead to decreased program efficiency and slower response times, but can also cause system crashes in severe cases. This is especially true for platform programs like the core programs of video surveillance platforms, which require long-term stable operation; the rationality of memory usage directly affects the continuity and reliability of services. Therefore, developing analytical tools that can intuitively and accurately present program memory usage is of significant practical importance.
[0003] Currently, various memory monitoring and analysis tools are available on the market, with Valgrind and VisualVM being typical examples. These tools can collect and output detailed data on program memory usage, providing some support for troubleshooting memory problems. However, they still have significant limitations in practical applications: Firstly, the operation process is complex and requires professional developers with a strong technical background to use it proficiently; non-professionals will find it difficult to get started quickly. Secondly, the data presentation format is not intuitive enough, mostly presented in plain text or complex reports, which cannot help users quickly capture memory change trends and key anomalies; Third, it lacks real-time performance, making it difficult to dynamically track changes in the target program's memory. Fourth, it lacks specificity. Its general design makes it difficult to focus on the memory characteristics of programs on specific platforms, and it cannot accurately meet the memory analysis needs in specific scenarios.
[0004] The aforementioned shortcomings make it difficult for existing tools to efficiently assist developers in quickly locating memory problems and optimizing program performance. Therefore, there is an urgent need for a memory visualization and analysis solution that better meets the needs of practical applications. Summary of the Invention
[0005] The purpose of this invention is to provide a method for visually analyzing process memory usage, aiming to overcome the shortcomings of existing memory monitoring and analysis tools, such as complex operation, unintuitive data display, insufficient real-time performance, and lack of specificity. By collecting memory usage data from platform programs in real time, it displays memory usage trends, memory allocation, and potential memory leaks in an intuitive and easy-to-understand graphical interface, helping developers quickly locate memory anomalies. Simultaneously, it enables real-time tracking of dynamic changes in the target program's memory, enhancing the tool's real-time responsiveness. Furthermore, it provides accurate analysis results and optimization suggestions tailored to the memory characteristics of specific platform programs, meeting the personalized memory analysis needs of different application scenarios. Through flexible user interaction functions, it supports developers in customizing settings and performing targeted optimizations based on memory usage data, ultimately improving program performance and stability.
[0006] To achieve the above objectives, this invention provides a method for visually analyzing process memory usage, comprising the following steps: (1) The user starts the memory analysis tool, which initiates a connection request with the target platform program; (2) Execute branch processing based on connection results: If the connection fails, the memory analysis tool performs error processing and terminates its operation; if the connection is successful, the memory analysis tool enters the timed loop data acquisition process; (3) The memory analysis tool collects memory usage data of the target platform program at preset time intervals. The memory usage data includes memory allocation information, memory release information and current memory usage. (4) Preprocess the collected memory usage data, and parse the data structure and construct a memory object relationship graph; (5) Based on the memory object relationship diagram and the preprocessed memory data, perform memory anomaly detection and mark memory leak points; (6) Visualize and render the processed memory data, memory object relationship diagram and memory leak marking results using a visualization engine to generate visualized data; (7) Enter the user interaction session loop and update the visualization view in response to user operations; (8) Respond to user commands to export memory analysis reports and generate program optimization suggestions based on memory usage data and memory leak marking results.
[0007] Furthermore, the error handling in step (2) is to output error message information to the memory analysis tool; after the connection is successful, the memory analysis tool receives the connection success signal and then enters the timed loop data acquisition process.
[0008] Furthermore, the collection of memory usage data in step (3) is achieved by hooking system calls or reading the / proc file system.
[0009] Furthermore, the preprocessing in step (4) includes data cleaning and format conversion; the parsing of the data structure is to parse the storage format and association logic of the memory usage data; and the construction of the memory object relationship graph is to construct a hierarchical association graph based on the memory allocation address and reference relationship.
[0010] Furthermore, the logic for memory anomaly detection in step (5) is as follows: compare memory allocation records and release records in multiple consecutive collection cycles. If there is a memory block that only has allocation records, no release records, and no valid associated references, it is determined to be a memory anomaly. The memory block is marked as a memory leak point and its allocation information is recorded.
[0011] Furthermore, in step (6), Qt graphical interface technology is used to perform visualization rendering; the visualization data includes memory usage heatmap, memory change timeline, memory object dependency tree, memory usage trend graph and memory allocation stack graph.
[0012] Furthermore, the user operations in step (7) include zooming and filtering operations; the user interaction session loop also includes: supporting users to set memory usage thresholds, and when the memory usage of the target platform program exceeds the threshold, the memory analysis tool triggers an alarm; supporting users to select memory leak points in the visualization view, and the memory analysis tool returns in-depth analysis data corresponding to the leak point.
[0013] Furthermore, the memory analysis report in step (8) includes all the visualization charts, memory usage statistics and memory leak details marked in step (6) and step (5); the program optimization suggestions correspond one-to-one with the memory leak details, including leak repair directions and memory usage optimization strategies.
[0014] The present invention, by adopting the above technical solution, has at least the following beneficial effects: This invention provides an intuitive and easy-to-use memory visualization and analysis solution. It visually displays memory usage trends, allocation status, and potential leakage problems through a graphical interface. No professional technical background is required to get started quickly. It completely solves the shortcomings of existing tools that are complicated to operate and difficult for non-professionals to use, and effectively improves memory analysis efficiency.
[0015] By using a timed, cyclical data collection mechanism to capture memory data (allocation, release, and occupation) of the target platform program in real time and dynamically track memory changes, it can respond to memory anomalies in a timely manner. Compared with the lack of real-time performance of traditional tools, it can help developers quickly locate and fix memory problems, ensuring the service continuity of programs that run stably for a long time.
[0016] Anomaly detection logic is built based on memory object relationship graphs and preprocessed memory data. It can accurately mark memory leak points and provide complete allocation information, effectively avoiding program performance degradation or system crashes caused by memory leaks, and significantly improving the stability and reliability of program operation.
[0017] Leveraging Qt graphical interface technology, abstract memory data is transformed into various graphical forms such as memory heatmaps, change timelines, and dependency trees, replacing the plain text or complex report displays of traditional tools. This makes memory change trends and object relationships clear at a glance, significantly reducing the difficulty of data analysis.
[0018] It supports user-defined memory thresholds (triggers alarms when thresholds are exceeded), zooming and filtering of visualization views, and in-depth analysis of selected leak points. Developers can flexibly adjust these features according to actual needs to further improve the accuracy and adaptability of memory analysis and expand the application scenarios of the tool.
[0019] It can not only export analysis reports containing complete memory data and anomaly details, but also generate targeted optimization suggestions by combining leak point markers, providing developers with specific repair directions and memory management strategies, directly assisting in optimizing program code, and improving the rationality of memory usage and running efficiency.
[0020] By performing preprocessing operations such as data cleaning and format conversion, invalid and redundant data are removed and the data format is standardized, providing high-quality data support for subsequent anomaly detection and visualization, and further ensuring the accuracy and reliability of memory analysis results.
[0021] Through the above technical solution, the present invention provides a simple, intuitive and efficient memory analysis method, which has strong practicality and broad application prospects, and is particularly suitable for platform programs that require long-term stable operation, such as video surveillance systems and embedded devices. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart of the process memory usage visualization analysis method of the present invention; Figure 2 This is a timing diagram of the process memory visualization tool system of the present invention. Detailed Implementation
[0024] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the invention as detailed in the appended claims.
[0025] like Figure 1 As shown, this embodiment provides a method for visually analyzing process memory usage, including the following steps: (1) The user starts the memory analysis tool, which initiates a connection request with the target platform program; (2) Execute branch processing based on connection results: If the connection fails, the memory analysis tool performs error processing and terminates its operation; if the connection is successful, the memory analysis tool enters the timed loop data acquisition process; (3) The memory analysis tool collects memory usage data of the target platform program at preset time intervals. The memory usage data includes memory allocation information, memory release information and current memory usage. (4) Preprocess the collected memory usage data, and parse the data structure and construct a memory object relationship graph; (5) Based on the memory object relationship diagram and the preprocessed memory data, perform memory anomaly detection and mark memory leak points; (6) Visualize and render the processed memory data, memory object relationship diagram and memory leak marking results using a visualization engine to generate visualized data; (7) Enter the user interaction session loop and update the visualization view in response to user operations; (8) Respond to user commands to export memory analysis reports and generate program optimization suggestions based on memory usage data and memory leak marking results.
[0026] As one implementation method, in this embodiment, the error handling in step (2) is that the memory analysis tool outputs a precise error message indicating that the target process connection failed and asks the user to check the process status, running permissions, and process ID for accuracy. After the connection is successful, the memory analysis tool receives a success response signal containing basic information such as the process name and running path, and then enters the timed loop data acquisition process. The error message directly points to the core fault point, allowing for quick troubleshooting without professional skills, thus solving the problem of ambiguous error reporting in existing tools. The success response signal performs a secondary verification of the connection validity through the basic process information, avoiding data acquisition deviations caused by mistakenly connecting to other processes, and enhancing the specificity of analysis for programs on specific platforms.
[0027] As one implementation method, in this embodiment, the collection of memory usage data in step (3) is achieved by hooking core system calls such as malloc, free, and realloc, or by reading fields from the / proc / [target process ID] / statm (memory usage statistics) and / proc / [target process ID] / maps (memory distribution) files. The preset time interval is 1-10 seconds and can be customized. The collected memory data specifically includes memory allocation address, allocation size, allocation time, release time, total usage, and module information. The dual collection methods complement each other. System calls capture real-time operation details, and the / proc file obtains the global memory status, ensuring comprehensive data coverage. The customizable time interval adapts to the memory change frequency of different programs (1 second for high-frequency operation programs and 10 seconds for stable programs), solving the defects of existing tools with fixed collection cycles and insufficient real-time performance.
[0028] As one implementation method, the preprocessing in step (4) of this embodiment includes data cleaning operations such as removing outliers exceeding the total system memory range, deleting redundant data collected repeatedly, and correcting data with format errors, as well as format conversion operations such as converting binary data and text data into a JSON structured format that can be parsed by the Qt interface; the parsed data structure is to parse the storage format and association logic of memory data, and the construction of the memory object relationship diagram is to display the calling dependency relationship of parent-child memory objects in a hierarchical manner according to the allocation time sequence and reference link. Data cleaning thoroughly eliminates interference from dirty data and ensures accurate analysis results; the unified format reduces the parsing difficulty of visualization rendering and improves the interface response speed; the hierarchical relationship diagram intuitively presents the association logic of memory objects, providing a clear analytical basis for subsequent anomaly detection and solving the problems of rough data processing and ambiguous association logic in existing tools.
[0029] As one implementation method, the logic of memory anomaly detection in step (5) of this embodiment is as follows: compare memory allocation records and release records within 3-10 configurable continuous collection cycles. If there is a memory block with only allocation records, no release records, and no valid associated references, it is determined to be a memory anomaly. The memory block is marked as a memory leak point, and core information such as allocation address, allocation function, code module, line number, and memory size are recorded. The configurable collection cycle adapts to the memory lifecycle of different programs (3 cycles for short-term tasks and 10 cycles for long-term services), avoiding misjudgment or missed judgment. Detailed leak point information helps developers directly locate code locations, skip complex investigation processes, and solve the defects of existing tools in anomaly detection that are vague and unable to accurately trace the source.
[0030] As one implementation method, in this embodiment, step (6) uses Qt graphical interface technology, which supports cross-platform compatibility and real-time rendering, to perform visualization rendering. The visualization data includes: ① memory usage heatmap (distinguishing address segment occupancy density by red-yellow-green color gradient), ② memory change timeline (marking the time nodes corresponding to leak points), ③ memory object dependency tree diagram (red nodes highlight leak points), ④ memory usage trend diagram (statistically analyzing long-term patterns by hour / day / week), and ⑤ memory allocation stack diagram (reconstructing function call chains). Qt technology ensures that the tool is compatible with mainstream systems such as Windows / Linux, and real-time rendering ensures interface smoothness. Multi-dimensional charts present memory status from different angles, replacing the traditional plain text / complex report format, allowing non-professionals to quickly capture key information and solving the problem of unintuitive display in existing tools.
[0031] As one implementation method, the user operations in step (7) of this embodiment include zooming operations such as mouse wheel zooming and area selection zooming, as well as filtering operations by module name, memory size range, and time interval; the user interaction session loop also includes: supporting users to set custom thresholds for physical memory / virtual memory, and when the memory usage of the target platform program exceeds the threshold, the memory analysis tool triggers multi-dimensional alarms such as pop-up prompts, sound alarms, and automatic log recording; supporting users to select memory leak points in the visualization view, and the memory analysis tool returns in-depth analysis data such as the memory growth curve, related object list, and call stack details corresponding to the leak point. Zooming / filtering operations help users focus on key data and improve analysis efficiency; custom threshold alarms adapt to the memory limit requirements of different programs, and multi-dimensional prompts ensure that no anomalies are missed; in-depth data analysis provides comprehensive support for the investigation of the root cause of leaks, solving the problem that the existing tools have weak interactive functions and cannot meet personalized needs.
[0032] As one implementation method, the memory analysis report in step (8) of this embodiment includes all the visualization charts (including high-definition screenshots) mentioned in step (6), statistical data such as peak / average / fluctuation range of memory usage, memory usage ratio of each module, and details of memory leak points marked in step (5); the program optimization suggestions correspond one-to-one with the details of memory leak points, including specific repair directions (such as "if memory is not released after function execution, it is recommended to add a free() call"), memory management optimization strategies (such as "if frequent small memory allocation is recommended to use a memory pool"), and resource scheduling optimization suggestions (such as "if non-core modules are recommended to be loaded and released asynchronously").
[0033] like Figure 2 As shown, this embodiment, in conjunction with the timing diagram of the process memory visualization tool system, and taking the core business program of the video surveillance platform as the target platform program, provides a detailed explanation of the implementation process of the present invention. Figure 2The interaction logic, function calls, and process branches between the user, memory analysis tool, target process, and visualization engine are all mapped one-to-one in the following steps: Application Scenarios and Preliminary Preparations: The target platform program in this embodiment is the core business program of a video surveillance platform. This program needs to run continuously 24 / 7, and its memory usage directly affects the stability of monitoring data acquisition, storage, and display. This is highly compatible with the technical objective of this invention, "Memory Analysis for Specific Platform Programs".
[0034] like Figure 2 As shown, a memory analysis tool developed based on Qt is deployed, ensuring that the tool and the target platform program run on the same Linux operating system environment; at the same time, the tool's permissions are configured to give it the necessary privileges. Figure 2 The system call hook permissions and / proc file system read permissions required for the "memory data acquisition" stage; preset Figure 2 The data acquisition time interval N=5 seconds in the “loop[every N seconds]” process is to balance real-time performance and system resource consumption.
[0035] Tool startup and connection to the target process: such as Figure 2 As shown in the initial flow on the left, after the user starts the memory analysis tool, the tool will press... Figure 2 The timing logic automatically executes the connect() function to initiate a communication connection request to the target platform program (the core business program of the video surveillance platform). The request carries the unique identifier (process ID) of the target process.
[0036] Figure 2 The code explicitly sets up a two-branch processing logic for the "connection result": if the connection fails due to the target platform program not starting, insufficient tool permissions, or an incorrect process ID, the memory analysis tool will trigger... Figure 2 The "error" branch calls the showErrorMessage() function, outputting the error message "Target process connection failed. Please check if the process status, permissions, and process ID are correct." Then press [the appropriate button]. Figure 2 The process executes the `exit()` function to terminate the tool's operation; if the connection is successful, the memory analysis tool receives... Figure 2 After receiving the success signal returned by the target process, confirming the stable communication link, proceed to... Figure 2 The subsequent "loop [every N seconds]" timed cyclical data acquisition process.
[0037] Memory data acquisition: such as Figure 2 As shown in the core data acquisition process, the memory analysis tool enters a "loop [every N seconds]" loop at preset 5-second intervals, repeatedly executing the getMemorySnapshot() function to collect memory usage data of the target platform program, and finally generating... Figure 2The memoryData dataset is marked in the middle.
[0038] The specific data collection methods strictly follow... Figure 2 Data flow: On one hand, by hooking system calls such as malloc, free, and realloc, the system records real-time information on memory allocation and deallocation (including allocated memory address, memory size, allocation time, and deallocation time); on the other hand, it reads the files / proc / [target process ID] / statm and / proc / [target process ID] / maps to obtain data such as the target process's total memory usage, physical memory usage, virtual memory distribution, and the modules to which memory blocks belong (such as the monitoring data acquisition module and video encoding module); the two types of collected data are integrated to form... Figure 2 The complete memoryData dataset is used for subsequent processing.
[0039] Data preprocessing: such as Figure 2 As shown, after the memoryData dataset is generated, the memory analysis tool calls the parseMemoryStructure() function according to a time-series process to preprocess the collected memoryData dataset: The first step is data cleaning, removing invalid data exceeding a reasonable memory value range (e.g., exceeding the maximum allocatable memory of the target process), redundant data collected repeatedly, and data with incorrect formats; the second step is format conversion, uniformly converting the binary data obtained from system call hooks and the text data read from the / proc file system into a standard structured data format recognizable by the Qt graphical interface. Figure 2 The subsequent "visualization rendering" stage will provide adaptive data support.
[0040] After preprocessing is complete, the tool continues to press Figure 2 The process calls the `buildObjectGraph()` function to construct a memory object relationship graph based on the memory allocation addresses and memory object references in the structured data. This graph clearly presents the call and dependency logic between various memory blocks (such as the memory blocks of the acquisition module and the memory blocks of the encoding module), providing a clear view of the calls and dependencies between them. Figure 2 The "anomaly detection" step provides the basis for analysis.
[0041] Data parsing and anomaly detection: such as Figure 2 As shown in the "opt[Detect Anomalies]" branch, based on the preprocessed structured data and memory object relationship graph, the memory analysis tool starts memory anomaly detection: by comparing the memory allocation records and release records in 10 consecutive collection cycles (5 seconds per cycle, 50 seconds in total), if a memory block only has allocation records but no release records, and there are no valid associated references in the memory object relationship graph (i.e. the memory block is not called by any other functional module), it is determined to be a memory leak point.
[0042] At this time, the tool press Figure 2 The process calls the `markLeakage()` function to mark key information about the memory leak point, including the memory allocation address, allocation time, the code module to which it belongs (e.g., the video encoding module), and the amount of memory it occupies. The marking result will be used as... Figure 2 The core input data for the "visual rendering" stage is used to intuitively display the leak points later.
[0043] Visual rendering: such as Figure 2 As shown in the visualization flowchart on the right, the visualization engine receives the processed memory data, memory object relationship diagram, and leak point marking results, and then... Figure 2 The rendering sequence sequentially calls the `renderHeatmap()`, `renderTimeline()`, and `renderDependencyTree()` functions, while also supplementing the calls to `renderTrendChart()` and `renderAllocationStackChart()` functions to complete multi-dimensional visualization rendering and generate... Figure 2 The visualization dataset marked in the middle, and the rendering logic and display effects of each chart are as follows: Call the renderHeatmap() function to generate a memory usage heatmap: different shades of color distinguish the usage density of each memory address segment, with red indicating high usage density areas (such as the memory area of the encoding module during peak monitoring data periods) and blue indicating low usage density areas, intuitively presenting the distribution of memory resources; The `renderTimeline()` function is called to generate a timeline chart of memory usage changes: with time on the horizontal axis and memory usage on the vertical axis, it dynamically displays the trend of the target process's total memory usage over the past hour, while also annotating... Figure 2 The time points corresponding to the memory leak points marked by the markLeakage() function in the middle; Calling the renderDependencyTree() function generates a memory object dependency tree graph: displaying the reference relationships between memory objects in a hierarchical structure. Figure 2 Memory leaks marked in the middle are highlighted with red nodes, making it easier for users to trace the associated paths of the leaks (such as links where sub-memory blocks of the coding module are not released by the parent module). Call the renderTrendChart() function to generate a memory usage trend chart: statistically analyze the changes in memory usage over an hour-to-day time dimension to help analyze long-term memory usage characteristics; Calling the renderAllocationStackChart() function generates a memory allocation stack chart: clearly presenting the allocation call stack information of each memory block (such as the allocation function and call level), providing direct support for locating the leaked code.
[0044] The above five types of charts together constitute Figure 2 The visualization dataset in Qt is presented to users through a graphical interface.
[0045] User interaction operations: such as Figure 2 As shown in the "loop interactive session" diagram, the memory analysis tool enters a continuous interactive state, supporting users to perform operations based on the visualization data. All interactions correspond to... Figure 2 Sequential logic: Zooming and Filtering: Users can zoom in and out of the visualization using the mouse wheel, or filter by entering filter criteria such as module name (e.g., "Video Encoding Module") or memory size range (e.g., "≥1GB"). After a user action is triggered, the tool will... Figure 2 The process calls the updateView() function to update the visual view in real time and generate... Figure 2 The `updatedView` marked in the middle ensures that the user focuses on the memory data they are interested in; Threshold setting operation: Users can customize memory usage thresholds (e.g., setting the physical memory usage threshold to 2GB). The tool monitors the target process's memory usage in real time. When the threshold is exceeded, an audible and visual alarm is immediately triggered, and an alarm prompt box pops up in the updatedView. This logic is embedded... Figure 2 The "interactive session" loop ensures real-time response to exceptions. In-depth analysis of leak points: The user clicks on the red leak point node in the updatedView (i.e., Figure 2 The tool automatically extracts in-depth analysis data from the memoryData dataset, such as the allocation stack information, associated memory objects, and memory usage change curves within 50 seconds, for leaks marked by the markLeakage() function. This data is then updated to updatedView using the updateView() function to help developers locate the root cause of the leak.
[0046] Analysis report export and optimization suggestion generation: such as Figure 2 As shown in the final output flow, when the user triggers the export command, the memory analysis tool proceeds according to... Figure 2 The timing sequence calls the exportReport() function to generate and export a PDF memory analysis report. The report includes memory usage statistics (such as peak and average memory usage over a 5-second period). Figure 2 The results of anomaly detection in the "opt[detect anomaly]" step, details of leak points marked by the markLeakage() function, and screenshots of various visualization charts corresponding to visualizationData.
[0047] Meanwhile, tool calls Figure 2 The generateSuggestions() function generates targeted optimization suggestions based on memory analysis results. Examples include: "There are unreleased memory blocks in the video encoding module. It is recommended to add a free() call to release the memory block after the encoding completion callback function is executed." and "The target process allocates memory too frequently (≥100 times within a 5-second cycle). It is recommended to use a memory pool mechanism to optimize the memory allocation strategy and reduce system call overhead." This provides clear guidance for developers to optimize the target platform program code.
[0048] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for visually analyzing process memory usage, characterized in that: Includes the following steps: (1) The user starts the memory analysis tool, which initiates a connection request with the target platform program; (2) Execute branch processing based on connection results: If the connection fails, the memory analysis tool performs error processing and terminates its operation; if the connection is successful, the memory analysis tool enters the timed loop data acquisition process; (3) The memory analysis tool collects memory usage data of the target platform program at preset time intervals. The memory usage data includes memory allocation information, memory release information and current memory usage. (4) Preprocess the collected memory usage data, and parse the data structure and construct a memory object relationship graph; (5) Based on the memory object relationship diagram and the preprocessed memory data, perform memory anomaly detection and mark memory leak points; (6) Visualize and render the processed memory data, memory object relationship diagram and memory leak marking results using a visualization engine to generate visualized data; (7) Enter the user interaction session loop and update the visualization view in response to user operations; (8) Respond to user commands to export memory analysis reports and generate program optimization suggestions based on memory usage data and memory leak marking results.
2. The method for visual analysis of process memory usage according to claim 1, characterized in that: The error handling in step (2) is to output error message information to the memory analysis tool; after the connection is successful, the memory analysis tool receives the connection success signal and then enters the timed loop data acquisition process.
3. The method for visual analysis of process memory usage according to claim 1, characterized in that: The collection of memory usage data in step (3) is achieved by hooking system calls or reading the / proc file system.
4. The method for visual analysis of process memory usage according to claim 1, characterized in that: The preprocessing in step (4) includes data cleaning and format conversion; the parsing data structure is to parse the storage format and association logic of memory usage data; and the construction of the memory object relationship graph is to construct a hierarchical relationship graph based on memory allocation addresses and reference relationships.
5. The method for visual analysis of process memory usage according to claim 1, characterized in that: The logic for memory anomaly detection in step (5) is as follows: compare memory allocation records and release records in multiple consecutive collection cycles. If there is a memory block that only has allocation records, no release records and no valid associated references, it is determined to be a memory anomaly. The memory block is marked as a memory leak point and its allocation information is recorded.
6. The method for visual analysis of process memory usage according to claim 1, characterized in that: In step (6), Qt graphical interface technology is used to perform visualization rendering; the visualization data includes memory usage heatmap, memory change timeline, memory object dependency tree, memory usage trend graph and memory allocation stack graph.
7. The method for visual analysis of process memory usage according to claim 1, characterized in that: The user operations in step (7) include zooming and filtering operations; the user interaction session loop also includes: supporting users to set memory usage thresholds, and when the memory usage of the target platform program exceeds the threshold, the memory analysis tool triggers an alarm; supporting users to select memory leak points in the visualization view, and the memory analysis tool returns in-depth analysis data corresponding to the leak point.
8. The method for visual analysis of process memory usage according to claim 1, characterized in that: The memory analysis report in step (8) includes all the visualization charts, memory usage statistics and memory leak details marked in step (6) and step (5); the program optimization suggestions correspond one-to-one with the memory leak details, including leak repair directions and memory usage optimization strategies.