Memory leak positioning method and device and intelligent operation and maintenance management equipment

By sampling dynamic memory multiple times within the preset historical time period, analyzing the number of unreleased and released marking points, the problem of low memory leakage positioning efficiency in the existing technology is solved, and more efficient memory leakage positioning is achieved.

CN119690652AActive Publication Date: 2025-03-25KEHUA DATA CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411728237.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-03-25
Estimated Expiration
2044-11-28

AI Technical Summary

Technical Problem

The prior art is inefficient in locating memory leaks, and needs to wait for the program to be completed or manually analyze logs, resulting in a long detection cycle and a large workload.

Method used

By performing multiple memory samplings on dynamic memory within the preset historical time period, we obtain opening points, marking points and status parameters, and analyze the number change patterns of unreleased and released marking points, thereby determining the memory leakage point.

Benefits of technology

Improve the efficiency of memory leakage positioning, ensure the comprehensiveness of data through multiple sampling, and quickly reduce the leakage area by analyzing the pattern of changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690652A_ABST
    Figure CN119690652A_ABST
Patent Text Reader

Abstract

The invention provides a memory leak positioning method and device and intelligent operation and maintenance management equipment. Comprising the following steps: acquiring a plurality of memory sampling results obtained by performing multiple memory sampling on the dynamic memory in a preset historical time period; the memory sampling result comprises a development point set of the dynamic memory, a mark point set corresponding to each development point in the development point set and a state parameter of each mark point in the mark point set; for each memory sampling result, determining a first number of unreleased mark points and a second number of released mark points corresponding to each opening point in the opening point set based on the state parameters; determining a first change rule of the first number and a second change rule of the second number according to a time sequence of memory sampling; and determining a memory leak point of the dynamic memory from the opening point set based on the first change rule and the second change rule. By determining and analyzing the first change rule and the second change rule, the memory leak positioning efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a memory leak location method, device and intelligent operation and maintenance management equipment. Background Art

[0002] Memory leak means that the dynamically allocated heap memory in the program is not released or cannot be released for some reason, resulting in a waste of system memory, causing serious consequences such as slowing down the program or even system crash. After a memory leak occurs, it is necessary to promptly and accurately determine the leak point where the memory leak occurred.

[0003] In the related art, memory leak location tools are used to detect memory leak points. However, the memory leak location tools cannot output memory leak points until the entire program is finished running, or the log information of the program running needs to be parsed. By manually analyzing possible memory leak points, the detection cycle is long and the workload is large, resulting in low efficiency in memory leak location. Summary of the invention

[0004] The embodiments of the present application provide a memory leak location method, device, and intelligent operation and maintenance management equipment, which can improve the efficiency of memory leak location by determining and analyzing a first change rule and a second change rule.

[0005] The technical solution of the embodiment of the present application is implemented as follows:

[0006] An embodiment of the present application provides a memory leak locating method, the method comprising: obtaining multiple memory sampling results obtained by performing multiple memory sampling on dynamic memory within a preset historical time period; the memory sampling results include a development point set of the dynamic memory, a mark point set corresponding to each development point in the development point set, and a state parameter of each mark point in the mark point set; for each of the memory sampling results, based on the state parameters, determining a first number of unreleased mark points corresponding to each development point in the development point set and a second number of released mark points corresponding to each development point; determining a first change rule of the first number and a second change rule of the second number of each development point according to the time sequence of the memory sampling; and determining a memory leak point of the dynamic memory from the development point set based on the first change rule and the second change rule.

[0007] An embodiment of the present application provides a memory leak locating device, including: an acquisition module, used to acquire state parameters and rotation parameters of a robot's observed part at a first moment; and to acquire multiple memory sampling results obtained by performing multiple memory sampling on a dynamic memory within a preset historical time period; the memory sampling results include a development point set of the dynamic memory, a set of marking points corresponding to each development point in the development point set, and the number of state parameters of each marking point in the marking point set; a first determination module, used to determine, for each of the memory sampling results, based on the state parameters, a first number of unreleased marking points corresponding to each development point in the development point set and a second number of released marking points corresponding to each development point; a second determination module, used to determine, according to the time sequence of the memory sampling, a first change law of the first number and a second change law of the second number of each development point; and a third determination module, used to determine the memory leak point of the dynamic memory from the development point set based on the first change law and the second change law.

[0008] In the above scheme, the third determination module is also used to: determine the memory leakage probability of each development point in the development point set based on the first change law and the second change law; and determine the memory leakage point of the dynamic memory from the development point set based on the memory leakage probability.

[0009] In the above scheme, the third determination module is also used to: determine a first number sequence of unreleased marking points corresponding to each development point and a second number sequence of released marking points corresponding to each development point from the multiple memory sampling results; when the first change rule of the first development point in the development point set is that the first number in the first number sequence remains stable, determine the memory leakage probability of the first development point to be the first probability; the first development point is any development point in the development point set; when the first change rule of the first development point is that the first number in the first number sequence has a fluctuating state, and the second change rule of the first development point is that the second number in the second number sequence has a growing state, determine the memory leakage probability of the first development point to be the second probability; when the first change rule of the first development point is that the first number in the first number sequence has a growing state, and the second change rule of the first development point is that the growth rate of the second number in the second number sequence is less than the growth rate threshold, determine the memory leakage probability of the first development point to be the third probability; wherein, the third probability is greater than the second probability, and the second probability is greater than the first probability.

[0010] In the above scheme, the third determination module is also used to: determine a first difference between the maximum value and the minimum value of the first quantity in the first quantity sequence; when it is determined based on the first difference that the first quantity in the first quantity sequence remains in a stable state, and the first development point satisfies a first preset condition, determine that the memory leakage probability of the first development point is a first probability; wherein, the first quantity remains in a stable state including: the first difference is less than a preset difference threshold; the first preset condition includes: the first number of unreleased marking points in the first development point is less than the first number threshold, the creation time of all marking points in the marking point set corresponding to the first development point are in the initialization process of the target program, the second number of released marking points in the first development point is greater than zero, and the creation time of all released marking points is earlier than the first creation time; the first creation time is the latest creation time among the unreleased marking points.

[0011] In the above scheme, the third determination module is also used to: determine the first difference between the maximum value and the minimum value of the first quantity in the first quantity sequence, and the second difference between the second second quantity and the first second quantity in each two adjacent second quantities in the second quantity sequence; when it is determined based on the first difference that the first quantity in the first quantity sequence has a fluctuating state, and based on the second difference that the second quantity in the second quantity sequence has a growing state, and when the first opening point satisfies the second preset condition, determine that the memory leakage probability of the first opening point is the second probability; wherein, the first quantity having a fluctuating state includes: the first difference is greater than or equal to a preset difference threshold; the second quantity having a growing state includes: the second difference is greater than zero; the second preset condition includes: there is a creation time in the mark point set corresponding to the first opening point that is during the running process of the target program.

