Memory leak behavior detection method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202210113969.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-30
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2042-01-30
AI Technical Summary
[0003]内存泄露对于数据库,是存在一定的危害的,尤其是内存泄露不断堆积,会导致数据库的内存被全部占用,致使数据库无法正常工作,因此,需要防止内存泄露
[0019] The technical solution of this application embodiment uses a pre-trained classifier to determine the probability that a combination of behaviors will cause a memory leak based on system logs and the combinations of behaviors that generate those logs. Therefore, based on the probability, it can be determined whether the combination of behaviors is a memory leak-causing behavior. Based on this, this application can predict whether complex combinations of behaviors can cause memory leaks, which is a more comprehensive way to avoid memory leaks compared to current methods that can only avoid memory leaks caused by a single behavior.
Smart Images

Figure CN114443342B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of service invocation technology, and in particular to a method, apparatus, electronic device, and storage medium for detecting memory leak behavior. Background Technology
[0002] Data, as the cornerstone of the internet, has become increasingly important in its development, making its storage and utilization crucial. Currently, data is generally stored in databases, but databases are prone to common problems such as memory leaks.
[0003] Memory leaks can be harmful to databases, especially when they accumulate and can completely consume all the database's memory, causing the database to malfunction. Therefore, it is necessary to prevent memory leaks.
[0004] Currently, the basic way to prevent memory leaks is to avoid behaviors that may lead to memory leaks. This requires analyzing user behavior when interacting with the database. However, current analysis methods can only analyze individual behaviors and can only prevent memory leaks caused by a single behavior, but cannot comprehensively prevent memory leaks. Summary of the Invention
[0005] This application provides a method, apparatus, electronic device, and storage medium for detecting memory leaks, in order to more comprehensively avoid memory leak problems.
[0006] In a first aspect, embodiments of this application provide a method for detecting memory leak behavior, the method comprising:
[0007] A combination of actions that acquire system logs and generate those system logs;
[0008] The system logs and the behavior combination are input into a pre-trained classifier to obtain the probability that the behavior combination causes a memory leak, as output by the classifier.
[0009] If the probability is greater than a preset threshold, the combination of behaviors is determined to be a memory leak behavior that causes a memory leak.
[0010] Secondly, embodiments of this application also provide a memory leak detection device, which includes:
[0011] The acquisition module is used to acquire system logs and the combination of behaviors that generate the system logs;
[0012] A classification module is used to input the system log and the behavior combination into a pre-trained classifier to obtain the probability that the behavior combination causes a memory leak, as output by the classifier.
[0013] A memory leak behavior determination module is used to determine that the combination of behaviors constitutes a memory leak behavior that causes a memory leak if the probability is greater than a preset threshold.
[0014] Thirdly, embodiments of this application also provide an electronic device, the electronic device comprising:
[0015] One or more processors;
[0016] Storage device for storing one or more programs.
[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement a method for detecting memory leak behavior as provided in any embodiment of this application.
[0018] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, characterized in that, when the program is executed by a processor, it implements a method for detecting memory leak behavior as provided in any embodiment of this application.
[0019] The technical solution of this application embodiment uses a pre-trained classifier to determine the probability that a combination of behaviors will cause a memory leak based on system logs and the combinations of behaviors that generate those logs. Therefore, based on the probability, it can be determined whether the combination of behaviors is a memory leak-causing behavior. Based on this, this application can predict whether complex combinations of behaviors can cause memory leaks, which is a more comprehensive way to avoid memory leaks compared to current methods that can only avoid memory leaks caused by a single behavior. Attached Figure Description
[0020] Figure 1 A flowchart illustrating the memory leak detection method provided in Embodiment 1 of this application;
[0021] Figure 2 This is a flowchart illustrating a correlation analysis of memory leak behavior groups, provided as an embodiment of this application.
[0022] Figure 3 This is a schematic diagram of the structure of a memory leak detection device provided in Embodiment 2 of this application;
[0023] Figure 4 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of this application. Detailed Implementation
[0024] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present application, not the entire structure.
[0025] Database systems often experience memory leaks during use. These leaks are not caused by a single action, but rather by a pattern of actions that prevent the effective reclamation of acquired memory. While a single memory leak may be negligible, accumulated memory leaks can have severe consequences; regardless of the amount of memory available, it will eventually be exhausted. A basic approach to preventing memory leaks is to analyze user database operations and avoid high-risk operations. However, for complex combinations of actions, simply avoiding high-risk operations is insufficient. Furthermore, existing solutions are ineffective in preventing memory leaks when the action combinations do not contain any high-risk operations. To address this issue, this application proposes a memory leak behavior detection method, as detailed in the following embodiments.
[0026] Example 1
[0027] Figure 1 This is a flowchart illustrating the memory leak detection method provided in Embodiment 1 of this application. This embodiment is applicable to scenarios involving memory leak detection. The method can be executed by a memory leak detection device, which can be implemented in hardware and / or software and is generally integrated into electronic devices such as computers with data processing capabilities. Specifically, it includes the following steps:
[0028] Step 101: Obtain system logs and the combination of actions that generate system logs.
[0029] It should be noted that system logs refer to the records generated in a database system due to certain actions or operations performed on the database. System logs often record the actions performed on the database, such as adding, deleting, and modifying data, as well as the storage locations involved in those actions.
[0030] In addition, a combination of behaviors refers to a set of behaviors that can be in a specific order.
[0031] Step 102: Input the system logs and behavior combinations into a pre-trained classifier to obtain the probability that the behavior combinations output by the classifier will cause a memory leak.
[0032] This step involves a pre-trained classifier. Therefore, this embodiment may include the process of training the classifier, specifically by collecting pre-identified memory leak behavior groups and the logs generated by the memory leak behavior groups; and then training the classifier based on the memory leak behavior groups and the logs generated by the memory leak behavior groups.
[0033] It should be noted that the pre-identified memory leak behavior groups are combinations of behaviors analyzed by relevant personnel that could lead to memory leaks. The logs generated by the memory leak behavior groups are the logs produced after performing operations on the database according to the memory leak behavior groups.
[0034] The specific details are shown in Table 1 below:
[0035] Table 1
[0036] 1 Behavior 1, Behavior 2, Behavior 4 2 Behavior 2, Behavior 3, Behavior 5, Behavior 7, Behavior 8 3 Behavior 2, Behavior 3, Behavior 5, Behavior 9 4 Behavior 2, Behavior 3, Behavior 6 ...... ......
[0037] To expand the behavior groups in Table 1 above and find other behavior combinations that may cause memory leaks, this embodiment uses the Apriori algorithm for correlation analysis.
[0038] Specifically, the basic behavioral scenarios can be determined first based on the pre-identified memory leak behavior groups and the logs generated by the memory leak behavior groups. Then, the association analysis of the memory leak behavior groups can be performed using the preset Apriori algorithm to obtain multiple target memory leak behavior groups, and each target memory leak behavior group can be identified as an associated behavioral scenario. Finally, the basic behavioral scenarios and associated behavioral scenarios can be used as sample data to train the classifier.
[0039] It should be noted that a single behavior group can be considered a basic behavior scenario. For the process of performing correlation analysis on memory leak behavior groups using the pre-defined Apriori algorithm, please refer to [link to relevant documentation]. Figure 2 , Figure 2 This is a flowchart illustrating a correlation analysis of memory leak behavior groups, provided as an embodiment of this application.
[0040] like Figure 2 As shown, the process of performing correlation analysis on memory leak behavior groups provided in this embodiment may include:
[0041] Step 201: Combine the different memory leak behaviors in each memory leak behavior group to generate multiple candidate behavior groups.
[0042] In this step, the different memory leak behaviors in each memory leak behavior group need to be recombined. There is no limit to the number of memory leak behaviors in each candidate behavior group, but the memory leak behaviors in the candidate behavior combination should be different.
[0043] In a specific example, taking Table 1 as an example, there are behaviors 1, 2, 3, 4, 5, 6, 7, 8, and 9. There are 9 possible combinations, and each of them constitutes a candidate behavior group. For example, "behavior 2, behavior 3, and behavior 5" is a candidate behavior group.
[0044] Step 202: Determine the support level of each candidate behavior group and delete candidate behavior groups whose support level does not exceed the preset support level threshold.
[0045] In this step, the support is related to the basic data that forms the candidate behavior groups. In the example above, the basic data is the behavior groups in Table 1.
[0046] Taking the candidate behavior group "behavior 2, behavior 3, behavior 5" as an example, its support is:
[0047]
[0048] Where σ(behavior 2, behavior 3, behavior 5) refers to the number of behavior groups in Table 1 containing “behavior 2, behavior 3, behavior 5”, and {T} is the total number of all behavior groups in Table 1.
[0049] It should be noted that the behavior groups containing "behavior 2, behavior 3, behavior 5" are behavior group 2 and behavior group 3, with a total of 2.
[0050] Based on the above formula, the support of each candidate behavior group can be calculated. A support threshold is preset. If the support does not exceed the threshold, the corresponding candidate behavior group is considered to have poor correlation. Compared with the behavior groups that can currently cause memory leaks, this candidate behavior group will not cause memory leaks. Therefore, it can be deleted.
[0051] Step 203: For any remaining candidate behavior group, calculate the confidence level of the candidate behavior group based on any behavior subgroup in the candidate behavior group, and obtain the confidence level corresponding to each behavior subgroup.
[0052] In this step, since calculating only the support score is insufficient to directly determine the correlation between behaviors within the candidate behavior group, a confidence score is also calculated. To calculate the confidence score, a subgroup of behaviors within the candidate behavior group needs to be constructed first, in order to calculate the degree of correlation between this subgroup and the remaining behaviors.
[0053] In a specific example, taking "behavior 2, behavior 3, behavior 5" as an example, its behavior subgroups are "behavior 2", "behavior 3", "behavior 5", "behavior 2, behavior 3", "behavior 2, behavior 5", and "behavior 3, behavior 5".
[0054] For any behavior subgroup, such as "behavior 2, behavior 3", its corresponding confidence score can be calculated using the following formula:
[0055]
[0056] Wherein, σ(behavior 2, behavior 3, behavior 5) refers to the number of behavior groups in Table 1 containing “behavior 2, behavior 3, behavior 5”, and σ(behavior 2, behavior 3) refers to the number of behavior groups in Table 1 containing the behavior subgroup “behavior 2, behavior 3”.
[0057] The confidence level can be understood as follows: In Table 1, after having "behavior 2" and "behavior 3", how many groups also have behavior 5?
[0058] Step 204: If there is a target confidence level greater than the preset confidence threshold, associate the target behavior subgroup corresponding to the target confidence level with other behaviors in the candidate behavior group except for the target behavior subgroup to obtain the target memory leak behavior group.
[0059] In this step, a preset confidence threshold is set. Since the candidate behavior group will have multiple behavior subgroups, each behavior subgroup has its own corresponding confidence. As long as there is a target confidence that is greater than the preset confidence threshold, it indicates that the behavior correlation within the candidate behavior group is high, and the candidate behavior group can be identified as the target memory leak behavior group.
[0060] Taking the aforementioned example, if the preset threshold is 0.5, it means that the candidate behavior group "behavior 2, behavior 3, behavior 5" can be used as a target memory leak behavior group. Of course, if only the confidence level of the behavior subgroup "behavior 2, behavior 3" is greater than the preset threshold, the association rule is "behavior 2, behavior 3" -> "behavior 5".
[0061] In addition, to facilitate the training of the classifier, this embodiment can first convert the basic behavior scene and the associated behavior scene into a leakage detection scene chart; and use the leakage detection scene chart as sample data to train the classifier.
[0062] It should be noted that the icon can be similar to the one in Table 1, which indicates the behavior in each behavioral scenario.
[0063] Step 103: If the probability is greater than the preset threshold, determine the combination of behaviors as memory leak behaviors that cause memory leaks.
[0064] In this step, if the probability is greater than the preset threshold, it means that the classifier has detected a lot of features of the memory leak behavior group in the behavior group, or that they are quite similar, which may cause memory leaks. At this time, the behavior combination can be identified as the memory leak behavior that causes memory leaks.
[0065] In addition, to eliminate the memory leak, the database can be rolled back according to the logs corresponding to the behavior group, so as to return the database to the state before the behavior group was executed, thereby eliminating the memory leak caused by the behavior group.
[0066] In this embodiment, a pre-trained classifier can determine the probability that a combination of behaviors will cause a memory leak based on system logs and the combinations of behaviors that generate those logs. Therefore, based on the probability, it can be determined whether the combination of behaviors is a memory leak-causing behavior. Based on this, this application can predict whether complex combinations of behaviors can cause memory leaks, which is a more comprehensive way to avoid memory leaks compared to current methods that can only avoid memory leaks caused by a single behavior.
[0067] Example 2
[0068] Figure 3 This is a schematic diagram of a memory leak detection device provided in Embodiment 2 of this application. The memory leak detection device provided in this embodiment can execute the memory leak detection method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing the method. This device can be implemented in software and / or hardware, such as... Figure 3 As shown, the memory leak detection device specifically includes: an acquisition module 301, a classification module 302, and a memory leak behavior determination module 303.
[0069] The acquisition module is used to acquire system logs and the combination of behaviors that generate system logs.
[0070] The classification module is used to input system logs and behavior combinations into a pre-trained classifier and obtain the probability that the behavior combinations output by the classifier will cause a memory leak.
[0071] The memory leak behavior determination module is used to determine the combination of behaviors that cause memory leaks if the probability is greater than a preset threshold.
[0072] In this embodiment, a pre-trained classifier can determine the probability that a combination of behaviors will cause a memory leak based on system logs and the combinations of behaviors that generate those logs. Therefore, based on the probability, it can be determined whether the combination of behaviors is a memory leak-causing behavior. Based on this, this application can predict whether complex combinations of behaviors can cause memory leaks, which is a more comprehensive way to avoid memory leaks compared to current methods that can only avoid memory leaks caused by a single behavior.
[0073] Furthermore, the collection module is used to collect pre-identified memory leak behavior groups and the logs generated by the memory leak behavior groups;
[0074] The classifier training module is used to train a classifier based on the memory leak behavior group and the logs generated by the memory leak behavior group.
[0075] Furthermore, the classifier training module includes:
[0076] The basic behavior scenario determination unit is used to determine the basic behavior scenario based on the pre-identified memory leak behavior group and the logs generated by the memory leak behavior group.
[0077] The associated behavior scenario determination unit is used to perform correlation analysis on memory leak behavior groups using the preset Apriori algorithm, obtain multiple target memory leak behavior groups, and determine each target memory leak behavior group as an associated behavior scenario.
[0078] The classifier training unit is used to train the classifier using basic behavioral scenarios and related behavioral scenarios as sample data.
[0079] Furthermore, the associated behavior scenario determination unit includes:
[0080] The candidate behavior group generation subunit is used to combine different memory leak behaviors in each target memory leak behavior group to generate multiple candidate behavior groups.
[0081] The support determination subunit is used to determine the support of each candidate behavior group and delete candidate behavior groups whose support does not exceed a preset support threshold.
[0082] The confidence level determination subunit is used to calculate the confidence level of any remaining candidate behavior group based on any behavior subgroup in the candidate behavior group, and obtain the confidence level corresponding to each behavior subgroup.
[0083] The target memory leak behavior group determination subunit is used to associate the target behavior subgroup corresponding to the target confidence level with other behaviors in the candidate behavior group except the target behavior subgroup if there is a target confidence level greater than a preset confidence threshold, so as to obtain the target memory leak behavior group.
[0084] Further classifier training units include:
[0085] The chart transformation sub-unit is used to convert basic behavioral scenarios and related behavioral scenarios into leak detection scenario charts;
[0086] The training subunit is used to train the classifier using leak detection scenario graphs as sample data.
[0087] Example 3
[0088] Figure 4 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of this application, as shown below. Figure 3As shown, the electronic device includes a processor 410, a memory 420, an input device 430, and an output device 440; the number of processors 410 in the electronic device can be one or more. Figure 4 Taking a processor 410 as an example; the processor 410, memory 420, input device 430, and output device 440 in the electronic device can be connected via a bus or other means. Figure 4 Taking the example of a connection between China and Israel via a bus.
[0089] The memory 420, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the memory leak detection method in this embodiment of the invention (e.g., the acquisition module 301, classification module 302, and memory leak determination module 303 in the memory leak detection device). The processor 410 executes various functional applications and data processing of the electronic device by running the software programs, instructions, and modules stored in the memory 420, thereby implementing the aforementioned memory leak detection method.
[0090] The combination of actions that retrieve system logs and generate system logs;
[0091] The system logs and behavior combinations are input into a pre-trained classifier to obtain the probability that the behavior combinations output by the classifier will cause a memory leak.
[0092] If the probability is greater than a preset threshold, the combination of behaviors is determined to be a memory leak behavior that causes a memory leak.
[0093] Furthermore, the methods also include:
[0094] Collect pre-identified memory leak behavior groups and the logs generated by these groups;
[0095] A classifier is trained based on memory leak behavior groups and the logs generated by those groups.
[0096] Furthermore, a classifier is trained based on the memory leak behavior groups and the logs generated by those groups, including:
[0097] The basic behavioral scenarios are determined based on the pre-identified memory leak behavior groups and the logs generated by the memory leak behavior groups;
[0098] The pre-defined Apriori algorithm is used to perform correlation analysis on memory leak behavior groups to obtain multiple target memory leak behavior groups, and each target memory leak behavior group is identified as a related behavior scenario.
[0099] The basic behavioral scenarios and related behavioral scenarios are used as sample data to train the classifier.
[0100] Furthermore, the pre-defined Apriori algorithm is used to perform correlation analysis on memory leak behavior groups, resulting in multiple target memory leak behavior groups, including:
[0101] The different memory leak behaviors in each target memory leak behavior group are combined to generate multiple candidate behavior groups;
[0102] Determine the support level of each candidate behavior group and delete candidate behavior groups whose support does not exceed the preset support threshold;
[0103] For any remaining candidate behavior group, calculate the confidence level of the candidate behavior group based on any behavior subgroup in the candidate behavior group, and obtain the confidence level corresponding to each behavior subgroup;
[0104] If there is a target confidence level greater than the preset confidence threshold, the target behavior subgroup corresponding to the target confidence level is associated with other behaviors in the candidate behavior group except for the target behavior subgroup to obtain the target memory leak behavior group.
[0105] Furthermore, the basic behavioral scenarios and related behavioral scenarios are used as sample data to train the classifier, including:
[0106] Convert basic and related behavioral scenarios into a leak detection scenario diagram;
[0107] Leakage detection scenario charts were used as sample data to train the classifier.
[0108] The memory 420 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function; the data storage area may store data created based on terminal usage. Furthermore, the memory 420 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 420 may further include memory remotely located relative to the processor 410, which can be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0109] Example 4
[0110] Embodiment 4 of this application also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform a method for detecting memory leak behavior. The method includes:
[0111] The combination of actions that retrieve system logs and generate system logs;
[0112] The system logs and behavior combinations are input into a pre-trained classifier to obtain the probability that the behavior combinations output by the classifier will cause a memory leak.
[0113] If the probability is greater than a preset threshold, the combination of behaviors is determined to be a memory leak behavior that causes a memory leak.
[0114] Furthermore, the methods also include:
[0115] Collect pre-identified memory leak behavior groups and the logs generated by these groups;
[0116] A classifier is trained based on memory leak behavior groups and the logs generated by those groups.
[0117] Furthermore, a classifier is trained based on the memory leak behavior groups and the logs generated by those groups, including:
[0118] The basic behavioral scenarios are determined based on the pre-identified memory leak behavior groups and the logs generated by the memory leak behavior groups;
[0119] The pre-defined Apriori algorithm is used to perform correlation analysis on memory leak behavior groups to obtain multiple target memory leak behavior groups, and each target memory leak behavior group is identified as a related behavior scenario.
[0120] The basic behavioral scenarios and related behavioral scenarios are used as sample data to train the classifier.
[0121] Furthermore, the pre-defined Apriori algorithm is used to perform correlation analysis on memory leak behavior groups, resulting in multiple target memory leak behavior groups, including:
[0122] The different memory leak behaviors in each target memory leak behavior group are combined to generate multiple candidate behavior groups;
[0123] Determine the support level of each candidate behavior group and delete candidate behavior groups whose support does not exceed the preset support threshold;
[0124] For any remaining candidate behavior group, calculate the confidence level of the candidate behavior group based on any behavior subgroup in the candidate behavior group, and obtain the confidence level corresponding to each behavior subgroup;
[0125] If there is a target confidence level greater than the preset confidence threshold, the target behavior subgroup corresponding to the target confidence level is associated with other behaviors in the candidate behavior group except for the target behavior subgroup to obtain the target memory leak behavior group.
[0126] Furthermore, the basic behavioral scenarios and related behavioral scenarios are used as sample data to train the classifier, including:
[0127] Convert basic and related behavioral scenarios into a leak detection scenario diagram;
[0128] Leakage detection scenario charts were used as sample data to train the classifier.
[0129] Based on the above description of the implementation methods, those skilled in the art can clearly understand that this application can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0130] It is worth noting that in the embodiments of the search device described above, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of this application.
[0131] Note that the above description is merely a preferred embodiment and the technical principles employed in this application. Those skilled in the art will understand that this application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments. Many other equivalent embodiments may be included without departing from the concept of this application, and the scope of this application is determined by the scope of the appended claims.
Claims
1. A method for detecting memory leak behavior, characterized in that, Applied to the proxy side, the method includes: A combination of actions that acquire system logs and generate those system logs; The system logs and the behavior combination are input into a pre-trained classifier to obtain the probability that the behavior combination causes a memory leak, as output by the classifier. If the probability is greater than a preset threshold, the combination of behaviors is determined to be a memory leak behavior that causes a memory leak; When pre-training the classifier, training the classifier based on the memory leak behavior group and the logs generated by the memory leak behavior group includes: The basic behavioral scenario is determined based on the pre-identified memory leak behavior groups and the logs generated by the memory leak behavior groups; The different memory leak behaviors in each memory leak behavior group are combined to generate multiple candidate behavior groups; the support of each candidate behavior group is determined, and candidate behavior groups with support not exceeding a preset support threshold are deleted; for any remaining candidate behavior group, the confidence of the candidate behavior group is calculated based on any behavior subgroup in the candidate behavior group to obtain the confidence of each behavior subgroup; if there is a target confidence greater than a preset confidence threshold, the target behavior subgroup corresponding to the target confidence is associated with other behaviors in the candidate behavior group except for the target behavior subgroup to obtain the target memory leak behavior group; the support of the candidate behavior group is the ratio of the number of all memory leak behavior groups containing the candidate behavior group to the number of all memory leak behavior groups; the confidence of the behavior subgroup is the degree of association between the behavior subgroup in the candidate behavior group and the other behaviors; Each of the target memory leak behavior groups is identified as an associated behavior scenario; The basic behavioral scenarios and the associated behavioral scenarios are used as sample data to train the classifier.
2. The method according to claim 1, characterized in that, The method further includes: Collect pre-identified memory leak behavior groups and the logs generated by the memory leak behavior groups; A classifier is trained based on the memory leak behavior group and the logs generated by the memory leak behavior group.
3. The method according to claim 1, characterized in that, The step of training the classifier using the basic behavioral scenarios and the associated behavioral scenarios as sample data includes: Convert the basic behavioral scenarios and the related behavioral scenarios into a leakage detection scenario diagram; The leak detection scenario chart was used as sample data to train the classifier.
4. A device for detecting memory leak behavior, characterized in that, The device includes: The acquisition module is used to acquire system logs and the combination of behaviors that generate the system logs; A classification module is used to input the system log and the behavior combination into a pre-trained classifier to obtain the probability that the behavior combination causes a memory leak, as output by the classifier. A memory leak behavior determination module is used to determine that the combination of behaviors constitutes a memory leak behavior that causes a memory leak if the probability is greater than a preset threshold. When pre-training the classifier, training the classifier based on the memory leak behavior group and the logs generated by the memory leak behavior group includes: The basic behavioral scenario is determined based on the pre-identified memory leak behavior groups and the logs generated by the memory leak behavior groups; The different memory leak behaviors in each memory leak behavior group are combined to generate multiple candidate behavior groups; the support of each candidate behavior group is determined, and candidate behavior groups with support not exceeding a preset support threshold are deleted; for any remaining candidate behavior group, the confidence of the candidate behavior group is calculated based on any behavior subgroup in the candidate behavior group to obtain the confidence of each behavior subgroup; if there is a target confidence greater than a preset confidence threshold, the target behavior subgroup corresponding to the target confidence is associated with other behaviors in the candidate behavior group except for the target behavior subgroup to obtain the target memory leak behavior group; the support of the candidate behavior group is the ratio of the number of all memory leak behavior groups containing the candidate behavior group to the number of all memory leak behavior groups; the confidence of the behavior subgroup is the degree of association between the behavior subgroup in the candidate behavior group and the other behaviors; Each of the target memory leak behavior groups is identified as an associated behavior scenario; The basic behavioral scenarios and the associated behavioral scenarios are used as sample data to train the classifier.
5. The apparatus according to claim 4, characterized in that, The device further includes: The collection module is used to collect pre-identified memory leak behavior groups and the logs generated by the memory leak behavior groups; The classifier training module is used to train a classifier based on the memory leak behavior group and the logs generated by the memory leak behavior group.
6. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the memory leak detection method as described in any one of claims 1-3.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the method for detecting memory leak behavior as described in any one of claims 1-3.
Citation Information
Patent Citations
System fault pre-warning method and system for data leakage prevention systems
CN107423205A
Memory leak detection method and device, terminal and storage medium
CN112463603A