Resource leakage monitoring method and terminal
By recording and analyzing the detailed information of operation instructions, the problem of insufficient resource leakage monitoring of existing tools across platforms and cross-languages is solved, efficient and accurate resource leakage detection and analysis is achieved, system resource overhead is reduced, and system resource overhead is provided. Flexible data processing mechanism.
Patent Information
- Application Number
- CN202410972107.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-07-19
AI Technical Summary
Existing resource leak monitoring tools have poor data scalability and flexibility in memory management, error debugging, and performance monitoring, and are unable to support cross-platform and cross-language, and have limited leak type support.
A resource leakage monitoring method is adopted, by recording the detailed information of operation instructions, formatting and adding it to the buffer, writing to disk if the capacity or time threshold is reached, using the callback function to ensure data integrity, and regularly reading through asynchronous loading Get the data for pairing and judgment, and analyze the related information of resource leakage.
It realizes cross-platform resource leakage monitoring, reduces system resource overhead, improves the accuracy and reliability of data analysis, identifies resource leakage objects, reduces the performance impact on the monitored program, provides flexible data processing mechanisms and cross-language support.
Smart Images

Figure CN118897774A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of resource monitoring, and in particular to a resource leakage monitoring method and terminal. Background Art
[0002] At present, there are various resource leak monitoring tools on the market, such as Valgrind, AddressSanitizer, LeakSanitizer, Deleaker and other special leak diagnostic tools. These tools mainly monitor resource leaks in specific programming environments and can provide analysis data for problems such as memory leaks and handle leaks. They track and identify memory leaks through various technical means, such as registering memory allocation, releasing hook functions, macro definition replacement, and binary translation. Even though they are effective in memory management, error debugging, and performance monitoring, they each have limitations, such as poor data scalability and flexibility, limited support for leak types, and inability to support cross-platform and cross-language. Therefore, there is an urgent need for a resource leak monitoring method and terminal that can solve the above problems. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a resource leakage monitoring method and terminal, which can be applicable to a variety of programming environments and operating systems, realize cross-platform monitoring, and provide users with flexibility and scalability of resource leakage monitoring through a flexible data processing mechanism.
[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0005] A resource leakage monitoring method comprises the following steps:
[0006] S1. Record detailed information of the operation instruction according to the operation instruction, format and convert the detailed information and add it to the buffer, wherein the detailed information includes general information and custom information, wherein the general information includes the operation type, and the custom information includes the type name and the reference chain;
[0007] S2. If the disk writing time reaches a time threshold or the capacity of the buffer reaches a capacity threshold, the detailed information is written to the disk by executing a callback function;
[0008] S3. Read disk data regularly in an asynchronous loading manner, perform pairing judgment according to the operation type in the general information of the detailed information, and if there are unpaired "apply" and "release" operation types, determine it as a potential resource leak, and analyze the associated information of the resource leak according to the type name and reference chain in the custom information of the detailed information.
[0009] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0010] A resource leakage monitoring terminal comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step of the resource leakage monitoring method mentioned above is implemented.
[0011] The beneficial effects of the present invention are as follows: the present invention provides a resource leakage monitoring method and terminal, which records detailed information of the operation instruction according to the operation instruction, formats and converts the detailed information and adds it to the buffer, the writing logic of the atomic operation is simple, the required memory application is small, and the handle resource can be released immediately after the file is written, thereby reducing system resource overhead; if the disk writing time reaches the time threshold or the capacity of the buffer reaches the capacity threshold, the detailed information is written to the disk by executing the callback function, thereby ensuring the integrity and recoverability of the data and improving the accuracy and reliability of subsequent data analysis; the disk data is read regularly in an asynchronous loading manner, and the operation is independent of the main program to avoid performance degradation caused by occupying hardware resources, and eliminate the impact on the performance and stability of the "monitored program", and pairing judgment is performed according to the operation type in the general information of the detailed information. If there are unpaired "application" and "release" operation types, it is determined to be a potential resource leakage, and the associated information of the resource leakage is analyzed according to the type name and reference chain in the custom information of the detailed information, and the resource leakage object is accurately identified, thereby improving the accuracy and reliability of resource leakage detection. In summary, the present invention separates the data recording and analysis links, records the relevant information of atomic operations to the disk, greatly reduces performance overhead, and provides integrity and recoverability guarantees for subsequent data analysis; based on the detailed information of the operation instructions, the data is paired and analyzed to identify the type of resource leakage and the cause of the leakage, and further, the reference relationship between resource leakage objects can be mined to facilitate finding the objects with root problems, thereby realizing resource leakage monitoring. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 A flow chart of a resource leakage monitoring method according to an embodiment of the present invention;
[0013] Figure 2 A schematic diagram of a resource leakage monitoring terminal according to an embodiment of the present invention;
[0014] Figure 3 This is an overall flow chart of a resource leakage monitoring method according to an embodiment of the present invention;
[0015] Figure 4 A class diagram of a resource leakage monitoring method according to an embodiment of the present invention;
[0016] Description of labels:
[0017] 1. A resource leakage monitoring terminal; 2. A memory; 3. A processor. DETAILED DESCRIPTION
[0018] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.
[0019] Please refer to Figure 1 The embodiment of the present invention provides a resource leakage monitoring method, comprising the steps of:
[0020] S1. Record detailed information of the operation instruction according to the operation instruction, format and convert the detailed information and add it to the buffer, wherein the detailed information includes general information and custom information, wherein the general information includes the operation type, and the custom information includes the type name and the reference chain;
[0021] S2. If the disk writing time reaches a time threshold or the capacity of the buffer reaches a capacity threshold, the detailed information is written to the disk by executing a callback function;
[0022] S3. Read disk data regularly in an asynchronous loading manner, perform pairing judgment according to the operation type in the general information of the detailed information, and if there are unpaired "apply" and "release" operation types, determine it as a potential resource leak, and analyze the associated information of the resource leak according to the type name and reference chain in the custom information of the detailed information.
[0023] From the above description, it can be seen that the beneficial effects of the present invention are: the present invention provides a resource leakage monitoring method and terminal, which records detailed information of the operation instruction according to the operation instruction, formats and converts the detailed information and adds it to the buffer, the writing logic of the atomic operation is simple, the required memory application is small, and the handle resource can be released immediately after the file is written, thereby reducing system resource overhead; if the disk write time reaches the time threshold or the capacity of the buffer reaches the capacity threshold, the detailed information is written to the disk by executing the callback function, thereby ensuring the integrity and recoverability of the data and improving the accuracy and reliability of subsequent data analysis; the disk data is read regularly in an asynchronous loading manner, and the operation is independent of the main program to avoid performance degradation caused by preempting hardware resources, and eliminate the impact on the performance and stability of the "monitored program", and pairing judgment is performed according to the operation type in the general information. If there are unpaired "application" and "release" operation types, it is determined to be a potential resource leakage, and the associated information of the resource leakage is analyzed according to the type name and reference chain in the custom information of the detailed information, and the resource leakage object is accurately identified, thereby improving the accuracy and reliability of resource leakage detection. In summary, the present invention separates the data recording and analysis links, records the relevant information of atomic operations to the disk, greatly reduces performance overhead, and provides integrity and recoverability guarantees for subsequent data analysis; based on the detailed information of the operation instructions, the data is paired and analyzed to identify the type of resource leakage and the cause of the leakage, and further, the reference relationship between resource leakage objects can be mined to facilitate finding the objects with root problems, thereby realizing resource leakage monitoring.
[0024] Furthermore, the step S2 further includes:
[0025] If the detailed information fails to be written to the disk, the write-to-disk failure data is returned to the buffer by executing the callback function, and the buffer processes the write-to-disk failure data and rewrites the detailed information to the disk.
[0026] From the above description, we can see that by executing the callback function to deal with data writing failure, an error handling mechanism is provided to ensure that the write operation can be properly handled when encountering problems, thereby improving the system's fault tolerance. At the same time, rewriting to disk helps prevent data loss and ensure data integrity and persistent storage.
[0027] Furthermore, before step S1, the following steps are included:
[0028] Initialize the system and listen for operation instructions, wherein the initialization operation includes setting a time threshold and setting a callback function for the buffer.
[0029] From the above description, we can see that when initializing the system, set the time threshold to flexibly control the data writing time to meet different task requirements, optimize disk I / O operations, and improve disk I / O efficiency; set a callback function for the buffer to achieve decoupling between modules so that subsequent asynchronous threads can write data to disk.
[0030] Further, the relevant information of the resource leakage is analyzed according to the type name and reference chain in the custom information of the detailed information, including:
[0031] By using SQL statements, count the objects corresponding to the type names in the custom information to determine whether there is resource abuse;
[0032] Based on the reference chain in the custom information, the "reference chain" relationship is analyzed using SQL statements to mine the reference relationship between the objects with problems.
[0033] From the above description, we can know that for different types of leaks, different fields are extended, and customized information is used to better count the hot spots of leaks and solve them in a targeted manner. At the same time, reference chain fields are added, and SQL statements are used for statistical analysis to dig out the reference relationship between problematic objects, so as to find the object with the root problem and other objects with reference relationship to solve all resource leakage problems.
[0034] Furthermore, the step S3 further includes:
[0035] Obtain analysis results, perform SQL query and data processing on the analysis results, and present the final analysis results to the user.
[0036] From the above description, it can be seen that by providing interface support, users can use customized SQL statements to perform flexible and multi-dimensional statistics and analysis on the analysis results, view graphical analysis results, enhance user interaction experience, and provide SQL statement templates to facilitate users to imitate and migrate to their own analysis work. The system functions are simple and easy to use.
[0037] Please refer to Figure 2 Another embodiment of the present invention provides a resource leakage monitoring terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements each step of the above-mentioned resource leakage method when executing the computer program.
[0038] The resource leakage monitoring method and terminal described above in the present invention are suitable for identifying the cause of resource leakage and solving resource leakage, and are described below through specific implementation methods:
[0039] Embodiment 1
[0040] Please refer to Figure 1 , a resource leakage monitoring method, comprising the steps of:
[0041] S1. Record detailed information of the operation instruction according to the operation instruction, format and convert the detailed information and add it to a buffer, wherein the detailed information includes general information and custom information, the general information includes the operation type, and the custom information includes the type name and a reference chain.
[0042] In this embodiment, detailed information of the operation instruction is recorded according to the operation instruction to ensure that all relevant information is captured and saved, thereby providing a complete information basis for subsequent data analysis and processing; the detailed information is formatted and converted to ensure that the format is simple and universal, so as to optimize storage space and improve data processing efficiency, and reduce system resource overhead; at the same time, the detailed information after the conversion format is stored in a buffer to achieve fast data access and processing, and the detailed information is divided into general information and custom information, providing a flexible data processing mechanism to adapt to different application scenarios.
[0043] Before step S1, it also includes: initializing the system and listening to operation instructions, wherein the initialization operation includes setting a time threshold, setting a callback function for the buffer, flexibly controlling the disk write time to meet different task requirements, optimizing disk I / O operations, and improving disk I / O efficiency. A callback function is set for the buffer to allow the system to automatically trigger data write operations to the disk when specific conditions are met, thereby achieving decoupling between modules so that subsequent asynchronous threads can obtain data and reduce the burden on the main thread.
[0044] S2. If the disk writing time reaches a time threshold or the capacity of the buffer reaches a capacity threshold, the detailed information is written to the disk by executing a callback function.
[0045] In this embodiment, by setting the time threshold and capacity threshold, the frequency and amount of data written to the disk are effectively controlled, the performance degradation caused by frequent disk operations is avoided, the integrity and recoverability of the data are ensured, and the accuracy and reliability of subsequent data analysis are improved; the callback function is executed, and the detailed information is written to the disk in an asynchronous processing manner to avoid blocking the main thread and improve the overall performance.
[0046] Furthermore, step S2 also includes: if the detailed information fails to be written to the disk, the failure data to write to the disk is returned to the buffer by executing the callback function, and the buffer processes the failure data to write to the disk and rewrites the detailed information to the disk, providing an error handling mechanism to ensure that the write operation can be properly handled when encountering problems, thereby improving the system's fault tolerance. Rewriting to the disk after the processing step is completed helps prevent data loss and ensure data integrity and persistent storage.
[0047] S3. Read disk data regularly in an asynchronous loading manner, perform pairing judgment according to the operation type in the general information of the detailed information, and if there are unpaired "apply" and "release" operation types, determine it as a potential resource leak, and analyze the associated information of the resource leak according to the type name and reference chain in the custom information of the detailed information.
[0048] In this embodiment, through asynchronous loading and periodic analysis of disk data, matching and identification are performed according to the operation type, and potential resource leakage detection is implemented according to the pairing result, so as to identify the type of resource leakage and the cause of resource leakage. For example, "ID" is used as the resource unique identifier. For the data of the same ID, if there are two data paired with "application" and "release", it means that the resource corresponding to this ID has been effectively released and there will be no resource leakage problem; if there is only one "application" data but no "release" data, it means that the resource corresponding to this ID causes resource leakage and resource leakage processing is required.
[0049] In this embodiment, the associated information of the resource leakage is analyzed according to the type name and reference chain in the custom information of the detailed information, including: using SQL statements to count the objects corresponding to the type name in the custom information to determine whether there is resource abuse; based on the reference chain in the custom information, using SQL statements to analyze the "reference chain" relationship, dig out the reference relationship between the problematic objects, and expand different fields for different types of leakage, such as: type name, object name, reference chain, all related references, etc., so as to dig out a series of other objects referenced behind the object according to the reference chain, which is conducive to better counting resource leakage problems and solving them in a targeted manner. In addition, the following fields can be added: physical memory overhead, material memory overhead of objects and sub-objects, video memory overhead, and video memory overhead of objects and sub-objects, so as to further record various overheads in memory and video memory from multiple angles, so as to facilitate resource management and improve system performance.
[0050] Furthermore, step S3 also includes: obtaining analysis results, performing SQL query and data processing on the analysis results, and displaying the final analysis results to the user. The system provides interface support, allowing the user to use customized SQL statements for flexible, multi-dimensional statistics and analysis. Even for the same database table that has been recorded, statistics of different dimensions can be performed by writing different SQL statements, so that data can be analyzed from different angles, thereby improving the applicability and flexibility of the system to adapt to different needs and occasions.
[0051] Embodiment 2
[0052] Please refer to Figure 3 and Figure 4 , Figure 3 It is an overall flow chart of a resource leakage monitoring method. Figure 4 This is a class diagram of a resource leakage monitoring method. Figure 1 Based on the embodiment shown, this embodiment provides a resource leakage monitoring method for monitoring game resource leakage. Taking an Unreal game as an example, the steps include:
[0053] Step 1: Initialize the system and listen for operation instructions, wherein the initialization operation includes setting a time threshold and setting a callback function for a buffer.
[0054] In this embodiment, when the game starts, the Init method in the LeakLogger class is called. This method is executed only once in the entire life cycle of the application. Appropriate permissions are set for the process to access system-level resource information, and the SQLite database environment for data storage is initialized. At the same time, the underlying modules within the system are initialized, including setting time thresholds and setting callback functions for multiple underlying modules, thereby achieving decoupling between modules so that subsequent asynchronous threads can obtain data and reduce the burden on the main thread. In addition, the RegisterWithDispatch method is used to register LeakLogger with the system's scheduler to facilitate receiving resource application or release operation instructions.
[0055] Step 2: Record detailed information of the operation instruction according to the operation instruction, format and convert the detailed information and add it to the buffer, the detailed information includes general information and custom information, the general information includes the operation type, and the custom information includes the type name and reference chain.
[0056] In this embodiment, when the game triggers resource application and release operations, Figure 3 The LeakLogger class in responds to the operation, and the atomic operation information recording function is encapsulated in the LeakLogger class. According to different parameter values, the detailed information of the atomic operation is recorded through the AddLog function. For example, the parameter value is "true", which indicates a resource "application" operation, and the parameter value is "flase" which indicates a resource "release operation". The allocated memory size, timestamp, code call stack and other information are recorded to ensure that all relevant information is captured and saved, providing a complete information basis for subsequent data analysis and processing, executing the ResourceRecord class to create a resource record instance, and storing the detailed information in a formatted dictionary form through the ToDictionary function, thereby ensuring a simple and universal format, and temporarily storing it in the memory buffer through the AddToBuffer function of the BufferManager class to facilitate subsequent rapid access and processing of the data.
[0057] Step three: if the disk writing time reaches a time threshold or the capacity of the buffer reaches a capacity threshold, the detailed information is written to the disk by executing a callback function.
[0058] In this embodiment, BufferManager triggers the FlushBuffer method according to the time threshold set by the SetWriteInterval method, such as every 30 milliseconds, or the capacity threshold of the buffer, such as 100 records, executes the callback function, and calls the WriteData function of PersistentStorage through an asynchronous thread to write the detailed information to the database file on the disk, avoiding blocking the main thread to reduce the impact on game performance.
[0059] Step 4: If the detailed information fails to be written into the disk, the failed data is returned to the buffer by executing the callback function, and the buffer processes the failed data and rewrites the detailed information into the disk.
[0060] In this embodiment, if data writing fails, PersistentStorage executes the callback function pre-sent by the upper-level LeakLogger class, thereby indirectly feeding back the error to BufferManager, and BufferManager handles the failed data writing to disk and re-executes the WriteData function of the PersistentStorage class to write the data to disk, providing an error handling mechanism to ensure that the write operation is properly handled when encountering problems, improving the system's fault tolerance, and helping to prevent data loss, ensuring data integrity and persistent storage.
[0061] Step 5: Read disk data regularly using asynchronous loading, and make pairing judgments based on the operation types in the general information of the detailed information. If there are unpaired "apply" and "release" operation types, it is determined to be a potential resource leak. Analyze the associated information of the resource leak based on the type name and reference chain in the custom information of the detailed information.
[0062] In this embodiment, DataReader periodically reads data from the disk and loads it asynchronously through the ReadDataAsync method to ensure that the main program is not blocked. After the data is loaded, it is passed to LeakDetector for data analysis to identify resource leakage patterns. LeakDetector identifies "leakage" problems based on "application" and "release" operations. For example, "ID" is used as the unique identifier of the resource. For the data with the same ID, if there are two paired data of "application" and "release", it means that the resource corresponding to this ID has been effectively released and there will be no resource leakage problem; if there is only one "application" data but no "release" data, it means that the resource corresponding to this ID causes resource leakage and resource leakage processing is required.
[0063] In this embodiment, the associated information of the resource leakage is analyzed according to the type name and reference chain in the custom information of the detailed information, including: using SQL statements to count the objects corresponding to the type name in the custom information to determine whether there is resource abuse; based on the reference chain in the custom information, using SQL statements to analyze the "reference chain" relationship, dig out the reference relationship between the problematic objects, and expand different fields for different types of leakage, such as: type name, object name, reference chain, all related references, etc., so as to dig out a series of other objects referenced behind the object according to the reference chain, which is conducive to better counting resource leakage problems and solving them in a targeted manner. In addition, the following fields can be added: physical memory overhead, material memory overhead of objects and sub-objects, video memory overhead, and video memory overhead of objects and sub-objects, so as to further record various overheads in memory and video memory from multiple angles, so as to facilitate resource management and improve system performance.
[0064] In some embodiments, SQL statements can be used to further analyze the relationship between the "reference chain" and the "external object chain" from the following four perspectives:
[0065] 1. Parent-child relationship: Sort the data according to the type and name in the external object chain field to identify which types of resources or objects are most frequently used as parent objects of other objects;
[0066] 2. Citation relationship: Sort the data according to all relevant citation fields, analyze the most frequent citation relationships, and display the objects most frequently involved in the citation chain;
[0067] 3. Reference frequency: Sort the data according to all relevant reference fields and count the objects with the most references to confirm the specific objects of the leaked resources;
[0068] 4. Frame Load: Sorts the data by the frame number field and displays the top 10 most recorded frames to identify frames that cause lag, request large amounts of resources, or even exhaust resources.
[0069] Step 6: Obtain analysis results, perform SQL query and data processing on the analysis results, and display the final analysis results to the user.
[0070] In this embodiment, LeakDetector obtains and analyzes data by executing the GetRecord method, SqlExecutor obtains the above analysis results from LeakDetector, SqlExecutor executes SQL statements through the ExecuteSQL method to perform query and data processing tasks, and provides sorting, statistics and paging functions, UIDisplay obtains the data processed by the SQL statement from SqlExecutor, and executes the DisplayData method to display the analysis results to the user in the form of a graphical interface, providing a user interface to support user interaction, allowing users to select different SQL files to execute different statistical instructions, and further enhancing the practicality and interactivity of the system.
[0071] Embodiment 3
[0072] Please refer to Figure 2 A resource leakage monitoring terminal 1 includes a memory 2, a processor 3, and a computer program stored in the memory 2 and executable on the processor 3. When the processor 3 executes the computer program, each step of a resource leakage monitoring method of embodiment 1 is implemented.
[0073] In summary, the present invention provides a resource leakage monitoring method and terminal, which records detailed information of the operation instruction according to the operation instruction, ensures that all relevant information is captured and saved, and provides a complete information basis for subsequent data analysis and processing; formats and converts the detailed information and adds it to the buffer, ensures that the format is simple and universal, optimizes storage space and improves data processing efficiency, and reduces system resource overhead; initializes the system, listens to the operation instruction, sets the time threshold, flexibly controls the disk write time to meet different task requirements, sets a callback function for the buffer, allows the system to automatically trigger the data write disk operation when specific conditions are met, and realizes the decoupling between modules, so that subsequent asynchronous threads can obtain data and reduce the burden on the main thread; controls the frequency and amount of data write to the disk according to the time threshold or capacity threshold, avoids performance degradation caused by frequent disk operations, ensures data integrity and recoverability, and improves the accuracy and reliability of subsequent data analysis; if data fails to be written to the disk, the failed disk write data is returned to the buffer by executing the callback function, and the buffer processes the failed disk write data and rewrites the detailed information to the disk, providing an error handling mechanism to ensure that the write operation can be properly handled when encountering problems. The system improves the fault tolerance of the system. After the processing steps are completed, the data is rewritten to the disk, which helps prevent data loss and ensures data integrity and persistent storage. By asynchronously loading and regularly analyzing disk data, matching and identifying are performed according to the operation type, and detecting potential resource leakage according to the matching results, thereby identifying the type of resource leakage and the cause of resource leakage. According to the type name and reference chain in the custom information of the detailed information, the associated information of the resource leakage is analyzed, including: using SQL statements to count the objects corresponding to the type name in the custom information to determine whether there is resource abuse; based on the reference chain in the custom information, using SQL statements to analyze the "reference chain" relationship, digging out the reference relationship between the objects with problems, and for different types of leakage, extending different fields, so as to facilitate digging out a series of other objects referenced behind the object according to the reference chain, which is conducive to better counting the problem of resource leakage and solving it in a targeted manner; obtaining analysis results, and displaying the final analysis results to the user by performing SQL query and data processing on the analysis results. The system provides interface support, allowing users to use custom SQL statements for flexible and multi-dimensional statistics and analysis, improving the applicability and flexibility of the system, so as to adapt to different needs and occasions.
[0074] Therefore, the embodiments of the present invention can achieve the following beneficial effects: by separating the data recording and analysis links, using multi-threading technology to perform data writing operations, independently running the analysis link from the main program, avoiding preemption of hardware resources and competition for monitored program resources, reducing resource overhead and system crash risks, and improving system performance and stability; in the data recording link, by writing data to the disk in a timely manner, it helps prevent data loss, ensures data persistence, and guarantees data integrity and recoverability; using Sqlite as a data storage solution can meet the needs of use in a variety of programming environments and operating systems, thereby achieving cross-platform and cross-language capabilities, and can flexibly control the read and write timing and the life cycle of the handle, and improve disk I / O efficiency The rate is high; in the data analysis link, users are allowed to use customized SQL statements for flexible and multi-dimensional statistics and analysis, so that data can be analyzed from different angles, improving data scalability and flexibility, and supporting monitoring of various resource leakage types to adapt to different needs and occasions; providing interface support to facilitate users to view graphical analysis results, enhance user interaction experience, and provide SQL statement templates to facilitate users to imitate and migrate to their own analysis work. The system function is simple and easy to use; in addition, the data storage format of the present invention is compatible with the commonly used analysis solutions of artificial intelligence, which facilitates the introduction of AI technology for more advanced data analysis and early warning, and improves the ability to mine and solve resource leakage problems.
[0075] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A resource leakage monitoring method, characterized in that: Includes steps: S1. Record detailed information of the operation instruction according to the operation instruction, format and convert the detailed information and add it to the buffer, wherein the detailed information includes general information and custom information, wherein the general information includes the operation type, and the custom information includes the type name and the reference chain; S2. If the disk writing time reaches a time threshold or the capacity of the buffer reaches a capacity threshold, the detailed information is written to the disk by executing a callback function; S3. Read disk data regularly in an asynchronous loading manner, perform pairing judgment according to the operation type in the general information of the detailed information, and if there are unpaired "apply" and "release" operation types, determine it as a potential resource leak, and analyze the associated information of the resource leak according to the type name and reference chain in the custom information of the detailed information.
2. A resource leakage monitoring method according to claim 1, characterized in that: The step S2 further comprises: If the detailed information fails to be written to the disk, the write-to-disk failure data is returned to the buffer by executing the callback function, and the buffer processes the write-to-disk failure data and rewrites the detailed information to the disk.
3. A resource leakage monitoring method according to claim 2, characterized in that: The step S1 includes: Initialize the system and listen for operation instructions, wherein the initialization operation includes setting a time threshold and setting a callback function for the buffer.
4. A resource leakage monitoring method according to claim 1, characterized in that: Analyze the associated information of the resource leak according to the type name and reference chain in the custom information of the detailed information, including: By using SQL statements, count the objects corresponding to the type names in the custom information to determine whether there is resource abuse; Based on the reference chain in the custom information, the "reference chain" relationship is analyzed using SQL statements to mine the reference relationship between the objects with problems.
5. A resource leakage monitoring method according to claim 1, characterized in that: The step S3 further includes: Obtain analysis results, perform SQL query and data processing on the analysis results, and present the final analysis results to the user.
6. A resource leakage monitoring terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the following steps are implemented: S1. Record detailed information of the operation instruction according to the operation instruction, format and convert the detailed information and add it to the buffer, wherein the detailed information includes general information and custom information, wherein the general information includes the operation type, and the custom information includes the type name and the reference chain; S2. If the disk writing time reaches a time threshold or the capacity of the buffer reaches a capacity threshold, the detailed information is written to the disk by executing a callback function; S3. Read disk data regularly in an asynchronous loading manner, perform pairing judgment according to the operation type in the general information of the detailed information, and if there are unpaired "apply" and "release" operation types, determine it as a potential resource leak, and analyze the associated information of the resource leak according to the type name and reference chain in the custom information of the detailed information.
7. A resource leakage monitoring terminal according to claim 6, characterized in that: The step S2 further comprises: If the detailed information fails to be written to the disk, the write-to-disk failure data is returned to the buffer by executing the callback function, and the buffer processes the write-to-disk failure data and rewrites the detailed information to the disk.
8. A resource leakage monitoring terminal according to claim 7, characterized in that: The step S1 includes: Initialize the system and listen for operation instructions, wherein the initialization operation includes setting a time threshold and setting a callback function for the buffer.
9. A resource leakage monitoring terminal according to claim 6, characterized in that: Analyze the associated information of the resource leak according to the type name and reference chain in the custom information of the detailed information, including: By using SQL statements, count the objects corresponding to the type names in the custom information to determine whether there is resource abuse; Based on the reference chain in the custom information, the "reference chain" relationship is analyzed using SQL statements to mine the reference relationship between the objects with problems.
10. A resource leakage monitoring terminal according to claim 6, characterized in that: The step S3 further includes: Obtain analysis results, perform SQL query and data processing on the analysis results, and present the final analysis results to the user.
Citation Information
Patent Citations
Memory leak detection method
CN101814049A
Detection method for texture resource configuration of virtual reality software, and storage medium
CN108287791A
Mobile terminal TCP communication method and device, equipment and storage medium
CN113645308A
Memory leak detection method and device, equipment and storage medium
CN116610569A
Method and apparatus for detecting memory access errors
US5590329A