[0012] In the above scheme, the third determination module is also used to: determine the mean and standard deviation of the first quantity in the first quantity sequence, and the third difference between the second second quantity and the first second quantity in each two adjacent second quantities in the second quantity sequence; when it is determined that the first quantity in the first quantity sequence has a fluctuating state based on the mean and the standard deviation, and the second quantity in the second quantity sequence has a continuous growth state based on the third difference, and the first opening point satisfies the third preset condition, determine that the memory leakage probability of the first opening point is the second probability; wherein, the first quantity has a fluctuating state including: the ratio of the standard deviation to the mean is greater than the preset ratio threshold; the second quantity has a continuous growth state including: the third difference is greater than zero; the second preset condition includes: there is a creation time in the mark point set corresponding to the first opening point that is during the running process of the target program.

[0013] In the above scheme, the third determination module is also used to: determine the fourth difference between the second first quantity and the first first quantity in every two adjacent first quantities in the first quantity sequence, and the fifth difference between the second second quantity and the first second quantity in every two adjacent second quantities in the second quantity sequence; when it is determined based on the fourth difference that the first quantity in the first quantity sequence has a growth state, and it is determined based on the fifth difference that the growth rate of the second quantity in the second quantity sequence is less than the growth rate threshold, and the first opening point satisfies the fourth preset condition, determine that the memory leakage probability of the first opening point is the third probability; wherein, the first quantity has a growth state including: the fourth difference is greater than zero; the fourth preset condition includes: the first number of unreleased mark points in the first opening point is greater than the second quantity threshold.

[0014] In the above scheme, the device also includes a fourth determination module, which is used to: perform stubbing in the target program through a preset dynamic memory allocation function to generate the development point information of the development point; determine the dynamic memory unit corresponding to the development point and the address information of the dynamic memory unit; determine the first address file generated based on the address information as the marking point corresponding to the development point; or, when the target program runs to the development point, determine the second address file generated based on the address information as the marking point corresponding to the development point; each of the development points corresponds to at least one marking point.

[0015] An embodiment of the present application provides an intelligent operation and maintenance management device, including: a memory for storing computer executable instructions; a processor for executing the computer executable instructions stored in the memory to implement the memory leak location method provided in the embodiment of the present application.

[0016] An embodiment of the present application provides a computer-readable storage medium storing a computer program or executable instructions. When the computer program or computer executable instructions are executed by a processor, the memory leak location method provided in the embodiment of the present application is implemented.

[0017] An embodiment of the present application provides a computer program product, which includes computer executable instructions, and the computer executable instructions are stored in a computer-readable storage medium; wherein, when the processor of the intelligent operation and maintenance management device reads the computer executable instructions from the computer-readable storage medium and executes the computer executable instructions, the memory leak location method provided in the embodiment of the present application is implemented.

[0018] The embodiments of the present application have the following beneficial effects:

[0019] When locating a memory leak, first, multiple memory sampling results obtained by performing multiple memory sampling on the dynamic memory within a preset historical time period are obtained; the memory sampling results include a set of development points of the dynamic memory, a set of marking points corresponding to each development point in the development point set, and a state parameter of each marking point in the marking point set; then, for each memory sampling result, based on the state parameter, a first number of unreleased marking points corresponding to each development point in the development point set and a second number of released marking points corresponding to each development point are determined; then, according to the time sequence of the memory sampling, a first change rule of the first number and a second change rule of the second number of each development point are determined; finally, based on the first change rule and the second change rule, the memory leak point of the dynamic memory is determined from the development point set. In this way, multiple memory samplings are performed within the preset historical time period, so that the state that changes with time during the use of the dynamic memory can be captured. Multiple samplings can ensure the comprehensiveness of the data, so that the first change rule and the second change rule determined according to the sampling results are more accurate. At the same time, by analyzing the first change rule and the second change rule, the area where the memory leak may exist can be quickly narrowed, thereby improving the efficiency of locating the memory leak. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is an optional flowchart of the memory leak location method provided in the embodiment of the present application;

[0021] Figure 2 It is a schematic diagram of a process of generating development points and marking points corresponding to the development points provided in an embodiment of the present application;

[0022] Figure 3 It is a schematic diagram of the correspondence between the development points and the marking points provided in the embodiment of the present application;

[0023] Figure 4 It is a schematic diagram of a process of determining a memory leak point of a dynamic memory from a development point set based on a first change rule and a second change rule provided by an embodiment of the present application;

[0024] Figure 5 It is a schematic diagram of a process for determining the memory leakage probability of each development point in the development point set based on the first change rule and the second change rule provided in an embodiment of the present application;

[0025] Figure 6 It is a structural block diagram of a memory leak locating device provided in an embodiment of the present application;

[0026] Figure 7 It is a structural diagram of the intelligent operation and maintenance management device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0028] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0029] If similar descriptions of "first / second" appear in the application documents, the following instructions are added. In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0030] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0031] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0032] The embodiment of the present application provides a memory leak location method. When performing memory leak location, first, multiple memory sampling results obtained by performing multiple memory sampling on dynamic memory within a preset historical time period are obtained; the memory sampling results include a development point set of the dynamic memory, a set of marking points corresponding to each development point in the development point set, and a state parameter of each marking point in the marking point set; then, for each memory sampling result, based on the state parameter, a first number of unreleased marking points corresponding to each development point in the development point set and a second number of released marking points corresponding to each development point are determined; then, according to the time sequence of memory sampling, a first change rule of the first number of each development point and a second change rule of the second number are determined; finally, based on the first change rule and the second change rule, a memory leak point of the dynamic memory is determined from the development point set. In this way, multiple memory samplings are performed within a preset historical time period, so that the state that changes with time during the use of dynamic memory can be captured. Multiple samplings can ensure the comprehensiveness of the data, so that the first change rule and the second change rule determined according to the sampling results are more accurate. At the same time, by analyzing the first change rule and the second change rule, the area where the memory leak may exist can be quickly narrowed, thereby improving the efficiency of memory leak location.

[0033] The memory leak location method provided in the embodiment of the present application can be applied to intelligent operation and maintenance management devices such as laptops, tablet computers, and desktop computers for implementing intelligent operation and maintenance management. The embodiment of the present application does not impose any restrictions on the specific type of intelligent operation and maintenance management devices.

[0034] The memory leak location method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0035] Figure 1 This is an optional flow chart of the memory leak location method provided in the embodiment of the present application, which can be applied to the intelligent operation and maintenance management device. The following will take the intelligent operation and maintenance management device as an example for exemplary description. Figure 1 As shown, the method includes the following steps S101 to S104:

[0036] Step S101, obtaining multiple memory sampling results obtained by performing multiple memory sampling on the dynamic memory within a preset historical time period; the memory sampling results include a development point set of the dynamic memory, a marking point set corresponding to each development point in the development point set, and a state parameter of each marking point in the marking point set.

[0037] The preset historical time period refers to a pre-set time range before the current moment; dynamic memory refers to a memory block dynamically allocated by the operating system or memory manager according to the program's request when the program is running. Dynamic memory allows the program to flexibly allocate it as needed; memory sampling refers to the process of capturing and recording the current memory usage status of the system by the program at a certain point in time, where memory sampling can be real-time, periodic or triggered by an event. The specific memory sampling method is not limited in this application.

