Search

CN-122019313-A - Visual analysis method for use condition of process memory

CN122019313ACN 122019313 ACN122019313 ACN 122019313ACN-122019313-A

Abstract

The invention belongs to the video monitoring industry, relates to a process memory visualization tool and an implementation method thereof, and aims to solve the problems that the existing Valgrind, visualVM memory tools are complex in operation, non-intuitive in display, and insufficient in instantaneity and pertinence. The tool is used for collecting memory allocation, release and occupation data of a target platform program in real time through a hook system call or a read/proc file system, and intuitively displaying the data through a memory usage trend chart, an allocation stack chart and the like by utilizing a Qt graphical interface technology after data cleaning and format conversion preprocessing, and simultaneously providing a user interaction function and generating a targeted optimization suggestion. The method can help developers to quickly locate memory leakage, optimize program codes and improve program performance and stability.

Inventors

  • KANG WEI
  • SUN NAN
  • Ding Guangce
  • CHEN RUN
  • SUN XIAOZHUANG
  • LI HAO
  • ZHENG XIAOBO
  • ZOU MINGSONG

Assignees

  • 杭州阿启视科技有限公司

Dates

Publication Date
20260512
Application Date
20260403

Claims (8)

  1. 1. A visual analysis method for use conditions of a process memory is characterized by comprising the following steps: (1) A user starts a memory analysis tool, and the memory analysis tool initiates a connection request with a target platform program; (2) Executing branch processing according to a connection result, wherein if the connection fails, the memory analysis tool executes error processing and terminates operation; (3) The memory analysis tool collects memory use data of the target platform program according to a preset time interval, wherein the memory use data comprises memory allocation information, memory release information and current memory occupation conditions; (4) Preprocessing the acquired memory usage data, and simultaneously analyzing a data structure and constructing a memory object relation diagram; (5) Performing memory anomaly detection based on the memory object relation diagram and the preprocessed memory data, and marking memory leakage points; (6) Performing visual rendering on the processed memory data, the memory object relation graph and the memory leakage marking result through a visual engine to generate visual data; (7) Entering a user interaction session cycle, and updating the visual view in response to user operation; (8) And responding to the user instruction to derive a memory analysis report, and generating a program optimization suggestion based on the memory use data and the memory leakage marking result.
  2. 2. The visual analysis method of process memory use condition according to claim 1, wherein in the step (2), the error processing outputs error prompt information to the memory analysis tool, and after the connection is successful, the memory analysis tool receives a connection success signal and then enters a timing cycle data acquisition flow.
  3. 3. The visual analysis method of process memory usage according to claim 1, wherein the acquisition of the memory usage data in the step (3) is implemented by means of a hook system call or a read/proc file system.
  4. 4. The visual analysis method of process memory usage according to claim 1, wherein the preprocessing in the step (4) includes data cleansing and format conversion, the parsing data structure is used for parsing the storage format and association logic of the memory usage data, and the building of the memory object relationship graph is used for building a hierarchical relationship graph based on memory allocation addresses and reference relationships.
  5. 5. The visual analysis method of process memory usage as set forth in claim 1, wherein the logic for detecting the memory anomaly in step (5) is to compare the memory allocation record and the release record in a plurality of consecutive acquisition cycles, and if there is a memory block having only the allocation record, no release record and no valid association reference, determine that the memory is abnormal, mark the memory block as a memory leak point and record its allocation information.
  6. 6. The method for visual analysis of process memory usage as set forth in claim 1, wherein in step (6) visual rendering is performed by employing a Qt graphical interface technique, and the visual data includes a memory usage thermodynamic diagram, a memory change time line diagram, a memory object dependency tree diagram, a memory usage trend diagram, and a memory allocation stack diagram.
  7. 7. The visual analysis method of process memory usage according to claim 1, wherein the user operation in the step (7) includes a scaling operation and a filtering operation, the user interaction session cycle further includes supporting a user to set a memory usage threshold, when the memory usage of the target platform program exceeds the threshold, the memory analysis tool triggers an alarm prompt, supporting the user to select a memory leak point in the visual view, and the memory analysis tool returns deep analysis data corresponding to the leak point.
  8. 8. The visual analysis method of process memory usage according to claim 1, wherein the memory analysis report in step (8) includes all the visual charts in step (6), the memory usage statistics and the memory leakage point details marked in step (5), and the program optimization advice corresponds to the memory leakage point details one by one, including the leakage point repair direction and the memory usage optimization strategy.

