Memory leak detection method and device, equipment and medium
By obtaining the linked list information of the application and analyzing the function call stack, the problem of low memory leakage detection efficiency in the existing technology is solved, and the thread-level refined detection and rapid location of memory leakage are realized, which improves the detection speed and accuracy.
Patent Information
- Application Number
- CN202410992995.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-12
AI Technical Summary
In the prior art, memory leakage detection mainly relies on manual inspection, and there are problems of high missed detection rate and low efficiency, and there is a lack of fast and accurate detection methods.
By obtaining the linked list information of the application, calculating the memory size based on the identification information of the calling thread, and comparing it with the preset threshold, we can determine whether there is a memory leakage; when there is a leakage, we analyze the function call stack information and count the number of memory applications for intermediate functions. Positioning the exception function that causes the leakage.
It realizes thread-level refined memory leak detection, improves the speed, timeliness and accuracy of detection, and can quickly locate the location and cause of memory leaks.
Smart Images

Figure CN118939460A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a memory leak detection method, device, equipment and medium. Background Art
[0002] A memory leak is when an application does not release memory properly for some reason after requesting memory allocation. Memory leak is a common code defect that can cause the available memory to gradually decrease over time, eventually causing serious consequences such as slow application operation or even crash.
[0003] In the related art, when memory leak detection is performed, it is usually performed based on manual investigation. However, the manual investigation method usually has problems such as high missed detection rate and low efficiency. Therefore, there is an urgent need for a technical solution that can quickly and accurately perform memory leak detection. Summary of the invention
[0004] The present application provides a memory leak detection method, apparatus, device and medium for quickly and accurately performing memory leak detection.
[0005] In a first aspect, the present application provides a memory leak detection method, which is applied to an electronic device, and the method includes:
[0006] When the preset memory leak detection condition is met, the linked list information corresponding to each target application that is occupying the memory is obtained;
[0007] Based on the identification information of the calling thread currently stored in each of the linked list information, the memory size occupied by each calling thread is obtained;
[0008] Determine whether there is a memory leak based on the memory size occupied by each calling thread and the preset memory threshold.
[0009] Through the above method, for each target application that is occupying memory, the memory size occupied by each calling thread can be obtained based on the identification information of the calling thread currently stored in the linked list information of the target application, and based on the memory size occupied by each calling thread and the preset memory threshold, it is determined whether there is a memory leak, so that the presence of a memory leak can be detected in a refined manner at the thread level. Compared with the detection of whether there is a memory leak from a coarser granularity level such as the entire application, which leads to the inability to detect memory leaks in a timely and accurate manner, the method of detecting whether there is a memory leak in a refined manner at the thread level in the embodiment of the present application can improve the speed, timeliness and accuracy of memory leak detection.
[0010] In a possible implementation, determining whether there is a memory leak based on the memory size occupied by each calling thread and a preset memory threshold includes:
[0011] If there is a target calling thread whose occupied memory size exceeds the memory threshold, it is determined that there is a memory leak; otherwise, it is determined that there is no memory leak.
[0012] Through the above method, when there is a target calling thread whose occupied memory size exceeds the memory threshold, it is considered that there is a memory leak. Otherwise, it is considered that there is no memory leak. Therefore, it is possible to finely detect whether there is a memory leak based on the thread level, which can improve the precision, timeliness and accuracy of memory leak detection.
[0013] In a possible implementation, the method further includes:
[0014] If it is determined that there is a memory leak, then obtaining function call stack information of the memory request function called by the target calling thread;
[0015] Obtain information of each intermediate function that calls the memory request function through the function call stack information, and for each intermediate function, obtain the number of times the memory request function is called through the intermediate function;
[0016] The number of times each intermediate function corresponds to is output, so that the user can determine the abnormal function that causes the memory leak according to the number of times each intermediate function corresponds to.
[0017] Through the above method, when it is determined that there is a memory leak, the number of times each intermediate function calls the memory request function can be obtained and output, so that users (such as R&D personnel) can refer to the number of times each intermediate function calls the memory request function to quickly locate the abnormal function that causes the memory leak, that is, quickly locate the location where the memory leak occurs, thereby improving the speed and accuracy of locating the memory leak.
[0018] In a possible implementation manner, after obtaining the number of times the memory request function is called through the intermediate function, the method further includes:
[0019] According to the number of times each intermediate function corresponds to, an abnormal function causing the memory leak is determined.
[0020] Since the number of times the intermediate function calls the memory request function can accurately reflect whether a memory leak occurs to a certain extent, the electronic device can intelligently determine the abnormal function that causes the memory leak based on the number of times the intermediate function calls the memory request function, thereby intelligently, quickly and accurately locating the location that may cause the memory leak.
[0021] In a possible implementation, determining the abnormal function causing the memory leak according to the number of times corresponding to each intermediate function includes:
[0022] The intermediate function whose number of calls exceeds the set call number threshold is determined as the abnormal function.
[0023] Since the intermediate function whose number of calls to the memory allocation function exceeds the call number threshold is most likely the function where the memory leak occurs, the intermediate function whose number of calls to the memory allocation function exceeds the call number threshold is determined as an abnormal function, which can locate the location where the memory leak may occur intelligently, quickly and accurately to the greatest extent.
[0024] In a possible implementation, determining the abnormal function causing the memory leak according to the number of times corresponding to each intermediate function includes:
[0025] The numbers of times corresponding to the intermediate functions are sorted, and a set number of intermediate functions with high numbers in the sorting are determined as the abnormal functions.
[0026] Since the higher the number of times an intermediate function calls the memory allocation function, the greater the possibility that the intermediate function will cause a memory leak, a set number of intermediate functions that call the memory allocation function more frequently are identified as abnormal functions that may cause memory leaks, which can locate the location where the memory leak may occur intelligently and quickly to the greatest extent.
[0027] In a possible implementation, the process of determining the target application includes:
[0028] The application program with the call node mark added to the corresponding linked list information is determined as the target application program that is occupying the memory.
[0029] Through the above method, the applications marked with call nodes that have not been deleted in the linked list information can be considered as target applications that are occupying memory. Compared with the memory leak detection from all applications, the memory leak detection process can be performed quickly and accurately in a small range from these screened target applications, which can improve the speed and accuracy of memory leak detection.
[0030] In a possible implementation, the process of adding the calling node mark includes:
[0031] If a memory application request for the target application is received, the memory application function is called by the calling thread to allocate target memory for the target application, and a calling node mark is added to the linked list information corresponding to the target application, wherein the calling node mark includes the identification information of the calling thread.
[0032] Through the above method, since it is possible to add a call node mark to the linked list information corresponding to the application while allocating memory for the application, the call node mark can be used to indicate that the application is using memory and can include identification information of the calling thread, etc. Based on the call node mark, it is possible to quickly detect whether there is a memory leak and subsequently locate the location of the memory leak.
[0033] In a possible implementation, the method further includes:
[0034] If a memory release instruction for releasing the target memory is received for the target application, the target memory is released by calling a memory release function, and the calling node mark in the linked list information is deleted.
[0035] Through the above method, when the application no longer uses the memory (target memory) allocated to it, the target memory can be released and the corresponding call node mark in the linked list information can be deleted from the linked list information. This method can ensure that when the memory is allocated to the application and the memory is released normally, there will be no corresponding call node mark in the linked list information. When the memory is allocated to the application, but the memory is not released due to some abnormal situation, resulting in a memory leak, the corresponding call node mark in the linked list information will always exist, so that the memory leak can be detected quickly and accurately through the call node mark that has not been deleted in the linked list information, thereby improving the speed and accuracy of memory leak detection.
[0036] In a second aspect, the present application provides a memory leak detection device, which has the function of implementing the behavior of the electronic device in the method embodiment of the first aspect above. The beneficial effects can be found in the description of the first aspect and will not be repeated here. The memory leak detection device includes:
[0037] A first obtaining module is used to obtain linked list information corresponding to each target application that is occupying the memory when a preset memory leak detection condition is met;
[0038] A second obtaining module is used to obtain the memory size occupied by each calling thread based on the identification information of the calling thread currently stored in each of the linked list information;
[0039] The determination module is used to determine whether there is a memory leak based on the memory size occupied by each calling thread and a preset memory threshold.
[0040] In a possible implementation manner, the second obtaining module is specifically configured to:
[0041] If there is a target calling thread whose occupied memory size exceeds the memory threshold, it is determined that there is a memory leak; otherwise, it is determined that there is no memory leak.
[0042] In a possible implementation, the device further includes:
[0043] A positioning module is used to obtain the function call stack information of the memory request function called by the target calling thread if a memory leak is determined; obtain the information of each intermediate function that calls the memory request function through the function call stack information, and for each intermediate function, obtain the number of times the memory request function is called through the intermediate function; output the number of times corresponding to each intermediate function, so that the user can determine the abnormal function that causes the memory leak based on the number of times corresponding to each intermediate function.
[0044] In a possible implementation manner, the positioning module is further used to:
[0045] According to the number of times each intermediate function corresponds to, an abnormal function causing the memory leak is determined.
[0046] In a possible implementation manner, the positioning module is specifically used to:
[0047] The intermediate function whose number of calls exceeds the set call number threshold is determined as the abnormal function.
[0048] In a possible implementation manner, the positioning module is specifically used to:
[0049] The numbers of times corresponding to the intermediate functions are sorted, and a set number of intermediate functions with high numbers in the sorting are determined as the abnormal functions.
[0050] In a possible implementation manner, the first obtaining module is specifically configured to:
[0051] The application program with the call node mark added to the corresponding linked list information is determined as the target application program that is occupying the memory.
[0052] In a possible implementation manner, the first obtaining module is specifically configured to:
[0053] If a memory application request for the target application is received, the memory application function is called by the calling thread to allocate target memory for the target application, and a calling node mark is added to the linked list information corresponding to the target application, wherein the calling node mark includes the identification information of the calling thread.
[0054] In a possible implementation manner, the first obtaining module is specifically configured to:
[0055] If a memory release instruction for releasing the target memory is received for the target application, the target memory is released by calling a memory release function, and the calling node mark in the linked list information is deleted.
[0056] In a third aspect, the present application further provides an electronic device, which includes at least a processor and a memory, and the processor is used to implement the steps of the memory leak detection method as described in any one of the first aspects when executing a computer program stored in the memory.
[0057] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the steps of the memory leak detection method as described in any one of the first aspects.
[0058] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes: a computer program code, which, when executed on a computer, enables the computer to execute the steps of the memory leak detection method as described in any one of the first aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the implementation methods in the embodiments of the present application or the related technologies, the following is a brief introduction to the drawings required for use in the embodiments or the related technology descriptions. Obviously, the drawings described below are some embodiments of the present application, and a person skilled in the art can also obtain other drawings based on these drawings.
[0060] Figure 1 A schematic diagram of a memory leak detection process provided in an embodiment of the present application;
[0061] Figure 2 A schematic diagram of a memory request function calling process provided in an embodiment of the present application;
[0062] Figure 3 A schematic diagram of a memory release function calling process provided in an embodiment of the present application;
[0063] Figure 4 A schematic diagram of another memory leak detection process provided in an embodiment of the present application;
[0064] Figure 5 A schematic diagram of another memory leak detection process provided in an embodiment of the present application;
[0065] Figure 6 A schematic diagram of another memory leak detection process provided in an embodiment of the present application;
[0066] Figure 7 A schematic diagram of the structure of a memory leak detection device provided in an embodiment of the present application;
[0067] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0068] In order to make the purpose and implementation method of the present application clearer, the exemplary implementation method of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0069] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.
[0070] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.
[0071] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0072] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0073] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0074] For the convenience of explanation, the above description has been made in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.
[0075] The embodiment of the present application provides a memory leak detection method, device, equipment and medium. In the method, when the preset memory leak detection conditions are met, the linked list information corresponding to each target application that is occupying the memory can be obtained; based on the identification information of the calling thread currently saved in each linked list information, the memory size occupied by each calling thread is obtained; and based on the memory size occupied by each calling thread and the preset memory threshold, it is determined whether there is a memory leak. Since the memory size occupied by each calling thread can be obtained for each target application that is occupying the memory based on the identification information of the calling thread currently saved in the linked list information of the target application, and based on the memory size occupied by each calling thread and the preset memory threshold, it is determined whether there is a memory leak, so that the presence of a memory leak can be finely detected at the thread level. Compared with the detection of whether there is a memory leak from a coarse granularity level such as the entire application, which leads to the inability to detect the memory leak in a timely and accurate manner, the embodiment of the present application can detect whether there is a memory leak in a fine manner at the thread level, which can improve the speed, timeliness and accuracy of memory leak detection.
[0076] Embodiment 1:
[0077] Figure 1 A schematic diagram of a memory leak detection process provided in an embodiment of the present application, the process includes:
[0078] S101: When a preset memory leak detection condition is met, link list information corresponding to each target application that is occupying the memory is obtained.
[0079] The memory leak detection method provided in the embodiment of the present application is applied to an electronic device, which may be, for example, a personal computer (PC), a mobile terminal, a server, etc., and the present application does not specifically limit this. Optionally, a system such as a baseboard management controller (BMC) may be installed in the electronic device.
[0080] In a possible implementation, the electronic device may start detecting whether there is a memory leak when a preset memory leak detection condition is met. Exemplarily, determining whether the preset memory leak detection condition is met may be determining whether a preset detection time has been reached. For example, assuming that a memory leak detection is performed once every hour, and the last memory leak detection was performed at 08:00 am, then at 09:00 am, it may be determined that the preset memory leak detection condition is met, and the memory leak detection process may be performed again.
[0081] As another example, determining whether the preset memory leak detection condition is met may also be determining whether the current available memory size of the electronic device is less than a set available memory threshold. If the current available memory size is less than the set available memory threshold, it can be considered that the possibility of a memory leak at this time is relatively high, and it can be considered that the preset memory leak detection condition is met, and a process of detecting whether a memory leak exists can be performed.
[0082] In a possible implementation, when detecting whether there is a memory leak, the linked list information corresponding to each application currently occupying the memory (for ease of description, the application currently occupying the memory is referred to as the target application) can be obtained first. Among them, for any application, the linked list information corresponding to the application can be created during the initialization of the application. Optionally, multiple applications can share a linked list, and the linked list information of each application is configured in the shared linked list. In addition, each application can correspond to a dedicated linked list, and for each application, the linked list information of the application can be configured in the linked list dedicated to the application, and the present application does not make specific limitations on this. Whether multiple applications share a linked list or each application corresponds to a dedicated linked list, for any application, the configuration process of the information in the linked list information corresponding to the application can be as follows.
[0083] In a possible implementation, for any application (such as a target application), when a memory application request for the application is received, a process of allocating memory for the application can be performed by calling a thread. Exemplarily, a memory application function can be called by calling a thread, so that target memory can be allocated for the application based on the memory application function, and a calling node tag can be added to the linked list information corresponding to the application, and the calling node tag can include the identification information of the calling thread.
[0084] Each application may have its own thread. For each application, the application may have multiple threads serving it, or only one thread serving it. For multiple memory application requests of an application, the above-mentioned process of allocating memory for the application may be performed separately by one or more threads, and this application does not make any specific limitation on this.
[0085] In a possible implementation, the call node tag added to the linked list information corresponding to the application can be used to record some call information of the memory application function, thread, etc. when allocating memory for the application this time. Exemplarily, the call node tag can include the name of the above-mentioned calling thread, unique number (identity document, id) and other identification information, and can also include the memory first address of the memory applied for the application this time, the length of the memory applied (memory size) and other information. Other information contained in the call node tag will be introduced later, and will not be repeated here. Among them, the identification information of the calling thread can be obtained through the thread external interface, etc., which will not be repeated here.
[0086] In a possible implementation, considering that the existing original memory application function (such as malloc, etc.) can usually only allocate memory for an application, and the embodiment of the present application can add (create) corresponding call node tags in the linked list information corresponding to the application while allocating memory for the application, the two tasks can be performed by the improved memory application function (such as malloc_f). At the same time, considering that if the original memory application functions involved in the existing code are all replaced with the improved memory application function, the workload is large. In order to be able to quickly use (call) the improved memory application function, it can be that when the function to be called is identified as the original memory application function, the function to be called is replaced by the original memory application function without feeling with the improved memory application function through the preset first function pointer, thereby calling the improved memory application function. Unless otherwise specified, the memory application functions mentioned in the embodiment of the present application are all improved memory application functions. That is to say, when it is identified that the function to be called is the original memory request function, the improved memory request function can be called based on the preset first function pointer instead of the original memory request function. In this way, the original memory request function and the improved memory request function can be seamlessly replaced without modifying the original memory request function contained in the original code, thereby improving efficiency.
[0087] For ease of understanding, the process of calling the modified memory allocation function in the embodiment of the present application is explained below through a specific embodiment. Figure 2 , Figure 2A schematic diagram of a memory request function calling process provided in an embodiment of the present application, the process includes the following steps:
[0088] S201: If it is identified that the function to be called is the original memory allocation function (such as malloc), based on a preset first function pointer, an improved memory allocation function (such as malloc_f) is called.
[0089] S202: a process of allocating memory for an application based on the improved memory application function and adding a calling node identifier to the linked list information corresponding to the application.
[0090] When allocating memory to an application based on a memory application function (such as malloc_f), the function address of the original memory application function (such as malloc) can be found in the libc function library, and the process of allocating memory to the application is performed by executing the code at the function address, which will not be described in detail here. The libc function library is the ANSI C standard function library under the Linux system, which will not be described in detail here.
[0091] Among them, when adding a call node identifier to the linked list information corresponding to the application, a call node identifier can be created at the end of the linked list information corresponding to the application, and the identification information of the calling thread, the memory first address and other information can be saved in the call node identifier, which will not be repeated here.
[0092] Since the present application can allocate memory for an application and also add a call node mark in the linked list information corresponding to the application, the call node mark can be used to indicate that the application is using memory and can include identification information of the calling thread, etc. Based on the call node mark, it is possible to quickly detect whether there is a memory leak and subsequently locate the location of the memory leak.
[0093] In a possible implementation, after the target memory is allocated to the application, when the application no longer uses the target memory, etc., the target memory may be released. Optionally, upon receiving a memory release instruction for releasing the target memory for an application (such as a target application), the target memory allocated for the application may be released by calling a memory release function, and the corresponding call node mark in the linked list information corresponding to the application may be deleted.
[0094] Specifically, when releasing the target memory, the memory release function can be called by calling the thread, and the target memory starting address of the memory to be released can be obtained according to the parameters passed by the memory release function (for the convenience of description, the memory starting address of the memory to be released is called the target memory starting address), etc. After that, all the call node tags in the linked list information of the application can be traversed to find the call node tag whose memory starting address and the target memory starting address are the same, and the call node tag can be deleted from the linked list information.
[0095] Because the present application can release the target memory and delete the corresponding call node mark in the linked list information from the linked list information when the application no longer uses the memory (target memory) allocated to it. This method can make it so that when the memory is allocated to the application and the memory is released normally, there will be no corresponding call node mark in the linked list information. When the memory is allocated to the application, and the memory is not released due to some abnormal situation, resulting in a memory leak, the corresponding mobilization node mark in the linked list information will always exist, so that the call node mark that has not been deleted in the linked list information can be used to quickly and accurately detect memory leaks, thereby improving the speed and accuracy of memory leak detection.
[0096] In a possible implementation, considering that the existing original memory release function (such as free, etc.) can usually only release the memory allocated for the application, and the embodiment of the present application can release the memory allocated for the application while also deleting the corresponding call node mark in the linked list information corresponding to the application, the two tasks can be performed by the improved memory release function (such as free_f). At the same time, considering that if the original memory release functions involved in the existing code are replaced with the improved memory release function, the workload is large. In order to be able to quickly use (call) the improved memory release function, it can be that when the function to be called is identified as the original memory release function, the function to be called is replaced by the original memory release function without feeling with the improved memory release function through the preset second function pointer, thereby calling the improved memory release function. Unless otherwise specified, the memory release functions mentioned in the embodiments of the present application are all improved memory release functions. That is to say, when it is identified that the function to be called is the original memory release function, the improved memory release function can be called based on the preset second function pointer instead of calling the original memory release function, thereby achieving a seamless replacement between the original memory release function and the improved memory release function. There is no need to modify the original memory release function contained in the original code, which can improve efficiency.
[0097] For ease of understanding, the process of calling the modified memory release function in the embodiment of the present application is explained below through a specific embodiment. Figure 3 , Figure 3 A schematic diagram of a memory release function calling process provided in an embodiment of the present application, the process includes the following steps:
[0098] S301: If it is identified that the function to be called is the original memory release function (such as free), based on the preset second function pointer, the improved memory allocation function (such as free_f) is called.
[0099] S302: A process of releasing the memory allocated for the application based on the improved memory release function and deleting the corresponding call node identifier in the linked list information corresponding to the application.
[0100] Among them, when releasing the memory allocated for the application based on the memory release function (such as malloc_f), the function address of the original memory release function (such as free) can be found in the libc function library, and the process of releasing the memory allocated for the application is executed by executing the code at the function address, which will not be repeated here.
[0101] Among them, when deleting the corresponding call node identifier in the linked list information corresponding to the application, the call node identifier whose memory first address is the same as the target memory first address can be searched among the call node identifiers in the linked list information, and the call node identifier can be deleted from the linked list information. No further details will be given here.
[0102] It can be understood that, for any application, if a call node mark that has not been deleted is added to the linked list information of the application, the application can be considered as a target application that is occupying memory.
[0103] Among them, a call node marker that has not been deleted is added to the linked list information. The situation where the target application is occupying memory can involve two situations. One situation is: the target application is still using the allocated memory (target memory) and it is not time to release the memory. This situation belongs to normal memory use and does not belong to a memory leak. Another situation is: the target application no longer uses the allocated memory, and the memory is not released normally due to some abnormal reason. This situation belongs to a memory leak. Based on the steps introduced later, the situation where a memory leak has occurred can be identified as accurately as possible from these two situations, thereby maximizing the accuracy of memory leak detection.
[0104] In the embodiment of the present application, the application that has a call node mark that has not been deleted in the linked list information can be considered as the target application that is occupying the memory. Compared with the memory leak detection from all applications, the embodiment of the present application can quickly and accurately perform the memory leak detection process in a small range from these screened target applications, which can improve the speed and accuracy of memory leak detection.
[0105] S102: Based on the identification information of the calling thread currently stored in each of the linked list information, the memory size occupied by each calling thread is obtained.
[0106] In a possible implementation, in order to accurately identify whether a memory leak occurs, the memory size occupied by each calling thread may be obtained based on the identification information of the calling thread currently stored in the linked list information corresponding to each application.
[0107] Among them, for each application, there may be several call node tags that have not been deleted in the linked list information of the application, and the identification information of the calling threads in these several call node tags may be the same or different, and the memory size occupied by each calling thread may be counted. For example, when the identification information of a calling thread is included in several (one or more) call node tags, the memory size occupied by the calling thread may be the sum of the memory lengths of the requested memory (target memory) included in these several call node tags.
[0108] S103: Determine whether there is a memory leak based on the memory size occupied by each calling thread and a preset memory threshold.
[0109] In a possible implementation, when determining whether there is a memory leak, it can be determined based on the memory size occupied by each calling thread and a preset memory threshold. Optionally, the memory size occupied by each calling thread can be compared with the preset memory threshold. If there is a target calling thread whose occupied memory size exceeds the preset memory threshold (for ease of description, the calling thread whose occupied memory size exceeds the preset memory threshold is referred to as the target calling thread), it is determined that there is a memory leak; otherwise, it is determined that there is no memory leak. In other words, if the memory size occupied by any calling thread exceeds the preset memory threshold, it can be considered that there is a memory leak at this time, and if the memory size occupied by each calling thread does not exceed the preset memory threshold, it can be considered that there is no memory leak at this time.
[0110] Since the present application can consider that there is a memory leak when there is a target calling thread whose occupied memory size exceeds the memory threshold, otherwise, it is considered that there is no memory leak. Therefore, it is possible to finely detect whether there is a memory leak based on the thread level, thereby improving the precision, timeliness and accuracy of memory leak detection.
[0111] In addition, when determining whether there is a memory leak based on the memory size occupied by each calling thread and the preset memory threshold, it is also possible to determine whether the proportion of the target calling thread in all calling threads exceeds the preset proportion threshold. If it exceeds, it can be considered that there is a memory leak, otherwise, it is determined that there is no memory leak. Exemplarily, assuming that there are 5 calling threads in total, of which two target calling threads have a memory size that exceeds the memory threshold, then the proportion of the target calling thread in all calling threads is 40%, and assuming that the preset proportion threshold is 30%, it can be considered that there is a memory leak.
[0112] Since the present application targets each target application that is occupying memory, the memory size occupied by each calling thread can be obtained based on the identification information of the calling thread currently stored in the linked list information of the target application, and whether there is a memory leak can be determined based on the memory size occupied by each calling thread and a preset memory threshold, so that the presence of a memory leak can be detected in a refined manner at the thread level. Compared with detecting whether there is a memory leak at a coarser granularity level such as the entire application, which results in the inability to detect memory leaks in a timely and accurate manner, the method of the present application embodiment that can detect whether there is a memory leak in a refined manner at the thread level can improve the speed, timeliness and accuracy of memory leak detection.
[0113] The implementation process of the embodiment of the present application is simple, the memory leak detection process itself consumes little resources and has little performance loss on the system, and is suitable for systems such as BMC systems that have less system memory. It can realize the process of quickly, promptly and accurately detecting memory leaks without affecting the normal functions and performance of the BMC system.
[0114] The method of the embodiment of the present application that can detect whether there is a memory leak in a refined manner at the thread level is also suitable for detecting memory leaks that occur in scenarios such as multi-threaded programming at the application layer in a Linux system.
[0115] Embodiment 2:
[0116] In order to enable users (such as R&D personnel) to quickly locate the location where the memory leak occurs, based on the above embodiment, in the embodiment of the present application, the method further includes:
[0117] If it is determined that there is a memory leak, then obtaining function call stack information of the memory request function called by the target calling thread;
[0118] Obtain information of each intermediate function that calls the memory request function through the function call stack information, and for each intermediate function, obtain the number of times the memory request function is called through the intermediate function;
[0119] The number of times each intermediate function corresponds to is output, so that the user can determine the abnormal function that causes the memory leak according to the number of times each intermediate function corresponds to.
[0120] In a possible implementation, when allocating memory (target memory) for an application, the call node mark added to the linked list information may include function call stack information of the memory request function. When calling the memory request function, an intermediate function may be called first, and then the memory request function is called through the intermediate function. The function call stack information may include information such as, for example, at a certain point in time, a certain intermediate function A is called first, and then the memory request function is called through the intermediate function A. Among them, the function call stack information can be obtained through the backtrace_symbols function provided by glibc, which will not be repeated here. Based on the function call stack information, information of each intermediate function that calls the memory request function can be obtained, for example, identification information such as the name of each intermediate function can be obtained, and the number of times each intermediate function calls the memory request function can be obtained.
[0121] In one possible implementation, the acquired number of times each intermediate function calls the memory request function can be output, for example, the number of times each intermediate function calls the memory request function can be displayed on a display screen of an electronic device, or the number of times each intermediate function calls the memory request function can be sent to a terminal of users such as R&D personnel. Users such as R&D personnel can receive and view this information, and can refer to the number of times corresponding to each intermediate function to quickly determine the abnormal function that causes the memory leak, that is, quickly locate the location that causes the memory leak.
[0122] Since the present application can obtain and output the number of times each intermediate function calls the memory request function when determining that a memory leak exists, users (such as R&D personnel) can refer to the number of times each intermediate function calls the memory request function to quickly locate the abnormal function that causes the memory leak, that is, quickly locate the location where the memory leak occurs, thereby improving the speed and accuracy of locating the memory leak.
[0123] Embodiment 3:
[0124] In order to intelligently and quickly locate the location where the memory leak occurs, based on the above embodiments, in the embodiment of the present application, after obtaining the number of times the memory request function is called through the intermediate function, the method further includes:
[0125] According to the number of times each intermediate function corresponds to, an abnormal function causing the memory leak is determined.
[0126] In a possible implementation, considering that under normal circumstances, the number of times the memory request function is called through the intermediate function is limited, and under abnormal circumstances, the intermediate function may repeatedly call the memory request function for some reason, and each time the memory request function is called, it will usually execute the process of allocating memory for the application, resulting in repeated cycles of only requesting memory without releasing the requested memory, thereby causing a memory leak. Optionally, in order to intelligently and quickly locate the location where the memory leak may occur, the electronic device can intelligently determine the intermediate function that may cause the memory leak according to the number of times each intermediate function calls the memory request function (for ease of description, the intermediate function that causes the memory leak will be referred to as an abnormal function later), and the location of the abnormal function is very likely to be the location where the memory leak occurs.
[0127] Since the number of times the intermediate function calls the memory request function can accurately reflect whether a memory leak occurs to a certain extent, the electronic device in the embodiment of the present application can intelligently determine the abnormal function that causes the memory leak based on the number of times the intermediate function calls the memory request function, thereby being able to intelligently, quickly and accurately locate the location that may cause the memory leak.
[0128] In a possible implementation, when determining the abnormal function that causes the memory leak according to the number of times each intermediate function corresponds to, the abnormal function can be determined in the following two ways:
[0129] Method 1: Determine the intermediate function whose number of calls exceeds the set call number threshold as the abnormal function.
[0130] In a possible implementation, a call count threshold may be preset. If the number of times the memory request function is called through an intermediate function exceeds the call count threshold, it may be considered that the call is abnormal and a memory leak may occur. The intermediate function may be determined as an abnormal function. If the number of times the memory request function is called through an intermediate function does not exceed the call count threshold, it may be considered that the call is normal and a memory leak usually does not occur. The intermediate function may not be determined as an abnormal function. The call count threshold may be flexibly set according to demand, and this application does not make any specific restrictions on this.
[0131] For ease of understanding, the memory leak detection process provided by the present application is explained below through a specific embodiment. Figure 4 , Figure 4 A schematic diagram of another memory leak detection process provided in an embodiment of the present application, the process includes the following steps:
[0132] S401: When a preset memory leak detection condition is met, link list information corresponding to each target application that is occupying the memory is obtained.
[0133] S402: Based on the identification information of the calling thread currently stored in each linked list information, the memory size occupied by each calling thread is obtained.
[0134] S403: If there is a target calling thread whose occupied memory size exceeds the memory threshold, it is determined that there is a memory leak; otherwise, it is determined that there is no memory leak.
[0135] S404: If it is determined that there is a memory leak, obtain the function call stack information of the memory request function called by the target calling thread; through the function call stack information, obtain the information of each intermediate function that calls the memory request function, and for each intermediate function, obtain the number of times the memory request function is called through the intermediate function.
[0136] S405: Determine the intermediate function whose number of calls to the memory allocation function exceeds the set call number threshold as an abnormal function.
[0137] Since the intermediate function whose number of calls to the memory allocation function exceeds the call number threshold is most likely the function where the memory leak occurs, the embodiment of the present application can intelligently determine the intermediate function whose number of calls to the memory allocation function exceeds the call number threshold as an abnormal function, thereby locating the location where the memory leak may occur in the most intelligent, fast and accurate manner.
[0138] Method 2: sort the number of times corresponding to each intermediate function (the number of times the memory allocation function is called), and determine the first set number of intermediate functions with the highest number of times in the sort as the abnormal functions.
[0139] In a possible implementation, considering that the higher the number of times an intermediate function calls a memory request function, the greater the possibility that the intermediate function causes a memory leak, when determining the abnormal function in each intermediate function, the number of times each intermediate function calls the memory request function can also be sorted. For example, the numbers can be sorted from high to low, and the first set number of intermediate functions with the highest number of times in the sort can be determined as abnormal functions. Among them, the specific value of the set number can be flexibly set according to demand, and this application does not make specific restrictions on this. For example, it can be 2, 3, etc. When the set number is 2, the two intermediate functions with the highest and second highest numbers in the sort can be determined as abnormal functions.
[0140] For ease of understanding, the memory leak detection process provided by the present application is explained below through a specific embodiment. Figure 5 , Figure 5 A schematic diagram of another memory leak detection process provided in an embodiment of the present application, the process includes the following steps:
[0141] S501: When a preset memory leak detection condition is met, link list information corresponding to each target application that is occupying the memory is obtained.
[0142] S502: Based on the identification information of the calling thread currently stored in each linked list information, the memory size occupied by each calling thread is obtained.
[0143] S503: If there is a target calling thread whose occupied memory size exceeds the memory threshold, it is determined that there is a memory leak; otherwise, it is determined that there is no memory leak.
[0144] S504: If it is determined that there is a memory leak, obtain the function call stack information of the memory request function called by the target calling thread; through the function call stack information, obtain the information of each intermediate function that calls the memory request function, and for each intermediate function, obtain the number of times the memory request function is called through the intermediate function.
[0145] S505: Sort the numbers of times corresponding to the intermediate functions, and determine the first set number of intermediate functions with the highest numbers in the sort as abnormal functions.
[0146] Since the higher the number of times an intermediate function calls the memory request function, the greater the possibility that the intermediate function will cause a memory leak, the embodiment of the present application can intelligently determine the first set number of intermediate functions that call the memory request function more frequently as abnormal functions that may cause memory leaks, thereby locating the location where the memory leak may occur as intelligently and quickly as possible.
[0147] In a possible implementation, after the abnormal function is determined in each intermediate function, the information of the abnormal function can be output. Exemplarily, the name, address, code file name, code line number and other information of the abnormal function can be output, so that the R&D personnel can verify whether the memory leak is caused by the abnormal function according to the information of the abnormal function, thereby improving the speed and accuracy of memory leak detection.
[0148] Wherein, when outputting the address of the abnormal function, the code address of the abnormal function can be obtained and output from the information of the intermediate function contained in the corresponding call node mark. When outputting the code file name, code line number, etc. of the code corresponding to the abnormal function, the code address of the abnormal function can be obtained from the information of the intermediate function contained in the corresponding call node mark, and then the code address of the abnormal function can be parsed and converted into the corresponding code file name, code line number, etc. through the compiler conversion tool (such as addr2line, etc.), so as to output the code file name, code line number, etc. of the code corresponding to the abnormal function, which will not be repeated here. Wherein, the code address of the function contained in the call node mark can be obtained through the builtin_return_address function built into the compiler, etc., which will not be repeated here.
[0149] Embodiment 4:
[0150] For ease of understanding, the memory leak detection process provided by the present application is explained below through a specific embodiment. Figure 6 , Figure 6 A schematic diagram of another memory leak detection process provided in an embodiment of the present application, the process includes the following steps:
[0151] S600: If a memory application request for any application is received, the memory application function is called by the calling thread to allocate target memory for the application, and a calling node mark is added to the linked list information corresponding to the application, and the calling node mark includes the identification information of the calling thread, the target memory starting address of the target memory, the memory length of the target memory, the function call stack, the code address of the intermediate function involved in the function call stack and other information; and when a memory release instruction for releasing the target memory for the application is received, the target memory can be released by calling the memory release function, and the calling node mark whose memory starting address in the linked list information of the application is the target memory starting address can be deleted.
[0152] S601: When a preset memory leak detection condition is met, an application with a call node mark is added to the corresponding linked list information to be determined as a target application that is occupying memory, and linked list information corresponding to each target application is obtained.
[0153] S602: Based on the identification information of the calling thread currently stored in each linked list information, the memory size occupied by each calling thread is obtained.
[0154] S603: If there is a target calling thread whose occupied memory size exceeds the memory threshold, it is determined that there is a memory leak; otherwise, it is determined that there is no memory leak.
[0155] S604: If it is determined that there is a memory leak, obtain the function call stack information of the memory request function called by the target calling thread; through the function call stack information, obtain the information of each intermediate function that calls the memory request function, and for each intermediate function, obtain the number of times the memory request function is called through the intermediate function.
[0156] S605: According to the number of times each intermediate function corresponds to, determine the abnormal function that causes the memory leak, and output the information of the abnormal function. At the same time, the number of times each intermediate function calls the memory request function can also be output for reference by R&D personnel.
[0157] Among them, when determining the abnormal function that causes the memory leak based on the number of times each intermediate function corresponds, the number of times corresponding to each intermediate function can be sorted, and the first set number of intermediate functions with high numbers in the sorting can be determined as abnormal functions; or the intermediate function whose number of calls to the memory application function exceeds a set call number threshold can be determined as an abnormal function.
[0158] The steps in the above embodiment are only examples. The present application does not limit the order between S600 and S601-S605. The process of adding the call node mark in the linked list information and deleting the call node mark in step S600 can be performed continuously and independently, regardless of whether S601-S605 is executed.
[0159] Embodiment 5:
[0160] Based on the same technical concept, on the basis of the above embodiments, the present application provides a memory leak detection device. Figure 7 A schematic diagram of the structure of a memory leak detection device provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the device comprises:
[0161] The first obtaining module 701 is used to obtain the linked list information corresponding to each target application that is occupying the memory when the preset memory leak detection condition is met;
[0162] The second obtaining module 702 is used to obtain the memory size occupied by each calling thread based on the identification information of the calling thread currently stored in each of the linked list information;
[0163] The determination module 703 is used to determine whether there is a memory leak based on the memory size occupied by each calling thread and a preset memory threshold.
[0164] In a possible implementation manner, the second obtaining module 702 is specifically configured to:
[0165] If there is a target calling thread whose occupied memory size exceeds the memory threshold, it is determined that there is a memory leak; otherwise, it is determined that there is no memory leak.
[0166] In a possible implementation, the device further includes:
[0167] The positioning module 704 is used to obtain the function call stack information of the memory request function called by the target calling thread if it is determined that there is a memory leak; obtain the information of each intermediate function that calls the memory request function through the function call stack information, and for each intermediate function, obtain the number of times the memory request function is called through the intermediate function; output the number corresponding to each intermediate function, so that the user can determine the abnormal function that causes the memory leak based on the number corresponding to each intermediate function.
[0168] In a possible implementation manner, the positioning module 704 is further configured to:
[0169] According to the number of times each intermediate function corresponds to, an abnormal function causing the memory leak is determined.
[0170] In a possible implementation manner, the positioning module 704 is specifically configured to:
[0171] The intermediate function whose number of calls exceeds the set call number threshold is determined as the abnormal function.
[0172] In a possible implementation manner, the positioning module 704 is specifically configured to:
[0173] The numbers of times corresponding to the intermediate functions are sorted, and a set number of intermediate functions with high numbers in the sorting are determined as the abnormal functions.
[0174] In a possible implementation manner, the first obtaining module 701 is specifically configured to:
[0175] The application program with the call node mark added to the corresponding linked list information is determined as the target application program that is occupying the memory.
[0176] In a possible implementation manner, the first obtaining module 701 is specifically configured to:
[0177] If a memory application request for the target application is received, the memory application function is called by the calling thread to allocate target memory for the target application, and a calling node mark is added to the linked list information corresponding to the target application, wherein the calling node mark includes the identification information of the calling thread.
[0178] In a possible implementation manner, the first obtaining module 701 is specifically configured to:
[0179] If a memory release instruction for releasing the target memory is received for the target application, the target memory is released by calling a memory release function, and the calling node mark in the linked list information is deleted.
[0180] Embodiment 6:
[0181] Based on the same technical concept, the present application also provides an electronic device, Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, it includes: a processor 801, a communication interface 802, a memory 803 and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804;
[0182] The memory 803 stores a computer program, and when the program is executed by the processor 801, the processor 801 implements any of the above embodiments. Since the principle of solving the problem by the electronic device is similar to the memory leakage detection method, the implementation of the electronic device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0183] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0184] The communication interface 802 is used for communication between the above electronic device and other devices.
[0185] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0186] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.
[0187] Embodiment 7:
[0188] Based on the same technical concept, the embodiment of the present application provides a computer-readable storage medium, in which a computer program executable by an electronic device is stored, and when the program is run on the electronic device, the electronic device implements any of the above embodiments when executing. Since the principle of solving the problem by the computer-readable storage medium is similar to the memory leak detection method, the implementation of the computer-readable storage medium can refer to the implementation of the method, and the repeated parts will not be repeated.
[0189] The above-mentioned computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor in the electronic device, including but not limited to magnetic storage such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc., optical storage such as CD, DVD, BD, HVD, etc., and semiconductor storage such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD), etc.
[0190] Based on the same technical concept, the embodiment of the present application also provides a computer program product, which includes: computer program code, when the computer program code is run on a computer, the computer executes any of the above embodiments. Since the principle of solving the problem by the above computer program product is similar to that of the memory leak detection method, the implementation of the above computer program product can refer to the implementation of the method, and the repeated parts will not be repeated.
[0191] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0192] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0193] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0194] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0195] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A memory leak detection method, characterized in that: The method comprises: When the preset memory leak detection condition is met, the linked list information corresponding to each target application that is occupying the memory is obtained; Based on the identification information of the calling thread currently stored in each of the linked list information, the memory size occupied by each calling thread is obtained; Determine whether there is a memory leak based on the memory size occupied by each calling thread and the preset memory threshold.
2. The method according to claim 1, characterized in that The determining whether there is a memory leak based on the memory size occupied by each calling thread and a preset memory threshold includes: If there is a target calling thread whose occupied memory size exceeds the memory threshold, it is determined that there is a memory leak; otherwise, it is determined that there is no memory leak.
3. The method according to claim 2, characterized in that The method further comprises: If it is determined that there is a memory leak, then obtaining function call stack information of the memory request function called by the target calling thread; Obtain information of each intermediate function that calls the memory request function through the function call stack information, and for each intermediate function, obtain the number of times the memory request function is called through the intermediate function; The number of times each intermediate function corresponds to is output, so that the user can determine the abnormal function that causes the memory leak according to the number of times each intermediate function corresponds to.
4. The method according to claim 3, characterized in that After obtaining the number of times the memory request function is called through the intermediate function, the method further includes: According to the number of times each intermediate function corresponds to, an abnormal function causing the memory leak is determined.
5. The method according to claim 4, characterized in that The determining, according to the number of times each intermediate function corresponds to, the abnormal function causing the memory leak, comprises: The intermediate function whose number of calls exceeds the set call number threshold is determined as the abnormal function.
6. The method according to claim 4, characterized in that The determining, according to the number of times each intermediate function corresponds to, the abnormal function causing the memory leak, comprises: The numbers of times corresponding to the intermediate functions are sorted, and a set number of intermediate functions with high numbers in the sorting are determined as the abnormal functions.
7. The method according to any one of claims 1 to 5, characterized in that: The process of determining the target application includes: The application program with the call node mark added to the corresponding linked list information is determined as the target application program that is occupying the memory.
8. The method according to claim 7, characterized in that The process of adding the call node tag includes: If a memory application request for the target application is received, the memory application function is called by the calling thread to allocate target memory for the target application, and a calling node mark is added to the linked list information corresponding to the target application, wherein the calling node mark includes the identification information of the calling thread.
9. The method according to claim 8, characterized in that The method further comprises: If a memory release instruction for releasing the target memory is received for the target application, the target memory is released by calling a memory release function, and the calling node mark in the linked list information is deleted.
10. An electronic device, characterized in that: The electronic device comprises at least a processor and a memory, and the processor is used to implement the steps of the memory leak detection method according to any one of claims 1 to 9 when executing a computer program stored in the memory.
Citation Information
Patent Citations
Memory monitoring method and device, medium and electronic equipment
CN112084024A
Memory leak detection method, electronic equipment and computer readable storage medium
CN114546795A
Memory leak positioning method and device, electronic equipment and readable storage medium
CN117632703A
Method and system for acquiring call stack information of process, and electronic equipment
CN117724827A
Method and system for minimizing thread switching overheads and memory usage in multithreaded processing using floating threads
US20050066302A1
Cited By
Memory leak detection method and device based on Vue framework and medium
CN119902924A
Statistical method for memory usage and electronic equipment
CN119938453A