[0038] The opening point refers to the source code location in the program where the dynamic memory application interface is called to open dynamic memory; the marking point refers to the address file generated based on the address information of the dynamic memory opened through the opening point; the status parameters of the marking point include whether the current marking point is released, the creation time of the current marking point, etc. The specific status parameters are not limited in this application.

[0039] In some embodiments, a timer function can be used in the program to control the time interval for memory sampling. The specific time interval can be flexibly set according to actual needs, such as every 30 minutes, every hour, etc.; after the preset time interval is reached, the dynamic memory in the system is sampled and the sampling results are stored in a log file or database. The server can obtain multiple memory sampling results within a preset historical time period in the log file or database.

[0040] It should be noted that, through step S101, multiple memory sampling results of the dynamic memory within a preset historical time period are obtained, so that the server can capture the dynamic changes of dynamic memory allocation and release, and multiple samplings can ensure the comprehensiveness of the data, and are no longer limited to static analysis at a certain point in time, providing more reliable data support for subsequent processing.

[0041] In some embodiments, before obtaining multiple memory sampling results obtained by performing multiple memory sampling on the dynamic memory within a preset historical time period, it is necessary to generate a development point and a marking point corresponding to the development point. Figure 2 , Figure 2 This is a schematic diagram of a process for generating development points and marking points corresponding to the development points provided by an embodiment of the present application, which can be implemented by the following steps S201 to S203:

[0042] Step S201, stubbing is performed in the target program through a preset dynamic memory allocation function to generate the development point information of the development point.

[0043] Dynamic memory allocation function refers to the standard or custom memory allocation function used when allocating memory in a program, wherein standard dynamic memory allocation functions include malloc(), calloc(), and realloc(), etc., and the memory allocation function of the custom function refers to the custom memory management function created by the developer based on the standard memory allocation function, which can provide more fine-grained control. Piling refers to inserting additional code into the program to record or detect the state of the program when it is running, wherein the piling code does not change the main function of the program, but can provide information about memory, performance, and logs. Opening point information refers to a detailed record of the opening point, including the allocated memory address, size, time, etc. The specific opening point information is not limited in this application.

[0044] In some embodiments, the developer may create a custom memory allocation function my_malloc() based on the standard memory allocation function malloc(); then, insert the custom memory allocation function into the code location where memory allocation is required, and when the code executes to the my_malloc() function, the development point information is generated.

[0045] Step S202, determining the dynamic memory unit corresponding to the development point and the address information of the dynamic memory unit.

[0046] In some embodiments, after generating the development point information, the server parses the development point information to generate the dynamic memory unit corresponding to the development point and the address information of the dynamic memory unit. For example, the server parses the development point information to determine that the memory management system allocates 400 bytes of dynamic memory, and the address of the dynamic memory is 0xfffe4c93e60.

[0047] Step S203, determine the first address file generated based on the address information as the marking point corresponding to the development point; or, when the target program runs to the development point, determine the second address file generated based on the address information as the marking point corresponding to the development point; each development point corresponds to at least one marking point.

[0048] The first address file and the second address file refer to files generated based on the address information of the dynamic memory unit and named after the address information of the dynamic memory unit; wherein, the first address file and the second address file may be address files for the same development point, but the address information corresponding to the first address file and the second address file is different.

[0049] In some embodiments, there are two ways to generate a marking point. The first way is: when generating a development point, a first address file is generated according to the address information of the dynamic memory unit corresponding to the development point, and the first address file is used as a marking point. The second way is: during the program running process, when the target program runs to the development point, a second address file is generated according to the address information of the memory unit allocated by the development point, and the second address file is used as the marking point corresponding to the development point.

[0050] It should be noted that during the program running process, a development point can be run multiple times. Each time the program runs to the same development point, a marking point is generated. The marking points generated by running the same development point multiple times are different. That is, a development point can correspond to multiple marking points, but a marking point can only correspond to one development point. Figure 3 , Figure 3 A schematic diagram of the correspondence between development points and marking points provided in an embodiment of the present application, wherein the target program 301 includes development point 1 and development point 2, the target program 302 includes development point 3, and the dynamic memory usage 303 includes marking point 1, marking point 2, marking point 3, marking point 4 and marking point 5, wherein marking point 5 is a released marking point and is in a removed state; development point 1 corresponds to two marking points, namely marking point 1 and marking point 5, development point 2 corresponds to one marking point, namely marking point 4, and development point 3 corresponds to two marking points, namely marking point 2 and marking point 3.

[0051] Here, the dynamic memory generated by opening points is invisible. An address file is generated according to the address information of the dynamic memory unit, and the address file is used as a marking point to convert the dynamic memory unit into a file visible to the naked eye, thereby realizing the visualization of the dynamic memory.

[0052] Step S102, for each memory sampling result, based on the state parameter, determining a first number of unreleased marking points corresponding to each development point in the development point set and a second number of released marking points corresponding to each development point.

[0053] In some embodiments, for example, there is a target program A, and target program A performs multiple memory allocation and memory release operations during operation. Memory sampling is performed on target program A three times within a preset historical time period. There are three development points in the development point set, namely A, B, and C. The first memory sampling is performed at time point T1, wherein development point A has a marking point 1, and the state parameter of marking point 1 is not released; development point B has a marking point 2, and the state parameter of marking point 2 is not released; development point C has a marking point 3, and the state parameter of marking point 3 is not released; then the second memory sampling is performed at time point T2. Sampling, where there is a marking point 1 at the development point A, and the status parameter of marking point 1 is not released; there is a marking point 2 at the development point B, and the status parameter of marking point 2 is released; there is a marking point 3 at the development point C, and the status parameter of marking point 3 is not released; then, the third memory sampling is performed at time point T3, where there is a marking point 1 at the development point A, and the status parameter of marking point 1 is not released. At the same time, there is a marking point 4 at the development point A, and the status parameter of marking point 4 is released; there is a marking point 2 at the development point B, and the status parameter of marking point 2 is released; there is a marking point 3 at the development point 3, and the status parameter of marking point 3 is not released. Finally, for each sampling result, according to the state parameters of each marking point, determine the first number of unreleased marking points and the second number of released marking points corresponding to each opening point; for example, for the first memory sampling result: the first number of unreleased marking points corresponding to opening point A is 1, and the number of released marking points is 0; the first number of unreleased marking points corresponding to opening point B is 1, and the number of released marking points is 0; the first number of unreleased marking points corresponding to opening point C is 1, and the number of released marking points is 0; for the second memory sampling result: the first number of unreleased marking points corresponding to opening point A is 1, and the number of released marking points is 0. The first number is 1, and the number of released marking points is 0; the first number of unreleased marking points corresponding to the development point B is 0, and the number of released marking points is 1; the first number of unreleased marking points corresponding to the development point C is 1, and the number of released marking points is 0; for the three memory sampling results: the first number of unreleased marking points corresponding to the development point A is 1, and the number of released marking points is 1; the first number of unreleased marking points corresponding to the development point B is 0, and the number of released marking points is 1; the first number of unreleased marking points corresponding to the development point C is 1, and the number of released marking points is 0.