Description

Visual analysis method for use condition of process memory Technical Field The invention belongs to the technical field of computer memory management, and particularly relates to a visual analysis method for use conditions of a process memory. Background With the increasing abundance of software system functions and the increasing complexity of architecture, memory management has become one of the core challenges in software development and maintenance. The problems of memory leakage, invalid memory occupation and the like can not only lead to the reduction of the running efficiency of the program and the slow response speed, but also cause system breakdown when serious, and especially for platform programs needing long-term stable running, such as a video monitoring platform core program, the rationality of the use state of the memory directly influences the continuity and the reliability of service. Therefore, the development of an analysis tool capable of intuitively and accurately presenting the use condition of the program memory has important practical significance. Currently, there are a variety of memory monitoring and analysis tools on the market, typical representatives include Valgrind, visualVM and so on. The tools can collect and output detailed data of the program memory, provide a certain support for the memory problem investigation, but have obvious limitations in practical application: firstly, the operation flow is complex, professional developers need to have a deep technical background to be skillfully applied, and non-professionals are difficult to quickly get up; Secondly, the data display form is not visual enough, and is presented in a pure text or a complex report, so that a user cannot be helped to quickly capture the memory change trend and key abnormal points; thirdly, the real-time performance is insufficient, and the dynamic memory change of the target program is difficult to dynamically track; Fourth, the lack of pertinence, the commonality design causes that it is difficult to focus on the memory characteristics of specific platform programs, and the memory analysis requirement under specific scenes cannot be met accurately. The above drawbacks make it difficult for the existing tools to efficiently assist developers in quickly locating memory problems and optimizing program performance, so that a memory visual analysis scheme that is more suitable for practical application needs is urgently needed. Disclosure of Invention The invention aims to provide a visual analysis method for use conditions of a process memory, and aims to overcome the defects of complex operation, non-visual data display, insufficient instantaneity, poor pertinence and the like of the existing memory monitoring and analysis tool. The method comprises the steps of acquiring memory usage data of a platform program in real time, displaying memory usage trend, memory allocation situation and potential memory leakage problem through a visual and easily-understood graphical interface, helping developers to quickly locate abnormal points of the memory, simultaneously realizing real-time tracking of dynamic changes of the memory of a target program, enhancing real-time responsiveness of tools, providing accurate analysis results and optimization suggestions aiming at memory characteristics of the specific platform program, meeting personalized memory analysis requirements of different application scenes, and supporting the developers to perform custom setting and targeted optimization based on the memory usage data through flexible user interaction functions, and finally improving running performance and stability of the program. In order to achieve the above object, the present invention provides a visual analysis method for use conditions of a process memory, including the following steps: (1) A user starts a memory analysis tool, and the memory analysis tool initiates a connection request with a target platform program; (2) Executing branch processing according to a connection result, wherein if the connection fails, the memory analysis tool executes error processing and terminates operation; (3) The memory analysis tool collects memory use data of the target platform program according to a preset time interval, wherein the memory use data comprises memory allocation information, memory release information and current memory occupation conditions; (4) Preprocessing the acquired memory usage data, and simultaneously analyzing a data structure and constructing a memory object relation diagram; (5) Performing memory anomaly detection based on the memory object relation diagram and the preprocessed memory data, and marking memory leakage points; (6) Performing visual rendering on the processed memory data, the memory object relation graph and the memory leakage marking result through a visual engine to generate visual data; (7) Entering a user interaction session cycle, and updating the visual view in response t