Memory leak processing method and device, electronic equipment, computer readable storage medium and computer program product
By obtaining the business weight and memory size of the business program, determining the leaked memory value and repairing the source code file when the threshold is reached, the problem of memory leakage in the business program is solved, the efficiency and effect of memory leakage processing is improved, and the business performance is ensured. stability.
Patent Information
- Application Number
- CN202410774539.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-12-17
AI Technical Summary
The existing technology cannot effectively solve the memory leak problem in business programs, resulting in performance degradation, page lag and even crashes, and the inability to quantify the impact of memory leaks on the business.
By obtaining the business weights and leaked memory size of the business program, determine the leaked memory value, and repair the source code file when the threshold is reached to resolve the memory leak problem.
It improves the efficiency and effectiveness of memory leak processing of business programs, ensures the stability of business performance, and avoids performance degradation and crash problems caused by memory leaks.
Smart Images

Figure CN119149275A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device, computer-readable storage medium, and computer program product for processing memory leaks. Background Art
[0002] As Internet technology develops rapidly, more and more business programs are being developed. Since there may be memory leaks in business programs, which can lead to performance degradation, page freezes, or even crashes, it is necessary to solve the memory leak problem. Summary of the invention
[0003] Embodiments of the present application provide a method, device, electronic device, computer-readable storage medium, and computer program product for processing memory leaks, which can improve the processing effect of memory leaks in business programs.
[0004] The technical solution of the embodiment of the present application is implemented as follows:
[0005] The present application provides a method for processing a memory leak, including:
[0006] Obtaining the business weight of the business program with memory leak, and determining the size of the memory leaked by the business program;
[0007] Determine the leaked memory value of the business program based on the business weight and the memory size;
[0008] When the leaked memory value reaches a leaked memory threshold, the source code file of the business program is repaired.
[0009] The embodiment of the present application also provides a memory leak processing device, including:
[0010] An acquisition module, used to acquire the business weight of a business program with a memory leak and determine the size of the memory leaked by the business program;
[0011] A determination module, configured to determine a leaked memory value of the business program based on the business weight and the memory size;
[0012] A repair module is used to repair the source code file of the business program when the leaked memory value reaches a leaked memory threshold.
[0013] The present application also provides an electronic device, including:
[0014] A memory for storing computer executable instructions;
[0015] The processor is used to implement the memory leak processing method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.
[0016] The embodiment of the present application also provides a computer-readable storage medium storing computer-executable instructions or a computer program. When the computer-executable instructions or the computer program are executed by a processor, the memory leak processing method provided in the embodiment of the present application is implemented.
[0017] The embodiment of the present application also provides a computer program product, including computer executable instructions or a computer program, which, when executed by a processor, implements the memory leak processing method provided in the embodiment of the present application.
[0018] The embodiments of the present application have the following beneficial effects:
[0019] By applying the above-mentioned embodiment of the present application, for a business program with a memory leak, the business weight of the business program is obtained, and the size of the memory leaked by the business program is determined, and then based on the business weight and the memory size, the leaked memory value of the business program is determined, so that when the leaked memory value reaches the leaked memory threshold, the source code file of the business program is repaired. Here, only when the leaked memory value determined in combination with the business weight of the business program reaches the leaked memory threshold, the source code file of the business program is repaired to solve the memory leak problem of the business program, so that not only the business performance of the business program is guaranteed, but also the processing efficiency of the memory leak of the business program is improved, thereby improving the processing effect of the memory leak of the business program. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a schematic diagram of the architecture of a memory leak processing system provided in an embodiment of the present application;
[0021] Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0022] Figure 3A It is a first flow chart of a method for processing a memory leak provided in an embodiment of the present application;
[0023] Figure 3B It is a second flow chart of the method for processing memory leak provided in an embodiment of the present application;
[0024] Figure 3C It is a third flow chart of the method for processing memory leak provided in the embodiment of the present application;
[0025] Figure 4 It is a fourth flow chart of the method for processing memory leak provided in an embodiment of the present application;
[0026] Figure 5 It is a fifth flow chart of the method for processing memory leak provided in the embodiment of the present application;
[0027] Figure 6 This is the sixth flow chart of the memory leak processing method provided in the embodiment of the present application.
[0028] It should be noted that the above-mentioned “first” and “second” are only used to distinguish different solutions, and do not represent the degree of superiority or inferiority of the solutions or the priority in the implementation process. DETAILED DESCRIPTION
[0029] 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.
[0030] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will 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.
[0031] 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 with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0032] 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 functions of the module or unit.
[0033] 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.
[0034] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in examples, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the personal information subject.
[0035] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0036] 1) Business program: an application program (or application) running in an electronic device to provide various business services, such as the list dialing business program and the list query business program in the telemarketing business.
[0037] 2) In response to: used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed may be in real time or have a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed are executed.
[0038] 3) Memory leak: 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, slowing down the program running speed or even causing serious consequences such as system crash.
[0039] 4) Available Memory: In computer terms, "available memory" refers to the amount of memory available to the operating system for running programs and processing tasks. It usually refers to the allocatable memory space in the computer's physical memory (RAM) that is not occupied by the operating system or other running programs.
[0040] Due to the rapid development of Internet technology, more and more business programs are being developed. Since there may be memory leaks in business programs, and memory leaks can cause performance degradation, page freezes, or even crashes in business programs, it is necessary to identify and resolve memory leaks. In related technologies, the following two methods are usually used to resolve memory leaks: Solution (1) prevents memory leaks in advance; Solution (2) remediates memory leaks after they occur. However, neither of these two solutions can quantify the impact of memory leaks on the business itself, and cannot effectively resolve memory leaks in the business.
[0041] Based on this, the embodiments of the present application provide a method, device, electronic device, computer-readable storage medium and computer program product for processing memory leaks, which can improve the processing effect of memory leaks in business programs. Next, based on the above description of the nouns and terms involved in the embodiments of the present application, the embodiments of the present application are described in detail.
[0042] The following describes a memory leak processing system provided by an embodiment of the present application. Figure 1 , Figure 1 1 is a schematic diagram of the architecture of a memory leak processing system provided in an embodiment of the present application. To support an exemplary application, the memory leak processing system 100 includes: a server 200, a network 300, and a terminal 400. The terminal 400 is connected to the server 200 via the network 300, and the network 300 can be a wide area network or a local area network, or a combination of the two, using a wireless or wired link to achieve data transmission.
[0043] Here, terminal 400 (for example, running a client that supports memory leak processing) responds to a memory leak processing instruction for a business program in a business scenario, and sends a business data acquisition request for the business program to server 200; server 200 receives the business data acquisition request sent by terminal 400; in response to the acquisition request, sends the business data of the business program to terminal 400; terminal 400 receives the business data of the business program sent by server 200; based on the business data, runs the business program; performs memory leak detection on the business program in the business scenario; when there is a memory leak in the business program, obtains the business weight of the business program and determines the size of the leaked memory in the business program; determines the leaked memory value of the business program based on the business weight and the memory size; when the leaked memory value reaches the leaked memory threshold, repairs the source code file of the business program, wherein the repaired source code file is used to resolve the memory leak of the business program, thereby achieving the processing of memory leaks in the business program.
[0044] In some embodiments, the method for processing memory leaks provided in the embodiments of the present application is implemented by an electronic device, for example, it can be implemented by a terminal alone, it can also be implemented by a server alone, or it can be implemented by a terminal and a server in collaboration. The electronic device for implementing the method for processing memory leaks provided in the embodiments of the present application can be various types of terminals or servers. Among them, the server (such as server 200) can be an independent physical server, or it can be a server cluster or distributed system composed of multiple physical servers. The terminal (such as terminal 400) can be a laptop, a tablet computer, a desktop computer, a smart phone, an intelligent voice interaction device (such as a smart speaker), a smart home appliance (such as a smart TV), a smart watch, a vehicle-mounted terminal, a wearable device, a virtual reality (Virtual Reality, VR) device, an aircraft, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected by wired or wireless communication, and the embodiments of the present application are not limited to this.
[0045] In some embodiments, the processing method for memory leakage provided in the embodiment of the present application can be implemented with the aid of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network in a wide area network or a local area network to realize the calculation, storage, processing, and sharing of data. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology based on the application of cloud computing business model, which can form a resource pool, which is used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background service of the technical network system requires a large amount of computing resources and storage resources. As an example, a server (such as server 200) can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
[0046] In some embodiments, the terminal or server can implement the processing method of memory leak provided by the embodiment of the present application by running various computer executable instructions or computer programs. For example, computer executable instructions can be commands, machine instructions or software instructions at the microprogram level. The computer program can be a native program or software module in the operating system; it can be a local (Native) application (Application, APP), that is, a program that needs to be installed in the operating system to run; it can also be a small program that can be embedded in any APP, that is, a program that can be run only by downloading it to a browser environment. In short, the above-mentioned computer executable instructions can be instructions in any form, and the above-mentioned computer program can be an application, module or plug-in in any form.
[0047] The following describes an electronic device that implements a method for processing memory leaks provided by an embodiment of the present application. Figure 2 , Figure 2 Schematic diagram of the structure of the electronic device provided in the embodiment of the present application. The electronic device 500 provided in the embodiment of the present application can be a terminal or a server. Figure 2 As shown, the electronic device 500 includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the electronic device 500 are coupled together through a bus system 540. It can be understood that the bus system 540 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 540 is not used in the following examples. Figure 2 Various buses are labeled as bus system 540 .
[0048] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0049] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0050] The memory 550 may be removable, non-removable, or a combination thereof. The memory 550 may include one or more storage devices physically located away from the processor 510. The memory 550 includes a volatile memory or a non-volatile memory, and may also include both a volatile memory and a non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.
[0051] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0052] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0053] A network communication module 552, used to reach other electronic devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB), etc.;
[0054] a presentation module 553 for enabling presentation of information via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripherals and displaying content and information);
[0055] The input processing module 554 is used to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions.
[0056] In some embodiments, the memory leak processing device provided in the embodiments of the present application can be implemented in a software manner. Figure 2 A memory leak processing device 555 stored in a memory 550 is shown, which may be software in the form of a program or plug-in, including the following software modules: an acquisition module 5551, a determination module 5552, and a repair module 5553. These modules are logical, and therefore may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0057] The following describes the memory leak processing method provided by the embodiment of the present application. As mentioned above, the memory leak processing method provided by the embodiment of the present application is implemented by an electronic device, for example, it can be implemented by a server or a terminal alone, or by a server and a terminal in collaboration. Therefore, the execution subject of each step will not be repeatedly described below. Figure 3A , Figure 3A : is a flowchart of a method for processing a memory leak provided in an embodiment of the present application. The method for processing a memory leak provided in an embodiment of the present application includes:
[0058] Step 101: Obtain the business weight of the business program with memory leak, and determine the size of the memory leaked by the business program.
[0059] Here, firstly, the business program is tested for memory leaks. The business program is used to support the functions required by the business scenario (or business) and provide business services for the corresponding business scenario. The business scenario can be divided according to needs, and different business scenarios correspond to different business programs. The business program is an application that provides business services for the business scenario. Taking the telemarketing business as an example, the business scenario can be a list dialing scenario, a list query scenario, a list scheduling scenario, etc.; the business program can be a business program that provides list dialing services, a business program that provides list query services, a business program that provides list scheduling services, etc. As an example, when performing memory leak detection, it can be implemented in the following way:
[0060] 1) Use Xcode's Leaks tool: Xcode has a built-in detection tool called Leaks, which can detect memory leaks in business programs when running on a simulator or a real machine. For example, open the Leaks tool and start a business program, and then perform operations that may cause memory leaks in the business program. The Leaks tool will display the currently active memory blocks and highlight the objects that may cause memory leaks.
[0061] 2) Use the Allocations tool of Instruments: Instruments is a powerful performance analysis tool of Xcode. The Allocations tool can be used to detect memory leaks. For example, select the Allocations template in Instruments and start a business program. Then, perform operations in the business program that may cause memory leaks. The Allocations tool will display detailed information about memory allocation, including the life cycle and memory usage of the object, to identify memory leaks.
[0062] 3) Use the third-party library memlab: memlab is a third-party library for detecting memory leaks in Objective-C and Swift applications. For example, integrate memlab in the code of a business program, add necessary configurations to the code, and then run the business program. Memlab will monitor memory allocation and release at runtime and provide a detailed report when a memory leak occurs.
[0063] 4) Code review and static analysis: Code review and static analysis tools (such as SonarQube, ClangStatic Analyzer, etc.) are used to detect code patterns that may cause memory leaks. Such tools can detect potential memory leaks in the code without running business programs, such as unreleased automatic reference counting (ARC) objects and unreleased pointers.
[0064] 5) Logging and debugging: Add logging to the code of the business program to record the time and location of object creation and release. For example, use a debugger (such as Xcode's debugger) to track the life cycle of objects and check whether there are unreleased objects to determine objects that may cause memory leaks.
[0065] 6) Unit tests and integration tests: Write unit tests and integration tests that simulate scenarios that may cause memory leaks, such as using a testing framework (such as XCTest) to run the tests and check whether there are any reports of memory leaks.
[0066] 7) Use garbage collection: If your business program uses garbage collection mechanisms other than automatic reference counting (ARC) (such as Swift's garbage collection), make sure to configure and use the garbage collector correctly. The garbage collector can help automatically detect and fix some memory leaks.
[0067] In step 101, when the detection result of the memory leak detection indicates that the business program has a memory leak, the business weight of the business program with the memory leak is obtained. The business weight can be for the business scenario supported by the business program. Each business scenario has a corresponding business weight, and the business weights of different business scenarios may be the same or different. For example, the business weight can indicate the importance of the corresponding business scenario (or the business program supporting the business scenario), and there is a positive proportional relationship between the business weight and the importance. For example, the business weight of business scenario 1 (list dialing) is 10, the business weight of business scenario 2 (list query) is 5, and the business weight of business scenario 3 (list scheduling) is 5. Then, business scenario 1 (list dialing) has the highest importance, and business scenario 2 (list query) and business scenario 3 (list scheduling) have the same importance, and both are lower than business scenario 1 (list dialing).
[0068] In some embodiments, the business weight of a business program can be obtained by executing the following steps: obtaining the characteristics of the business scenario corresponding to the business program; based on the characteristics of the business scenario, calling a machine learning model to predict the business weight of the business program to obtain the business weight of the business program.
[0069] Here, the characteristics of the business scenario can be obtained by extracting the characteristics of the business scenario information, and the business scenario information can include but is not limited to the basic information of the business scenario, the usage information of the business scenario, the interaction information between the user and the business scenario, the importance information of the business scenario, etc.; the feature extraction process can be implemented by a pre-trained feature extraction model, such as a feature extraction model constructed by a convolutional neural network. After obtaining the characteristics of the business scenario, the characteristics of the business scenario are input into the machine learning model, and then the machine learning model is called to predict the business weight of the business program to obtain the business weight of the business program. For example, the machine learning model can be obtained by pre-training, and the machine learning model can be constructed based on a neural network (such as a convolutional neural network, a deep neural network, a recurrent neural network, etc.); specifically, first obtain the initial machine learning model, the business scenario sample characteristics of the business scenario sample, and the corresponding label business weight, and then input the business scenario sample characteristics into the initial machine learning model, and predict the business weight of the business scenario sample through the initial machine learning model to obtain the predicted business weight, and then based on the difference between the predicted business weight and the label business weight, update the model parameters of the initial machine learning model to obtain the machine learning model. In this way, the correlation between the business weight and the business scenario can be improved, and the business weight can better express the situation of the business scenario, thereby improving the adaptability of the business program to the business scenario.
[0070] In some embodiments, the business weight of a business program can be obtained by executing the following steps: obtaining parameter values of parameters affecting the business weight, and obtaining a mapping relationship between the parameter values and the business weight; and determining the business weight of the business program based on the parameter values and the mapping relationship.
[0071] Here, first, the parameter value of the influencing parameter of the business weight can be obtained, and the parameter value of the influencing parameter has an influence on the size of the business weight. For example, the influencing parameter may include but is not limited to the usage parameter of the business program (or the business scenario supported by the business program), the attention parameter to the business scenario supported by the business program, the importance parameter of the business scenario supported by the business program, etc. Then obtain the mapping relationship between the parameter value of the influencing parameter and the business weight, and the mapping relationship can be preset. For example, the mapping relationship can be: business weight = a * parameter value of influencing parameter 1 + b * parameter value of influencing parameter 2 + ... + x * parameter value of influencing parameter n. Based on this, the business weight of the business program is determined based on the parameter value of the influencing parameter and the mapping relationship. For example, business weight = 1 * 5 (parameter value of influencing parameter 1) + 2 * 2 (parameter value of influencing parameter 2) = 9. In this way, the correlation between the business weight and the business scenario supported by the business program can be improved, and the business weight can better express the situation of the business scenario supported by the business program, thereby improving the adaptability of the business program to the business scenario.
[0072] In some embodiments, the following steps may also be performed: detecting whether the parameter value of the influencing parameter has changed; if the parameter value of the influencing parameter has changed, updating the business weight of the business program based on the changed parameter value of the influencing parameter.
[0073] Here, it is also possible to detect whether the parameter value of the influencing parameter has changed, so that when the parameter value of the influencing parameter has changed, the business weight of the business program is updated based on the parameter value of the influencing parameter after the change. Specifically, based on the parameter value of the influencing parameter after the change and the above-mentioned mapping relationship, the updated business weight is obtained. In this way, the business weight can be updated according to the actual situation of the business scenario supported by the business program, so that the business program is more suitable for the current business scenario and the business service quality of the business program is improved.
[0074] In step 101, the size of memory leaked by the business program is also determined. That is, the size of memory occupied by the page in the business program when it is refreshed (or rendered) is determined. In some embodiments, the size of memory leaked by the business program can be determined by executing the following steps: obtaining refresh parameters of the page in the business program, and obtaining the size of memory occupied by the page when it is refreshed; based on the refresh parameters and the size of memory occupied, the size of memory leaked by the business program is determined.
[0075] Here, first obtain the refresh parameters of the page in the business program. In some embodiments, the refresh parameters of the page in the business program can be obtained by performing the following steps: obtain the refresh frequency of the page in multiple statistical periods within the target time period; based on the refresh frequency in multiple statistical periods, determine the refresh parameters, and the refresh parameters include one of the following parameters: the maximum refresh frequency among multiple refresh frequencies, the average refresh frequency of multiple refresh frequencies. It should be noted that the target time period can be preset, such as from February 10 to March 10, and the length of the target time period can also be set according to demand; the statistical period can also be preset, such as 24 hours (i.e., the refresh frequency within the 24 hours is counted once every 24 hours within the target time period), 12 hours (i.e., the refresh frequency within the 12 hours is counted once every 12 hours within the target time period), 1 hour (i.e., the refresh frequency within the 1 hour is counted once every 1 hour within the target time period), etc. Then, based on the refresh frequency within multiple statistical periods, determine the refresh parameters, which can be the maximum refresh frequency, average refresh frequency, etc. within the multiple statistical periods.
[0076] After obtaining the refresh parameters of the page in the business program, the memory size occupied by the page when refreshing can also be obtained. The memory size occupied by the page when refreshing (or rendering) is determined when the refresh operation of the page is executed in the business program.
[0077] Based on this, the memory size leaked by the business program can be determined based on the refresh parameter and the occupied memory size. For example, the refresh parameter and the occupied memory size are multiplied to obtain the multiplication result, which is the memory size leaked by the business program. In this way, the memory size leaked by the business program when the business program is actually running is determined. For example, when the business program includes multiple pages, the page memory size of each page in the multiple pages (the same calculation method as the memory size) can be added to obtain the memory size leaked by the business program. Of course, when the page memory size of each page is added, the page weight of each page can be obtained, and then the page memory size of each page is weighted based on the page weight to obtain the memory size leaked by the business program.
[0078] Step 102: Based on the business weight and the memory size, determine the leaked memory value of the business program.
[0079] In step 102, when determining the leaked memory value of the business program based on the business weight and the memory size, the business weight and the memory size may be multiplied to obtain a multiplication result, and the multiplication result of the business weight and the memory size may be used as the leaked memory value of the business program.
[0080] Step 103: When the leaked memory value reaches the leaked memory threshold, repair the source code file of the business program.
[0081] Among them, the repaired source code file is used to solve the memory leak of the business program.
[0082] In step 103, a leaked memory threshold can be obtained, and the leaked memory threshold can be set separately for each business program (or the business scenario supported by the business program), or it can be set together for all business programs (or the business scenarios supported by the business programs). For example, each business program (or the business scenario supported by the business program) corresponds to a leaked memory threshold, and the leaked memory thresholds of different business programs (or the business scenarios supported by the business programs) can be different or the same. Then, the leaked memory value is compared with the memory leak threshold, so that when the leaked memory value reaches the leaked memory threshold, the source code file of the business program is repaired so that the repaired source code file solves the memory leak problem existing in the business program.
[0083] It should be noted that, when the leaked memory value reaches the leaked memory threshold, it can be considered that the impact of the business program's memory leak problem on the business service provided by the business program has reached the impact threshold, so the source code file of the business program needs to be repaired; and when the leaked memory value does not reach the leaked memory threshold, it can be considered that the impact of the business program's memory leak problem on the business service provided by the business program has not reached the impact threshold, and the source code file of the business program may not be repaired at this time, and of course the source code file of the business program may also be repaired, which can be set specifically according to needs. Here, since the leaked memory value is determined based on the business weight and memory size, and the business weight can indicate the importance of the corresponding business program (or the business scenario (or business) supported by the business program), and the business weight is proportional to the importance, the higher the importance of the business program, the lower the impact that the business service provided by the business program can accept, then the corresponding impact threshold of the business program is lower, and the business weight of the business program is higher. In this way, the memory leak of the business program is processed in combination with the business weight of the business program. When the leaked memory value of the leaked memory of the business program reaches the leaked memory threshold, the source code file of the business program is repaired to solve the memory leak problem of the business program. That is, the memory leak problem is processed according to the impact of the memory leak on the business service (determined according to whether the leaked memory value reaches the leaked memory threshold), which ensures the service performance of the business program and improves the processing effect of the memory leak of the business program.
[0084] In some embodiments, when the leaked memory value reaches the leaked memory threshold, the source code file of the business program can be automatically repaired; or the source code file of the business program can be repaired manually. In some embodiments, when the leaked memory value reaches the leaked memory threshold, the source code file of the business program can be automatically repaired first. When the number of automatic repairs of the source code file exceeds the repair number threshold, if the business program still has a memory leak problem, the source code file of the business program can be repaired manually to continue repairing.
[0085] In some embodiments, when the leaked memory value does not reach the leaked memory threshold, the source code file of the business program may be repaired or may not be repaired.
[0086] In some embodiments, the business program is a business program involved in the test. Based on this, if there is no memory leak in the business program, it is determined that the test for the business program has passed; and if it is determined that there is no memory leak in the business program after the source code file is repaired, it is also determined that the test for the business program has passed.
[0087] In some embodiments, when the leaked memory value reaches the leaked memory threshold, before repairing the source code file of the business program, the following steps can also be performed: obtain the available memory size of the available memory, and obtain the threshold weight corresponding to the business program; based on the available memory size and the threshold weight, determine the leaked memory threshold corresponding to the business program.
[0088] Here, first obtain the available memory size of the available memory, which is related to the hardware of the electronic device, such as 500mb. Then obtain the threshold weight corresponding to the business program (or the business scenario supported by the business program), which is set for each business program (or the business scenario supported by the business program), and the threshold weights of different business programs (or business scenarios) can be the same or different. For example, the threshold weight of business program 1 is 80%, the threshold weight of business program 2 is 30%, and the threshold weight of business program 3 is 50%. Based on this, based on the available memory size and the threshold weight, determine the leaked memory threshold corresponding to the business program, and the available memory size and the threshold weight can be multiplied to obtain the multiplication result, so as to use the multiplication result of the available memory size and the threshold weight as the leaked memory threshold corresponding to the business program. For example, the leaked memory threshold corresponding to business program 1 = 500mb*80% = 400mb. In this way, the corresponding leaked memory threshold can be determined for each business program, so that the importance of different business programs can be distinguished, and it is reasonably determined whether the business program needs code repair.
[0089] In some embodiments, see Figure 3B , the source code file of the business program can be repaired by executing the following steps 201-203: Step 201, determine the memory leak location of the business program, and extract the first code file corresponding to the memory leak location from the source code file; Step 202, repair the first code file to obtain the second code file; Step 203, replace the first code file in the source code file with the second code file.
[0090] For step 201, the memory leak location of the business program can be determined, and the memory leak location can be the specific object that generates the memory leak, so that based on the memory leak location, the first code file corresponding to the memory leak location is extracted from the source code file. In practical applications, the memory leak location can be located in the above-mentioned memory leak detection methods, which will not be repeated here. For step 202, the first code file corresponding to the memory leak location is repaired to obtain a second code file. In this way, the efficiency of code repair can be improved, and only the code file where the memory leak occurs needs to be repaired. For step 203, the first code file in the source code file is replaced with the second code file, thereby achieving the effect of overwriting the first code file with the second code file, and repairing the source code file.
[0091] In some embodiments, see Figure 3C , the first code file can be repaired by executing the following steps 2021-2023 to obtain a second code file: Step 2021, perform syntax tree analysis on the first code file to obtain a code syntax tree; Step 2022, based on the code syntax tree, determine the target code that meets the conditions from the first code file; Step 2023, use the target container element in the first code file to wrap the target code to obtain a second code file.
[0092] For step 2021, a syntax tree analysis is performed on the first code file to obtain a code syntax tree. For example, syntax tree analysis is the process of converting the first code file into an abstract syntax tree (AST). This process is usually divided into two main steps: lexical analysis and syntax analysis, which are usually collectively referred to as parsing. The following are the basic steps for parsing the abstract syntax tree: 1) Lexical analysis: Lexical analysis is a preliminary processing of the first code file, which decomposes the character sequence of the first code file into tokens. Tokens are basic elements in the first code file, such as keywords, identifiers, literals, operators, etc. The result of lexical analysis is a token stream. 2) Syntax analysis: Syntax analysis is the second step, which converts the token stream into an abstract syntax tree. An abstract syntax tree is a tree-like data structure that represents the syntax structure of the first code file without considering its physical order in the first code file. During the syntax analysis process, the compiler checks whether the syntax of the first code file is correct, that is, whether the token stream can form a valid syntax structure. 3) Parsing: Parsing is a general term for lexical analysis and syntax analysis, which converts the first code file into an abstract syntax tree. Parsing is usually implemented using a parser, which is a component in the compiler that is responsible for reading the token stream and building an abstract syntax tree. 4) Abstract syntax tree: An abstract syntax tree is a static tree structure that represents the syntax structure of the first code file. Each node in the AST represents a syntax structure in the first code file, such as a variable declaration, a function call, a conditional statement, etc.
[0093] For step 2022, based on the code syntax tree, determine the qualified target code from the first code file. Here, the code syntax tree represents the grammatical structure of the first code file. By searching in the code syntax tree, the qualified target code can be found from the first code file. The qualified target code is: unofficial or non-standard target code written by developers. For example, the target code can be a non-Vue native plug-in in the first code file. The non-Vue native plug-in generally refers to a third-party plug-in or component that is not developed or maintained by the official Vue.js team. Non-Vue native plug-ins may provide functions that are compatible with Vue.js, but they are not part of the Vue.js ecosystem. In this way, the efficiency of code repair can be improved, and only specific code files that meet the conditions need to be repaired.
[0094] For step 2023, the target container element is used in the first code file to wrap the target code to obtain a second code file. For example, the target container element can be a div element. In HTML, the div element is a block-level container element used to organize content into independent areas that usually have the same style, such as using a div element to wrap the target code (i.e., HTML element or content).
[0095] In some embodiments, when the leaked memory value reaches a leaked memory threshold, the source code file of the business program can be repaired by executing the following steps: determining the number of times the source code file of the business program has been repaired; and when the number of repairs does not exceed the repair number threshold, repairing the source code file of the business program.
[0096] Here, when the leaked memory value reaches the leaked memory threshold, the number of times the source code file of the business program has been repaired can be determined. If the number of times the source code file has been repaired does not exceed the repair number threshold, the source code file of the business program is repaired; and when the number of times the source code file has been repaired exceeds the repair number threshold, if the business program still has a memory leak problem, a manual repair method can be used to continue repairing the source code file of the business program. In this way, the efficiency and accuracy of code repair can be improved.
[0097] In some embodiments, the business program is the business program being tested. After repairing the source code file of the business program, the following operations may also be performed: compiling the repaired source code file to obtain a target business program; running the target business program, and performing a memory leak detection on the target business program during the running of the target business program; and determining that the test for the target business program has passed if there is no memory leak in the target business program.
[0098] Here, the business program is the business program being tested. After the source code file is repaired, the repaired source code file is compiled to obtain the target business program. Then the target business program is run, and during the running of the target business program, the target business program is again tested for memory leaks; if there is no memory leak in the target business program, it is determined that the test for the target business program has passed; if there is a memory leak in the target business program, steps 101 to 103 provided in the embodiment of the present application are executed for the target business program.
[0099] By applying the above-mentioned embodiment of the present application, for a business program with a memory leak, the business weight of the business program is obtained, and the size of the memory leaked by the business program is determined, and then based on the business weight and the memory size, the leaked memory value of the business program is determined, so that when the leaked memory value reaches the leaked memory threshold, the source code file of the business program is repaired. Here, only when the leaked memory value determined in combination with the business weight of the business program reaches the leaked memory threshold, the source code file of the business program is repaired to solve the memory leak problem of the business program, so that not only the business performance of the business program is guaranteed, but also the processing efficiency of the memory leak of the business program is improved, thereby improving the processing effect of the memory leak of the business program.
[0100] The following describes an exemplary application of an embodiment of the present application in an actual application scenario. First, the nouns involved in the embodiment of the present application are explained, including: 1) Vue framework (Vue.js), which is a progressive JavaScript framework for building user interfaces, implementing data-driven views and component-based development. 2) Vue template syntax, which is a declarative data binding and instruction system for building dynamic, responsive HTML views. 3) Front-end memory leaks, objects that are no longer used are not released, and continue to occupy memory, resulting in performance degradation. 4) Memlab, a tool for detecting JavaScript memory leaks, helps developers locate memory problems in front-end applications through visualization and analysis.
[0101] Due to the rapid development of Web technology, various front-end frameworks have emerged, especially the software design pattern (Model-View-ViewModel, MVVM) framework represented by Vue and React is the most popular. It displays and browses in the form of single-page application (SPA) to improve user experience. The main implementation logic in SPA applications is to build a virtual DOM. Virtual DOM is an optimization strategy widely used in modern JavaScript frameworks (such as React, Vue, etc.). It is a lightweight JavaScript object tree built in memory that simulates the real DOM structure. In Web development, whenever the application state changes, it is usually necessary to update the DOM elements on the page to reflect the new state. However, directly operating the DOM is a very expensive operation because it causes the browser to recalculate the layout (Layout), redraw (Paint) and composite (Composite). Especially when a large number of frequent DOM operations are performed, the performance will be significantly reduced. Front-end memory leak refers to the phenomenon that in Web front-end development, JavaScript objects in the browser are not released in time due to JavaScript code errors or improper programming habits, thereby continuously occupying memory space. As the page loads and the user interacts, these unreleased objects will gradually accumulate if memory resources are not managed effectively, which may eventually cause the browser to consume too much memory, resulting in performance degradation, page freezes, or even crashes. In programs built using virtual DOM, frequent rendering of the DOM tree can easily cause browser freezes or even crashes. Therefore, how to effectively and efficiently identify and eliminate memory leaks is a very important part of the current virtual DOM framework application.
[0102] In the related technologies, (1) memory leaks are prevented beforehand; (2) memory leaks are remedied afterward. However, (1) must be based on specifications, and the specifications in the related technologies cannot completely solve the problem of front-end memory leaks. And (2) remediation afterward has actually caused business impact, which is the worst solution to the problem.
[0103] Based on this, the embodiment of the present application provides a method for handling memory leaks. By designing a front-end performance evaluation card point module and a front-end automatic memory leak repair compilation module (mbp-compiler), combined with various business scenarios in the telemarketing business, a corresponding impact threshold (i.e., memory leak threshold) is designed for each business scenario, and combined with the automatic memory leak repair compilation module, the compilation method is used to assist in efficiently solving the problem of memory leaks and ensure business continuity. In this way, (1) by evaluating the impact of the front-end performance problem on each page in the business program, setting the impact threshold, and using the automatic memory leak repair solution, the front end is assisted to efficiently solve the performance problems caused by memory leaks to the business program; (2) the online process is automated, the front-end performance problem is intelligently reminded, and the attribution analysis is assisted, thereby improving the professional capabilities of the front-end R&D. See Figure 4 , the processing methods of memory leaks include: 1. Develop business programs in the field of telemarketing according to front-end specifications; 2. System testing; 3. Detection of MEMLAB memory leaks; 4. Output performance test reports of business programs according to the field of telemarketing; 5. Whether the business program has memory leaks, if so, execute 6, if not, execute 7; 6. Pass the test; 7. Obtain the impact area of the telemarketing field; 8. Whether the impact area reaches the impact area threshold, if so, execute 9, 10 and 11 in sequence, if not, execute 12, 13, 14 and 15 in sequence; 9. MBP-Compiler; 10. Overwrite; 11. Automatic submission; 12. MBP-Compiler; 13. Overwrite; 14. Manual detection; 15. Manual submission. Here, Vue-Compiler is used to compile the template of the single-file component (.vue) into an executable JavaScript render function. MBP-Complier is an automatic solution plug-in for telemarketing memory leaks, which inherits and overrides Vue-Compiler, combines template syntax, and automatically repairs the code. System testing: Testers conduct functional and system testing of business programs. Figure 5,The processing method of memory leak includes: 1. Code testing for business programs; 2. Detection of memlab memory leaks; 3. Whether memory leaks occur, if not, execute 4, if yes, execute 5; 4 is tested normally and the test is launched; 5. Calculate the impact area (i.e. the above-mentioned leaked memory value); 6. Whether the impact area reaches the impact threshold (i.e. the above-mentioned leaked memory threshold), if not, execute 7, if yes, execute 8; 7. Send front-end report; 8. Get the source code of the business program; 9. Vue-Compiler; 10. Get the AST abstract syntax tree of the source code through Parser; 11. MBP-Compiler; 12. Extract non-Vue native code from the abstract syntax tree; 13. Wrap and overwrite non-Vue native code with div; 14. Whether the number of repairs exceeds the threshold of the number of automatic repairs (such as 3 times), if yes, execute 15, if not, return 1; 15. Manually check and repair. Specifically, 1) Establish the page refresh frequency and impact area threshold in the business programs of each business scenario in the telemarketing domain. For example: 1.1) Set business weights for each domain (business scenario). The higher the business weight, the more important it is. For example, the business weight of the list dialing domain is 10, the business weight of the list query domain is 5, and the business weight of the list scheduling domain is 5. 1.2) Calculate indicators: the maximum page refresh frequency of each core page. For example, the list operation workbench page has a maximum refresh of 400 times per day; the list allocation page has a maximum refresh of 50 times per day. 1.3) Use memlab to count the memory leak size of the business program (that is, the leaked memory value mentioned above). For example, the memory leak size of the list operation workbench is 30mb; the memory leak size of the list query page is 20mb. 1.4) Set the impact surface threshold based on the hardware indicators of the device (such as 80% available memory). For example, if the available memory size of the on-site browser is 500mb, then the impact surface threshold is 500*80%=400mb. 2) Relying on vue-compiler and parse plug-ins, analyze the abstract syntax tree of the source code of the business program, establish corresponding rules, and overwrite the source code with mbp-compiler. 2.1) Analyze the abstract syntax tree of the source code through Parse. For example, the source code is as follows:
[0104] Analyze into abstract syntax tree:
[0105]
[0106] 2.2) Focus on the code of non-vue native plug-ins. For example, element-ui, e-col elements, combined with v-if. Then the compilation rules will be taken over by mbp-compiler to reconstruct the code.
[0107] 2.3) Refactor the overwriting code. After the e-col part is compiled, the native HTML element is wrapped by div, taking over the native Vue template syntax logic such as v-if. For example, the native HTML element is wrapped by div, and the result is:
[0108]
[0109] Hence, see Figure 6 The code repair process includes: 1. Determine the memory leak location and extract the first code file at the memory leak location; 2. Perform ATS abstract syntax tree analysis on the first code file; 3. Wrap the code of the non-vue native plug-in through the div element to obtain the overwritten second code file; 4. Use the second code file to replace the first code file.
[0110] By applying the above embodiments of the present application, (1) an automated process for front-end performance monitoring and evaluation is established to maximize the robustness of the system. (2) A performance evaluation standard for the telemarketing domain is established. By setting card points that affect memory, business continuity is effectively guaranteed (system functions will not be unable to go online due to pages with smaller memory leaks). (3) Through automated compilation, repair rules are established to automatically repair suspected memory leaks. In combination with memory leak monitoring tools, code memory leak performance issues can be efficiently handled.
[0111] The following further describes an exemplary structure of the memory leak processing device 555 provided in the embodiment of the present application implemented as a software module. In some embodiments, for example Figure 2 As shown, the software modules in the memory leak processing device 555 stored in the memory 550 may include: an acquisition module 5551, used to obtain the business weight of the business program with memory leak and determine the size of the memory leaked by the business program; a determination module 5552, used to determine the leaked memory value of the business program based on the business weight and the memory size; a repair module 5553, used to repair the source code file of the business program when the leaked memory value reaches a leaked memory threshold.
[0112] In some embodiments, the acquisition module 5551 is also used to obtain the refresh parameters of the page in the business program, and obtain the occupied memory size of the page when it is refreshed; based on the refresh parameters and the occupied memory size, determine the memory size leaked by the business program.
[0113] In some embodiments, the acquisition module is also used to obtain the refresh frequency of the page in multiple statistical periods within a target time period; based on the refresh frequency in the multiple statistical periods, determine the refresh parameter, and the refresh parameter includes one of the following parameters: the maximum refresh frequency among the multiple refresh frequencies, and the average refresh frequency of the multiple refresh frequencies.
[0114] In some embodiments, the acquisition module 5551 is also used to obtain the characteristics of the business scenario corresponding to the business program; based on the characteristics of the business scenario, call the machine learning model to predict the business weight of the business program to obtain the business weight of the business program.
[0115] In some embodiments, the acquisition module 5551 is further used to obtain parameter values of parameters affecting the business weight, and obtain a mapping relationship between the parameter values and the business weight; and determine the business weight based on the parameter values and the mapping relationship.
[0116] In some embodiments, the acquisition module 5551 is further used to update the business weight of the business program based on the changed parameter value of the influencing parameter when the parameter value of the influencing parameter changes.
[0117] In some embodiments, the repair module 5553 is also used to determine the memory leak location of the business program, and extract the first code file corresponding to the memory leak location from the source code file; repair the first code file to obtain a second code file; and replace the first code file in the source code file with the second code file.
[0118] In some embodiments, the repair module 5553 is also used to perform syntax tree analysis on the first code file to obtain a code syntax tree; based on the code syntax tree, determine qualified target code from the first code file; and use a target container element in the first code file to wrap the target code to obtain the second code file.
[0119] In some embodiments, the repair module 5553 is also used to obtain the available memory size of the available memory and the threshold weight corresponding to the business program before repairing the source code file of the business program when the leaked memory value reaches the leaked memory threshold; and determine the leaked memory threshold corresponding to the business program based on the available memory size and the threshold weight.
[0120] In some embodiments, the business program is the business program being tested, and the repair module 5553 is also used to, after repairing the source code file of the business program, compile the repaired source code file to obtain a target business program; run the target business program, and during the running of the target business program, perform a memory leak detection on the target business program; and determine that the test for the target business program has passed if there is no memory leak in the target business program.
[0121] In some embodiments, the repair module 5553 is further used to determine the number of times the source code file of the business program has been repaired; if the number of times the source code file has been repaired does not exceed a repair number threshold, repair the source code file of the business program.
[0122] It should be noted that the description of the device embodiment in this application is similar to the description of the method embodiment above, and has similar beneficial effects as the method embodiment, which will not be described in detail here. The unfinished technical details in the memory leak processing device provided in the embodiment of this application can be understood based on the description of the technical details in the method embodiment above.
[0123] The embodiment of the present application also provides a computer program product, which includes computer executable instructions or computer programs, and the computer executable instructions or computer programs are stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instructions or computer program from the computer-readable storage medium, and the processor executes the computer executable instructions or computer program, so that the electronic device executes the memory leak processing method provided in the embodiment of the present application.
[0124] An embodiment of the present application also provides a computer-readable storage medium, in which computer-executable instructions or a computer program are stored. When the computer-executable instructions or the computer program are executed by a processor, the processor will execute the memory leak processing method provided in the embodiment of the present application.
[0125] 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.
[0126] 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.
[0127] 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).
[0128] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.
[0129] 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 method for processing memory leaks, characterized in that: The method comprises: Obtaining the business weight of the business program with memory leak, and determining the size of the memory leaked by the business program; Determine the leaked memory value of the business program based on the business weight and the memory size; When the leaked memory value reaches a leaked memory threshold, the source code file of the business program is repaired.
2. The method according to claim 1, characterized in that Determining the size of memory leaked by the business program includes: Obtaining a refresh parameter of a page in the business program, and obtaining a memory size occupied by the page when refreshing; Based on the refresh parameter and the occupied memory size, the memory size leaked by the business program is determined.
3. The method according to claim 2, characterized in that The obtaining of refresh parameters of the page in the business program includes: Obtain the refresh frequency of the page in multiple statistical periods within a target time period; Based on the refresh frequencies in the multiple statistical periods, the refresh parameter is determined, and the refresh parameter includes one of the following parameters: a maximum refresh frequency among the multiple refresh frequencies, and an average refresh frequency of the multiple refresh frequencies.
4. The method according to claim 1, characterized in that The obtaining of the business weight of the business program with memory leak includes: Acquire characteristics of the business scenario corresponding to the business program; Based on the characteristics of the business scenario, a machine learning model is called to predict the business weight of the business program to obtain the business weight of the business program.
5. The method according to claim 1, characterized in that The obtaining of the business weight of the business program with memory leak includes: Obtaining parameter values of parameters influencing the service weight, and obtaining a mapping relationship between the parameter values and the service weight; The service weight is determined based on the parameter value and the mapping relationship.
6. The method according to claim 5, characterized in that The method further comprises: When the parameter value of the influencing parameter changes, the business weight of the business program is updated based on the changed parameter value of the influencing parameter.
7. The method according to claim 1, characterized in that The source code file for repairing the business program includes: Determine a memory leak location of the business program, and extract a first code file corresponding to the memory leak location from the source code file; Repairing the first code file to obtain a second code file; The first code file in the source code file is replaced by the second code file.
8. The method according to claim 7, characterized in that The repairing of the first code file to obtain a second code file includes: Performing syntax tree analysis on the first code file to obtain a code syntax tree; Based on the code syntax tree, determining a target code that meets the conditions from the first code file; The target container element is used in the first code file to wrap the target code to obtain the second code file.
9. The method according to claim 1, characterized in that When the leaked memory value reaches the leaked memory threshold, before repairing the source code file of the business program, the method further includes: Obtaining the available memory size of the available memory, and obtaining the threshold weight corresponding to the business program; Based on the available memory size and the threshold weight, a leakage memory threshold corresponding to the business program is determined.
10. The method according to claim 1, characterized in that The business program is a tested business program, and after repairing the source code file of the business program, the method further includes: Compile the repaired source code file to obtain the target business program; Running the target business program, and performing memory leak detection on the target business program during the running of the target business program; When there is no memory leak in the target business program, it is determined that the test on the target business program passes.
11. The method according to claim 1, characterized in that When the leaked memory value reaches a leaked memory threshold, repairing the source code file of the business program includes: Determining the number of times a source code file of the business program has been repaired; When the number of repairs does not exceed a repair number threshold, the source code file of the business program is repaired.
12. A memory leak processing device, characterized in that: The device comprises: An acquisition module, used to acquire the business weight of a business program with a memory leak and determine the size of the memory leaked by the business program; A determination module, configured to determine a leaked memory value of the business program based on the business weight and the memory size; A repair module is used to repair the source code file of the business program when the leaked memory value reaches a leaked memory threshold.
13. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions; A processor, configured to implement the memory leak processing method according to any one of claims 1 to 11 when executing computer executable instructions stored in the memory.
14. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer programs are executed by a processor, the method for processing memory leaks described in any one of claims 1 to 11 is implemented.
15. A computer program product comprising computer executable instructions or a computer program, characterized in that When the computer executable instructions or computer programs are executed by a processor, the method for processing memory leaks described in any one of claims 1 to 11 is implemented.
Citation Information
Cited By
Memory leak processing method and system of kernel mode system and readable storage medium
CN121705041A