[0054] Step S103, determining a first change rule of the first quantity and a second change rule of the second quantity of each development point according to the time sequence of memory sampling.

[0055] The first change rule refers to the change trend of the number of unreleased marking points corresponding to the opening point as time goes by; the second change rule refers to the change trend of the number of released marking points corresponding to the opening point as time goes by.

[0056] In some embodiments, for example, three memory samplings are performed on the opening point A in the target program. At the first sampling (T1), the number of unreleased marking points is 2, and the number of released marking points is 0; at the second sampling (T2), the number of unreleased marking points is 4, and the number of released marking points is 1; at the third sampling (T3), the number of unreleased marking points is 6, and the number of released marking points is 1; at the fourth sampling (T4), the number of unreleased marking points is 8, and the number of released marking points is 1; then from T1 to T4, the first change rule of the first number corresponding to the unreleased marking points is a linear increase, and the second change rule of the second number corresponding to the released marking points is to increase to 1 and then remain stable.

[0057] Step S104: determining a memory leak point of the dynamic memory from the development point set based on the first change rule and the second change rule.

[0058] A memory leak point refers to a mark point in the program where memory is allocated but not released. If the memory is not released in time after allocation, the unreleased memory blocks will continue to increase over time, which will cause a memory leak.

[0059] In some embodiments, the server can determine the leakage point that may cause memory leakage from the development point set by analyzing the change pattern of the number of unreleased marking points and released marking points corresponding to the development point over time.

[0060] In some embodiments, see Figure 4 , Figure 4 is a flow chart of determining a memory leak point of a dynamic memory from a development point set based on a first change rule and a second change rule provided by an embodiment of the present application, Figure 4 It is shown that in step S104, based on the first change rule and the second change rule, the memory leak point of the dynamic memory is determined from the development point set, which can be achieved by the following steps S1041 to S1042:

[0061] Step S1041, determining the memory leakage probability of each development point in the development point set based on the first change rule and the second change rule.

[0062] In some embodiments, the memory leak probability is a measure of the possibility of memory leak occurring at each development point. The server determines the possibility of memory leak occurring at each development point by analyzing the memory allocation and memory release conditions of each development point.

[0063] In some embodiments, see Figure 5 , Figure 5is a flow chart of determining the memory leakage probability of each development point in the development point set based on the first change rule and the second change rule provided in an embodiment of the present application, Figure 5 It is shown that in step S1041, based on the first change rule and the second change rule, the memory leakage probability of each development point in the development point set is determined, which can be achieved by the following steps S10411 to S10414:

[0064] Step S10411, determining a first quantity sequence of unreleased marking points corresponding to each development point and a second quantity sequence of released marking points corresponding to each development point from a plurality of memory sampling results.

[0065] The first quantity sequence refers to the sequence of the first quantity of unreleased marking points corresponding to the opening point changing over time within a preset historical time period; the second quantity sequence refers to the sequence of the second quantity of released marking points corresponding to the opening point changing over time within a preset historical time period.

[0066] In some embodiments, memory sampling is performed three times on the opening point A, and the number of unreleased marking points and the number of released marking points at the three samplings are: the first sampling: the number of unreleased marking points is 10, and the number of released marking points is 0; the second sampling: the number of unreleased marking points is 12, and the number of released marking points is 3; the third sampling: the number of unreleased marking points is 11, and the number of released marking points is 5; then the first number sequence is [10, 12, 11], and the second number sequence is [0, 3, 5].

[0067] Step S10412, when the first change rule of the first development point in the development point set is that the first number in the first number sequence remains stable, determine that the memory leakage probability of the first development point is the first probability; the first development point is any development point in the development point set.

[0068] The stable state means that within a preset historical time period, the first quantity in the first quantity sequence remains unchanged, or the first quantity remains constant or nearly constant within a certain range; the first probability refers to the probability value of the first development point being a memory leak point when the number of unreleased mark points corresponding to the first development point remains stable.

[0069] In some embodiments, step S10412 can be implemented by the following method: first, determine a first difference between the maximum value and the minimum value of the first quantity in the first quantity sequence; then, when it is determined based on the first difference that the first quantity in the first quantity sequence remains in a stable state, and the first development point satisfies a first preset condition, determine that the memory leakage probability of the first development point is a first probability; wherein the first quantity remains in a stable state includes: the first difference is less than a preset difference threshold; the first preset condition includes: the first number of unreleased mark points in the first development point is less than the first number threshold, the creation time of all mark points in the mark point set corresponding to the first development point are in the initialization process of the target program, the second number of released mark points in the first development point is greater than zero, and the creation time of all released mark points is earlier than the first creation time; the first creation time is the latest creation time among the unreleased mark points.

[0070] In some examples, it is assumed that the first quantity sequence corresponding to the first development point in the preset historical time period is [10, 12, 11], the second quantity sequence is [0, 3, 5], the preset difference threshold is 5, and the first quantity threshold is 15; then, the first difference between the maximum value and the minimum value of the first quantity in the first quantity sequence is calculated to be 12-10=2, and the first difference is less than the preset difference threshold, then it is determined that the first quantity in the first quantity sequence is in a stable state; next, it is determined whether the first development point meets the first preset condition, and the number of unreleased marking points in the first development point is 11, which is less than the first quantity. Threshold 15; the number of released marking points in the first development point is 5, and the second number of released marking points is greater than zero; and by parsing the marking points, it can be determined that all marking points are created during the initialization process of the target program, and the creation time of all released marking points is earlier than the latest creation time of the unreleased marking points, such as the creation time of released marking point 1 is 10:00, the creation time of released marking point 2 is 10:15, and the latest creation time of the unreleased marking points is 10:30, then the first development point meets the first preset condition; the memory leakage probability of the first development point can be determined as the first probability. It should be noted that if the memory leakage probability of the first development point is the first probability, it means that the possibility of the first development point being a memory leakage point is small.

[0071] Step S10413, when the first change rule of the first development point is that the first quantity in the first quantity sequence has a fluctuation state, and the second change rule of the first development point is that the second quantity in the second quantity sequence has an increase state, determine that the memory leakage probability of the first development point is the second probability.

[0072] The fluctuation state means that the first number in the first number sequence fluctuates with time, sometimes increasing and sometimes decreasing, showing an unstable trend. For example, the number of unreleased mark points at 10:00 is 5, the number of unreleased mark points at 10:05 is 8, and the number of unreleased mark points at 10:10 is 3, which means that the number of unreleased mark points in the time period of 10:00-10:10 is in a fluctuating state; the growth state means that the number of unreleased mark points at the second moment is greater than the number of unreleased mark points at the first moment, and the second moment is later than the first moment. For example, the number of unreleased mark points at 10:00 is 5, and the number of unreleased mark points at 10:05 is 6, which means that the number of unreleased mark points in the time period of 10:00-10:05 is in an increasing state; the second probability means that when the number of unreleased mark points corresponding to the first development point fluctuates with time and the number of released mark points continues to grow, the probability value of the first development point being a memory leak point.

[0073] In some embodiments, step S10413 can be implemented by the following method: first, determine the first difference between the maximum value and the minimum value of the first quantity in the first quantity sequence, and the second difference between the second second quantity and the first second quantity in each two adjacent second quantities in the second quantity sequence; then, when it is determined based on the first difference that the first quantity in the first quantity sequence has a fluctuating state, and based on the second difference that the second quantity in the second quantity sequence has a growing state, and the first development point satisfies the second preset condition, determine that the memory leakage probability of the first development point is the second probability; wherein the first quantity has a fluctuating state includes: the first difference is greater than or equal to the preset difference threshold; the second quantity has a growing state includes: the second difference is greater than zero; the second preset condition includes: there is a creation time in the mark point set corresponding to the first development point that is during the running process of the target program.

[0074] In some examples, it is assumed that the first quantity sequence corresponding to the first development point in the historical time period is [15, 20, 13, 19], the second quantity sequence is [5, 8, 10, 13], and the preset difference threshold is 5; then, the first difference between the maximum value and the minimum value of the first quantity in the first quantity sequence is calculated to be 20-13=7, and the first difference is greater than the preset difference threshold; then, the second difference between the second second quantity and the first second quantity in each adjacent second quantity in the second quantity sequence is calculated, 8-5=3, 10-8=2, 13-10=3, and the second difference is greater than zero; next, it is determined whether the first development point meets the second preset condition, and by parsing all the marking points in the marking point set, it can be determined that there are marking points whose creation time is in the running process of the target program in the marking point set corresponding to the first development point, then the first development point meets the second preset condition; the memory leakage probability of the first development point is determined to be the second probability. It should be noted that if the memory leakage probability of the first development point is the second probability, it means that the first development point may be a memory leakage point.

[0075] In some embodiments, step S10413 can also be implemented by the following method: first, determine the mean and standard deviation of the first quantity in the first quantity sequence, and the third difference between the second second quantity and the first second quantity in each two adjacent second quantities in the second quantity sequence; then, when it is determined based on the mean and standard deviation that the first quantity in the first quantity sequence has a fluctuating state, based on the third difference that the second quantity in the second quantity sequence has a continuous growth state, and the first development point satisfies the third preset condition, determine that the memory leakage probability of the first development point is the second probability; wherein, the first quantity has a fluctuating state including: the ratio of the standard deviation to the mean is greater than the preset ratio threshold; the second quantity has a continuous growth state including: the third differences are all greater than zero; the second preset condition includes: there is a creation time in the mark point set corresponding to the first development point that is during the running process of the target program.

[0076] In some examples, it is assumed that the first quantity sequence corresponding to the first development point in the historical time period is [30, 45, 40, 50], the second quantity sequence is [10, 20, 30, 40], and the preset ratio threshold is 0.15; then, the mean and standard deviation of the first quantity in the first quantity sequence are calculated, and the mean A=(30+45+40+50) / 4=41.25, and the standard deviation B=sqrt(((30-41.25) 2 +(45-41.25) 2 +(40-41.25) 2 +(50-41.25) 2) / 4)≈8.02, then, the ratio of the standard deviation B to the mean A is calculated to be 8.02 / 41.25≈0.19, and the ratio of the standard deviation to the mean is greater than the preset ratio threshold, which indicates that the first quantity has a fluctuating state; next, the third difference between the second second quantity and the first second quantity in each two adjacent second quantities in the second quantity sequence is calculated, 21-10=10, 30-20=10, 40-30=10, and the third differences are all greater than zero, and by parsing all the marking points in the marking point set, it can be determined that there is a marking point whose creation time is during the running process of the target program in the marking point set corresponding to the first development point, then the first development point meets the third preset condition; the memory leakage probability of the first development point is determined to be the second probability.

[0077] Step S10414, when the first change rule of the first development point is that the first number in the first number sequence has a growth state, and the second change rule of the first development point is that the growth rate of the second number in the second number sequence is less than the growth rate threshold, determine that the memory leakage probability of the first development point is the third probability; wherein the third probability is greater than the second probability, and the second probability is greater than the first probability.

[0078] The growth rate refers to the speed at which the number of released marking points increases within a preset historical time period; the growth rate threshold is a preset lower limit of the growth rate. Here, the probability value of the third probability is greater than the probability value of the second probability, and the probability value of the second probability is greater than the probability value of the first probability.

[0079] In some embodiments, step S10414 can be implemented by the following method: first, determine the fourth difference between the second first number and the first first number in every two adjacent first numbers in the first number sequence, and the fifth difference between the second second number and the first second number in every two adjacent second numbers in the second number sequence; then, when it is determined based on the fourth difference that the first number in the first number sequence has a growth state, it is determined based on the fifth difference that the growth rate of the second number in the second number sequence is less than the growth rate threshold, and the first opening point satisfies the fourth preset condition, determine that the memory leakage probability of the first opening point is the third probability; wherein, the first number has a growth state includes: the fourth difference is greater than zero; the fourth preset condition includes: the first number of unreleased mark points in the first opening point is greater than the second number threshold.

[0080] In some examples, it is assumed that the first quantity sequence corresponding to the first development point in the historical time period is [10, 20, 30], the second quantity sequence is [5, 6, 7], the second quantity threshold is 8, and the growth rate threshold is 3; then, the fourth difference between the second first quantity and the first first quantity of each two adjacent first quantities in the first quantity sequence is calculated, 20-10=10, 30-20=10, and the fourth difference is greater than zero; then, the fifth difference between the second second quantity and the first second quantity of each two adjacent second quantities in the second quantity sequence is calculated, 6-5=1, 7-6=1, and the growth rate of the second quantity is determined to be 1 according to the fifth difference, and the growth rate of the second quantity is less than the growth rate threshold. Next, it is determined whether the first development point meets the fourth preset condition. Since the second quantity threshold is 8, which is less than the first quantity in the first quantity sequence, it means that the first development point meets the fourth preset condition, and the memory leakage probability of the first development point is determined to be the third probability. It should be noted that if the memory leakage probability of the first development point is the third probability, it means that the possibility that the first development point is a memory leakage point is the greatest.

[0081] Step S1042, based on the memory leakage probability, determine the memory leakage point of the dynamic memory from the development point set.

[0082] In some embodiments, step S1042 can be implemented by the following method: first, sort the development points in the development point set in order of memory leakage probability from large to small to form a development point sequence; then, perform memory leakage analysis on the third number of development points in the development point sequence in turn to obtain memory leakage points of the dynamic memory.

[0083] In some embodiments, for the development point A with the highest probability of leakage, all marking points corresponding to the development point A are obtained, wherein the marking point records the creation time of the marking point and the allocation address of the dynamic memory, etc. If the marking point 1 corresponding to the development point A is released through the preset dynamic memory release function, the marking point 1 is deleted or the file name of the marking point 1 is modified; the server determines the currently unreleased marking points through the names of the marking points, and parses the currently unreleased marking points, such as marking point 2, and calculates the time length from the creation time of marking point 2 to the current moment. If the time length is greater than the time length threshold, it means that marking point 2 occupies a long time and is not released in time; when the number of marking points that are not released in time is greater than the preset number threshold, the development point A is determined as a memory leakage point.

[0084] It should be noted that by calculating the probability of memory leaks at each development point, we can effectively filter out development points that are unlikely to have memory leaks, and focus on development points with high probabilities. The probability-based priority analysis method can greatly narrow the scope of memory leak investigation, avoid investigation at each development point, and improve the efficiency of memory leak locating.

[0085] The memory leak positioning method provided by the embodiment of the present application can be widely used in a variety of scenarios. For example, in the development and operation and maintenance process of large-scale software systems, the dynamic allocation and release of memory frequently occur. If some memory is not released correctly, it may cause memory leaks, affecting the stability and performance of the system. Through the memory leak positioning method provided by the embodiment of the present application, the memory leak point can be automatically and efficiently detected to avoid the problem of system crash or performance degradation caused by memory leaks. In embedded systems and IoT devices, there are usually limited memory resources. If a memory leak occurs, the system performance will deteriorate rapidly, and even cause device failure. The memory leak positioning method provided by the embodiment of the present application can timely determine the memory leak point, so that the developer can handle it in time, thereby improving the operating reliability and stability of the device. In the game development and operation environment, the use of memory is very frequent, especially in dynamic scene loading, graphics rendering, etc. If a memory leak occurs, it will affect the frame rate performance of the game and even cause the service system to crash. Through the memory leak positioning method of the embodiment of the present application, the memory usage during the game operation can be detected and analyzed, and the memory leak point can be quickly found, thereby ensuring the game performance and stability, and saving the time and cost of developers to manually troubleshoot problems.

[0086] The memory leak locating method provided in the embodiment of the present application performs multiple memory sampling within a preset historical time period, and can capture the state of dynamic memory that changes over time during use. Multiple samplings can ensure the comprehensiveness of the data, and are no longer limited to static analysis at a certain point in time, thereby making the first change law and the second change law determined according to the sampling results more accurate. At the same time, by calculating the probability of memory leaks at each development point, development points that are unlikely to have memory leaks can be effectively filtered out, and focus on development points with high probabilities. The probability-based priority analysis method can greatly narrow the scope of memory leak investigation, avoid investigation at multiple development points, and improve the efficiency of memory leak locating.

[0087] The following is an explanation of an exemplary application of an embodiment of the present application in a practical application scenario.

[0088] The memory leak location method provided in the embodiment of the present application can realize dynamic memory visualization and improve the efficiency of memory leak location. The specific scheme is divided into two parts.

[0089] Part I: Dynamic Memory Visualization.

[0090] First, stubbing is performed through the dynamic memory allocation function / release function to record the allocation point information, including the program file name and the line number where the allocation function / release function is located; then, when the memory is allocated through the dynamic memory allocation function, a file named with the dynamic memory address information is generated, and the file named with the dynamic memory address information is determined as a marking point to record the allocation point information, etc. When the dynamic memory is released, the marking point is removed or the marking point name is modified. Among them, the marking point is generated by the allocation point, one allocation point corresponds to multiple marking points, and one marking point corresponds to only one allocation point.

[0091] Part 2: Intelligent Analysis of Memory Leaks

[0092] First, multiple memory sampling results within a preset historical time period are obtained; then, the development point information is parsed, and the number of unreleased mark points and the number of released mark points at the same development point are counted to obtain the analysis results; finally, the memory leakage probability of each development point is determined based on the analysis results, and the corresponding development points are output in order of probability.

[0093] Next, the method of determining the memory leak probability of each development point based on the analysis results is described:

[0094] (1): Low probability (the first probability mentioned above) development point: Low probability development point is a development point created during the program initialization process, and is not released during the entire program running cycle (there may be initialization failure or repeated initialization). The judgment conditions for low probability development points are: in multiple memory sampling results, the number of unreleased marking points in the development points remains stable, and the number is less than the first number threshold (such as less than 5); the creation time of all marking points is during the program initialization process; and, if the number of released marking points is greater than zero, the creation time of all released marking points is earlier than the creation time of the latest marking point among all unreleased marking points.

[0095] (2): Medium probability (the second probability mentioned above) development point: The medium probability development point is a development point that is normally developed and released. The judgment conditions for the medium probability development point are: in multiple memory sampling results, the number of unreleased mark points in the development point fluctuates (the above-mentioned fluctuation state), and the mark point set corresponding to the development point contains mark points created during the program running process; and the number of released mark points has an increasing state.

[0096] (3): High probability (the third probability mentioned above) development point: A high probability development point is a development point that may be a memory leak point. The judgment conditions for a high probability development point are: in multiple memory sampling results, the number of unreleased mark points in the development point is increasing, and the number of unreleased mark points is greater than the second number threshold (such as greater than 50); and the growth rate of the number of released mark points is less than the growth rate threshold.

[0097] It should be noted that if a large number of markers have been released, the markers can be directly deleted when the dynamic memory is released.

[0098] The memory leak location method provided in the embodiment of the present application can determine the probability of a memory leak at each development point based on multiple sampling results, and prioritize the high-probability development points for investigation and location, thereby effectively narrowing the location range and improving the efficiency of memory leak location.

[0099] Based on the memory leak location method described in the above embodiment, Figure 6 A structural block diagram of a memory leak locating device 100 provided in an embodiment of the present application is shown. The memory leak locating device may be a device in an intelligent operation and maintenance management device (e.g., a server). The memory leak locating device may be implemented in software, which may be software in the form of programs and plug-ins, etc., including the following software modules: an acquisition module 101, a first determination module 102, a second determination module 103, and a third determination module 104. These modules are logical, and therefore may be arbitrarily combined or further split according to the functions implemented.

[0100] Among them, the acquisition module 101 is used to obtain the state parameters and rotation parameters of the robot's observed part at the first moment; and obtain multiple memory sampling results obtained by performing multiple memory sampling on the dynamic memory within a preset historical time period; the memory sampling results include a development point set of the dynamic memory, a marking point set corresponding to each development point in the development point set, and a state parameter of each marking point in the marking point set; the first determination module 102 is used to determine, for each memory sampling result, based on the state parameters, a first number of unreleased marking points corresponding to each development point in the development point set and a second number of released marking points corresponding to each development point; the second determination module 103 is used to determine, according to the time sequence of memory sampling, a first change law of the first number and a second change law of the second number of each development point; the third determination module 104 is used to determine the memory leakage point of the dynamic memory from the development point set based on the first change law and the second change law.

[0101] In some embodiments, the third determination module is also used to: determine the memory leakage probability of each development point in the development point set based on the first change law and the second change law; and determine the memory leakage point of the dynamic memory from the development point set based on the memory leakage probability.

[0102] In some embodiments, the third determination module is also used to: determine a first number sequence of unreleased mark points corresponding to each development point and a second number sequence of released mark points corresponding to each development point from the multiple memory sampling results; when the first change rule of the first development point in the development point set is that the first number in the first number sequence remains stable, determine the memory leakage probability of the first development point to be the first probability; the first development point is any development point in the development point set; when the first change rule of the first development point is that the first number in the first number sequence has a fluctuating state, and the second change rule of the first development point is that the second number in the second number sequence has a growing state, determine the memory leakage probability of the first development point to be the second probability; when the first change rule of the first development point is that the first number in the first number sequence has a growing state, and the second change rule of the first development point is that the growth rate of the second number in the second number sequence is less than the growth rate threshold, determine the memory leakage probability of the first development point to be the third probability; wherein, the third probability is greater than the second probability, and the second probability is greater than the first probability.

[0103] In some embodiments, the third determination module is also used to: determine a first difference between the maximum value and the minimum value of the first quantity in the first quantity sequence; when it is determined based on the first difference that the first quantity in the first quantity sequence remains in a stable state, and the first development point satisfies a first preset condition, determine that the memory leakage probability of the first development point is a first probability; wherein, the first quantity remains in a stable state including: the first difference is less than a preset difference threshold; the first preset condition includes: the first number of unreleased marking points in the first development point is less than the first number threshold, the creation time of all marking points in the marking point set corresponding to the first development point are in the initialization process of the target program, the second number of released marking points in the first development point is greater than zero, and the creation time of all released marking points is earlier than the first creation time; the first creation time is the latest creation time among the unreleased marking points.

[0104] In some embodiments, the third determination module is also used to: determine a first difference between the maximum and minimum values ​​of the first quantity in the first quantity sequence, and a second difference between the second second quantity and the first second quantity in each two adjacent second quantities in the second quantity sequence; when it is determined based on the first difference that the first quantity in the first quantity sequence has a fluctuating state, and based on the second difference that the second quantity in the second quantity sequence has a growing state, and when the first opening point satisfies a second preset condition, determine that the memory leakage probability of the first opening point is the second probability; wherein, the first quantity having a fluctuating state includes: the first difference is greater than or equal to a preset difference threshold; the second quantity having a growing state includes: the second difference is greater than zero; the second preset condition includes: there is a creation time in the mark point set corresponding to the first opening point that is during the running of the target program.

[0105] In some embodiments, the third determination module is also used to: determine the mean and standard deviation of the first quantity in the first quantity sequence, and the third difference between the second second quantity and the first second quantity in each two adjacent second quantities in the second quantity sequence; when it is determined that the first quantity in the first quantity sequence has a fluctuating state based on the mean and the standard deviation, and the second quantity in the second quantity sequence has a continuous growth state based on the third difference, and the first opening point satisfies the third preset condition, determine that the memory leakage probability of the first opening point is the second probability; wherein, the first quantity has a fluctuating state including: the ratio of the standard deviation to the mean is greater than a preset ratio threshold; the second quantity has a continuous growth state including: the third difference is greater than zero; the second preset condition includes: there is a creation time in the mark point set corresponding to the first opening point that is during the running of the target program.

[0106] In some embodiments, the third determination module is also used to: determine the fourth difference between the second first quantity and the first first quantity in every two adjacent first quantities in the first quantity sequence, and the fifth difference between the second second quantity and the first second quantity in every two adjacent second quantities in the second quantity sequence; when it is determined based on the fourth difference that the first quantity in the first quantity sequence has a growth state, and it is determined based on the fifth difference that the growth rate of the second quantity in the second quantity sequence is less than the growth rate threshold, and the first opening point satisfies the fourth preset condition, determine that the memory leakage probability of the first opening point is the third probability; wherein, the first quantity has a growth state including: the fourth difference is greater than zero; the fourth preset condition includes: the first number of unreleased mark points in the first opening point is greater than the second quantity threshold.

[0107] In some embodiments, the device also includes a fourth determination module, which is used to: perform stubbing in the target program through a preset dynamic memory allocation function to generate the development point information of the development point; determine the dynamic memory unit corresponding to the development point and the address information of the dynamic memory unit; determine the first address file generated based on the address information as the marking point corresponding to the development point; or, when the target program runs to the development point, determine the second address file generated based on the address information as the marking point corresponding to the development point; each of the development points corresponds to at least one marking point.

[0108] It should be noted that the description of the device of the embodiment of the present application is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment, so it is not repeated. For technical details not disclosed in the embodiment of the device, please refer to the description of the method embodiment of the present application for understanding.

[0109] The present application embodiment provides an intelligent operation and maintenance management device, Figure 7 Schematic diagram of the structure of the intelligent operation and maintenance management device provided in the embodiment of the present application. Figure 7 As shown, the intelligent operation and maintenance management device 130 includes: at least one processor 131 ( Figure 7 Only one is shown in the figure), a memory 132, and a computer executable instruction 133 stored in the memory 132 and executable on at least one processor 131. When the processor 131 executes the executable instruction 133, the steps in any of the above-mentioned memory leak location method embodiments are implemented.

[0110] The intelligent operation and maintenance management device may include but is not limited to a processor 131 and a memory 132. Those skilled in the art may understand that: Figure 7 It is only an example of the intelligent operation and maintenance management device 130 and does not constitute a limitation of the intelligent operation and maintenance management device 130. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.

[0111] The processor 131 may be a central processing unit (CPU), or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPG), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0112] In some embodiments, the memory 132 may be an internal storage unit of the intelligent operation and maintenance management device 130, such as a hard disk or memory of the intelligent operation and maintenance management device 130. In other embodiments, the memory 132 may also be an external storage device of the intelligent operation and maintenance management device 130, such as a plug-in hard disk, a smart memory card (SMC, Smart Media Card), a secure digital (SD, Secure Digital) card, a flash card, etc. equipped on the intelligent operation and maintenance management device 130. Further, the memory 132 may also include both an internal storage unit and an external storage device of the intelligent operation and maintenance management device 130. The memory 132 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program code of a computer program. The memory 132 may also be used to temporarily store data that has been output or is to be output.

[0113] The present application embodiment provides a computer-readable storage medium in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute the memory leak location method provided by the present application embodiment, for example, Figure 1 The memory leak location method shown.

[0114] The embodiment of the present application provides a computer program product, which includes computer executable instructions, which are stored in a computer-readable storage medium. The processor of the intelligent operation and maintenance management device reads the computer executable instructions from the computer-readable storage medium, and the processor executes the computer executable instructions, so that the intelligent operation and maintenance management device executes the memory leak location method described in the embodiment of the present application.

[0115] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.

[0116] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0117] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0118] As an example, computer executable instructions may be deployed to be executed on one intelligent operation and maintenance management device, or on multiple intelligent operation and maintenance management devices located at one location, or on multiple intelligent operation and maintenance management devices distributed at multiple locations and interconnected by a communication network.

[0119] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A memory leak location method, characterized in that: The method comprises: Acquire multiple memory sampling results obtained by performing multiple memory sampling on the dynamic memory within a preset historical time period; the memory sampling results include a development point set of the dynamic memory, a mark point set corresponding to each development point in the development point set, and a state parameter of each mark point in the mark point set; For each of the memory sampling results, based on the state parameter, determine a first number of unreleased marking points corresponding to each development point in the development point set and a second number of released marking points corresponding to each development point; Determine, according to the time sequence of the memory sampling, a first change rule of the first quantity and a second change rule of the second quantity of each development point; Based on the first change rule and the second change rule, a memory leak point of the dynamic memory is determined from the development point set.

2. The method according to claim 1, characterized in that: The determining the memory leakage point of the dynamic memory from the development point set based on the first change rule and the second change rule includes: Determine the memory leakage probability of each development point in the development point set based on the first change rule and the second change rule; Based on the memory leakage probability, a memory leakage point of the dynamic memory is determined from the development point set.

3. The method according to claim 2, characterized in that The determining, based on the first change rule and the second change rule, the memory leakage probability of each development point in the development point set includes: Determine, from the plurality of memory sampling results, a first quantity sequence of unreleased marking points corresponding to each development point and a second quantity sequence of released marking points corresponding to each development point; When a first change rule of a first development point in the development point set is that a first number in the first number sequence remains in a stable state, determining that the memory leakage probability of the first development point is a first probability; the first development point is any development point in the development point set; When a first change rule of the first development point is that the first quantity in the first quantity sequence has a fluctuation state, and a second change rule of the first development point is that the second quantity in the second quantity sequence has an increase state, determining that the memory leakage probability of the first development point is a second probability; When the first change rule of the first development point is that the first number in the first number sequence has an increasing state, and the second change rule of the first development point is that the growth rate of the second number in the second number sequence is less than the growth rate threshold, determining that the memory leakage probability of the first development point is a third probability; The third probability is greater than the second probability, and the second probability is greater than the first probability.

4. The method according to claim 3, characterized in that When a first change rule of a first development point in the development point set is that a first number in the first number sequence remains in a stable state, determining that the memory leakage probability of the first development point is a first probability includes: determining a first difference between a maximum value and a minimum value of a first quantity in the first sequence of quantities; When it is determined based on the first difference that the first quantity in the first quantity sequence remains in a stable state and the first development point satisfies a first preset condition, determining that the memory leakage probability of the first development point is a first probability; Among them, the first number remains in a stable state including: the first difference is less than a preset difference threshold; the first preset condition includes: the first number of unreleased marking points in the first development point is less than a first number threshold, the creation time of all marking points in the marking point set corresponding to the first development point is in the initialization process of the target program, the second number of released marking points in the first development point is greater than zero, and the creation time of all released marking points is earlier than the first creation time; the first creation time is the latest creation time among the unreleased marking points.

5. The method according to claim 3, characterized in that: When the first change rule of the first development point is that the first quantity in the first quantity sequence has a fluctuation state, and the second change rule of the first development point is that the second quantity in the second quantity sequence has an increase state, determining that the memory leakage probability of the first development point is the second probability includes: Determine a first difference between a maximum value and a minimum value of the first quantity in the first quantity sequence, and a second difference between a second second quantity and the first second quantity in every two adjacent second quantities in the second quantity sequence; When it is determined based on the first difference that the first quantity in the first quantity sequence has a fluctuating state, and it is determined based on the second difference that the second quantity in the second quantity sequence has an increasing state, and the first development point satisfies a second preset condition, determining that the memory leakage probability of the first development point is a second probability; Among them, the first number has a fluctuating state including: the first difference is greater than or equal to a preset difference threshold; the second number has an increasing state including: the second differences are all greater than zero; the second preset condition includes: the creation time in the mark point set corresponding to the first development point is during the running process of the target program.

6. The method according to claim 3, characterized in that When the first change rule of the first development point is that the first quantity in the first quantity sequence has a fluctuation state, and the second change rule of the first development point is that the second quantity in the second quantity sequence has a continuous growth state, determining that the memory leakage probability of the first development point is the second probability includes: Determine the mean and standard deviation of the first quantities in the first quantity sequence, and the third difference between the second second quantity and the first second quantity in every two adjacent second quantities in the second quantity sequence; When it is determined based on the mean and the standard deviation that the first quantity in the first quantity sequence has a fluctuating state, and based on the third difference that the second quantity in the second quantity sequence has a continuously growing state, and the first development point satisfies a third preset condition, determining that the memory leakage probability of the first development point is a second probability; Among them, the first number has a fluctuating state including: the ratio of the standard deviation to the mean is greater than the preset ratio threshold; the second number has a continuous growth state including: the third difference is greater than zero; the second preset condition includes: the creation time in the mark point set corresponding to the first opening point is during the running process of the target program.

7. The method according to claim 3, characterized in that When the first change rule of the first development point is that the first number in the first number sequence has an increasing state, and the second change rule of the first development point is that the growth rate of the second number in the second number sequence is less than the growth rate threshold, determining that the memory leakage probability of the first development point is a third probability, includes: Determine a fourth difference between the second first quantity and the first first quantity of every two adjacent first quantities in the first quantity sequence, and a fifth difference between the second second quantity and the first second quantity of every two adjacent second quantities in the second quantity sequence; When it is determined based on the fourth difference that the first quantity in the first quantity sequence has a growth state, and it is determined based on the fifth difference that the growth rate of the second quantity in the second quantity sequence is less than a growth rate threshold, and the first development point satisfies a fourth preset condition, determining that the memory leakage probability of the first development point is a third probability; Among them, the fact that the first number is in an increasing state includes: the fourth difference values ​​are all greater than zero; and the fourth preset condition includes: the first number of unreleased marking points in the first development point is greater than the second number threshold.

8. The method according to any one of claims 3 to 7, characterized in that: Before obtaining a plurality of memory sampling results obtained by performing a plurality of memory sampling operations on the dynamic memory within a preset historical time period, the method further includes: Piping is performed in the target program through a preset dynamic memory allocation function to generate the allocation point information of the allocation point; Determine the dynamic memory unit corresponding to the development point and address information of the dynamic memory unit; The first address file generated based on the address information is determined as the marking point corresponding to the development point; or, when the target program runs to the development point, the second address file generated based on the address information is determined as the marking point corresponding to the development point; each development point corresponds to at least one marking point.

9. A memory leak location device, characterized in that: include: An acquisition module is used to acquire the state parameters and rotation parameters of the robot's to-be-observed part at the first moment; and to acquire a plurality of memory sampling results obtained by performing multiple memory sampling on the dynamic memory within a preset historical time period; the memory sampling results include a development point set of the dynamic memory, a set of marking points corresponding to each development point in the development point set, and a state parameter of each marking point in the marking point set; A first determination module is used to determine, for each of the memory sampling results, based on the state parameter, a first number of unreleased marking points corresponding to each development point in the development point set and a second number of released marking points corresponding to each development point; A second determination module is used to determine a first change rule of the first quantity and a second change rule of the second quantity of each development point according to the time sequence of the memory sampling; The third determination module is used to determine the memory leakage point of the dynamic memory from the development point set based on the first change rule and the second change rule.

10. An intelligent operation and maintenance management device, characterized in that: include: A memory for storing computer executable instructions; A processor is used to implement the memory leak location method described in any one of claims 1 to 8 when executing the computer executable instructions stored in the memory.

Citation Information

Patent Citations

  • Method and apparatus for determining memory leakage position

    CN106933733A

  • Memory leak detection method, device and equipment

    CN111240954A

  • Memory leak detection method, electronic equipment and computer readable storage medium

    CN114546795A

  • Memory management system, leak detection method and storage medium

    CN115617504A

  • Method and apparatus for detecting a suspect memory leak

    US20130055034A1