Memory leak detection method and device, computer equipment and storage medium
1. A method for memory leak detection, the method comprising:
in the running process of an application program, monitoring the business logic state and the weak reference state of each target monitoring object in the application program, wherein the weak reference state is used for indicating whether weak reference exists or not, and the weak reference represents a reference which cannot ensure that the referenced object cannot be recycled by a garbage collector;
determining suspicious objects from the target monitoring objects according to the service logic state and the weak reference state of the target monitoring objects;
and determining leaked objects from the suspicious objects according to the strong reference state of each suspicious object, wherein the strong reference state is used for indicating whether strong application exists or not, and the strong reference represents a reference which can ensure that the referenced objects cannot be recycled by the garbage collector.
2. The method of claim 1, wherein the monitoring of the business logic state and the weak reference state of each target monitoring object in the application program comprises:
calling a service logic check interface, and monitoring the service logic state of each target monitoring object in the application program;
and monitoring the weak reference state of each target monitoring object in the application program by means of a weak reference mechanism.
3. The method of claim 2, wherein determining suspicious objects from each of the target monitoring objects according to the business logic state and the weak reference state of each of the target monitoring objects comprises:
and determining the target monitoring object with the service logic state being service logic failure and the weak reference state being weak reference effective as a suspicious object.
4. The method of claim 1, further comprising, prior to said determining a leaking object from each of said suspect objects based on the strong reference status of each suspect object:
acquiring a root object referenced by each suspicious object;
and scanning the reference pointing to each suspicious object in the memory from the root object of each suspicious object reference to obtain the strong reference state of each suspicious object.
5. The method of claim 4, wherein determining leaking objects from each of the suspicious objects based on the strongly referenced state of each of the suspicious objects comprises:
and determining the suspicious object with the strong reference state as the leaked object.
6. The method of any of claims 1 to 5, further comprising, after said determining a leaking object from each of said suspect objects: and outputting the reference path of the leakage object to a log file.
7. The method of any of claims 1 to 5, further comprising, after said determining a leaking object from each of said suspect objects: and sending an alarm prompt.
8. A memory leak detection apparatus, the apparatus comprising:
the monitoring module is used for monitoring the business logic state and the weak reference state of each target monitoring object in the application program in the running process of the application program, wherein the weak reference state is used for indicating whether weak reference exists or not, and the weak reference represents reference which can not ensure that the referenced object cannot be recycled by the garbage collector;
the suspicious object determining module is used for determining suspicious objects from the target monitoring objects according to the business logic state and the weak reference state of the target monitoring objects;
and the leaked object determining module is used for determining the leaked objects from the suspicious objects according to the strong reference state of the suspicious objects, wherein the strong reference state is used for indicating whether strong application exists or not, and the strong reference represents a reference which can ensure that the referenced objects cannot be recycled by the garbage collector.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
Background
As the demand for computer applications increases, the design and development of applications becomes correspondingly more complex. Memory leakage is an important factor influencing application performance, and in the running process of an application program, if useless objects are not released in time and cannot be recycled, the memory leakage can occur. If memory leakage occurs, memory occupation is increased, and application breakdown and other consequences can be caused in serious cases. It is therefore necessary to detect memory leaks in order to fix problem codes.
In the conventional technology, a memory leak inspection tool takes a statistical result (such as the number of objects in a memory and the memory occupation amount) of an application program during running as auxiliary information in a statistical object distribution mode, and delivers the auxiliary information to a developer to analyze whether memory leak and possible leak points occur, and if the number of instances corresponding to a certain class is large or the memory occupation amount is large and exceeds a reasonable range in a service scene, the developer reasonably suspects that the codes operating the class of objects have the memory leak problem.
However, a large number of logic branches often exist in program code, but in the actual running process of a program, only a part of logic branches are executed at a high frequency, and the rest of logic branches are executed at a low frequency, if code causing memory leakage exists in the logic branches executed at the low frequency, the number of leaked objects and the memory occupation amount are small, and the small memory leakage is difficult to be found from the statistical results of the traditional memory leakage checking tool, so that the accuracy and efficiency of memory leakage detection are affected, and a hidden danger is caused to the stability of the program which needs to run for a long time.
Disclosure of Invention
In view of the above, it is necessary to provide a memory leak detection method, apparatus, computer device, and storage medium capable of improving accuracy and efficiency.
A method of memory leak detection, the method comprising:
in the running process of an application program, monitoring the business logic state and the weak reference state of each target monitoring object in the application program, wherein the weak reference state is used for indicating whether weak reference exists or not, and the weak reference represents a reference which cannot ensure that the referenced object cannot be recycled by a garbage collector;
determining suspicious objects from the target monitoring objects according to the service logic state and the weak reference state of the target monitoring objects;
and determining leaked objects from the suspicious objects according to the strong reference state of the suspicious objects, wherein the strong reference state is used for indicating whether strong application exists or not, and the strong reference represents a reference which can ensure that the referenced objects cannot be recycled by the garbage collector.
A memory leak detection apparatus, the apparatus comprising:
the monitoring module is used for monitoring the business logic state and the weak reference state of each target monitoring object in the application program in the running process of the application program, wherein the weak reference state is used for indicating whether weak reference exists or not, and the weak reference represents reference which can not ensure that the referenced object cannot be recycled by the garbage collector;
the suspicious object determining module is used for determining suspicious objects from the target monitoring objects according to the business logic state and the weak reference state of the target monitoring objects;
and the leaked object determining module is used for determining the leaked objects from the suspicious objects according to the strong reference state of the suspicious objects, wherein the strong reference state is used for indicating whether strong application exists or not, and the strong reference represents a reference which can ensure that the referenced objects cannot be recycled by the garbage collector.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
in the running process of an application program, monitoring the business logic state and the weak reference state of each target monitoring object in the application program, wherein the weak reference state is used for indicating whether weak reference exists or not, and the weak reference represents a reference which cannot ensure that the referenced object cannot be recycled by a garbage collector;
determining suspicious objects from the target monitoring objects according to the service logic state and the weak reference state of the target monitoring objects;
and determining leaked objects from the suspicious objects according to the strong reference state of the suspicious objects, wherein the strong reference state is used for indicating whether strong application exists or not, and the strong reference represents a reference which can ensure that the referenced objects cannot be recycled by the garbage collector.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
in the running process of an application program, monitoring the business logic state and the weak reference state of each target monitoring object in the application program, wherein the weak reference state is used for indicating whether weak reference exists or not, and the weak reference represents a reference which cannot ensure that the referenced object cannot be recycled by a garbage collector;
determining suspicious objects from the target monitoring objects according to the service logic state and the weak reference state of the target monitoring objects;
and determining leaked objects from the suspicious objects according to the strong reference state of the suspicious objects, wherein the strong reference state is used for indicating whether strong application exists or not, and the strong reference represents a reference which can ensure that the referenced objects cannot be recycled by the garbage collector.
According to the memory leak detection method, the memory leak detection device, the computer equipment and the storage medium, in the running process of the application program, the service logic state and the weak reference state of each target monitoring object in the application program are monitored, the weak reference state is used for indicating whether weak reference exists or not, and the weak reference represents reference which cannot ensure that the referenced object cannot be recycled by the garbage collector; determining suspicious objects from the target monitoring objects according to the service logic state and the weak reference state of the target monitoring objects; and determining leaked objects from the suspicious objects according to the strong reference state of each suspicious object, wherein the strong reference state is used for indicating whether strong application exists or not, and the strong reference represents a reference which can ensure that the referenced objects cannot be recycled by the garbage collector. Therefore, whether the memory leakage exists or not is detected based on the business logic state, the weak reference state and the strong reference state of the target monitoring object, the detection result does not depend on the number of the leakage objects and the occupied memory amount, and the leakage objects can be detected even if the number of the leakage objects and the occupied memory amount are small, so that the detection accuracy is improved. In addition, the memory leak detection method can be embedded into the application program in a code mode, the memory use condition can be monitored in real time with less performance expense in the running process of the application program without manual intervention, the detection efficiency is improved, and the memory leak problem can be found and repaired quickly.
Drawings
FIG. 1 is a diagram of an exemplary embodiment of a memory leak detection method;
FIG. 2 is a flow diagram illustrating a method for memory leak detection according to one embodiment;
FIG. 3 is a flow diagram that illustrates object registration in one embodiment;
FIG. 4 is a flow diagram illustrating a method for memory leak detection according to one embodiment;
FIG. 5 is a flowchart illustrating processing steps after detection of a leaking object in one embodiment;
FIG. 6 is a flow diagram illustrating a method for memory leak detection in accordance with one embodiment;
FIG. 7 is a block diagram of an embodiment of a memory leak detection apparatus;
FIG. 8 is a diagram illustrating an internal structure of a computer device in one embodiment;
FIG. 9 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The memory leak detection method provided by the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. A user may run an application through terminal 102 and server 104 may be the server on which the application resides. The memory leak detection method can be applied to a terminal provided with an application program, can also be applied to a server where the application program is located, can also be applied to a system comprising the terminal and the server, and is realized through the interaction of the terminal and the server. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud computing services. The terminal may be, but is not limited to, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal, a smart television, and the like. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the application is not limited herein.
In one embodiment, as shown in fig. 2, a memory leak detection method is provided, which is described by taking the method as an example applied to the server in fig. 1, and includes the following steps S202 to S206.
S202, in the running process of the application program, the service logic state and the weak reference state of each target monitoring object in the application program are monitored, the weak reference state is used for indicating whether weak reference exists or not, and the weak reference represents reference which cannot ensure that the referenced object cannot be recycled by the garbage collector.
The target monitoring object refers to an object to be monitored in the application program. Before starting the memory leak detection, a developer registers an object to be monitored in an application program into a memory leak detection program. Specifically, the memory leak detection program adopts a software package file format, for example, Java language, and the software package file format is jar, and registers an object to be monitored in a code into the memory leak detection program through an Application Program Interface (API) provided in the jar package. And storing the successfully registered object in the monitoring object pool, wherein the target monitoring object is the object stored in the monitoring object pool.
The service logic state of the target monitoring object is used for indicating whether the target monitoring object is valid in the upper layer service logic, and the service logic state may include two states of service logic valid and service logic invalid. When the service logic state of the target monitoring object is that the service logic is effective, the target monitoring object is considered to be in service use; and when the service logic state of the target monitoring object is service logic failure, the service of the target monitoring object is considered to be not used any more.
A weak reference refers to a reference that cannot ensure that objects it references are not reclaimed by a Garbage Collector (GC), and if an object is referenced by a weak reference only, the object is considered inaccessible (or weakly accessible) and thus may be reclaimed at any time. The weak reference state of the target monitoring object is used for indicating whether the weak reference of the target monitoring object is valid or not, and the weak reference state can comprise two states of valid weak reference and invalid weak reference. When the weak reference state of the target monitoring object is that the weak reference is effective, the target monitoring object is considered to have the weak reference; when the weak reference state of the target monitoring object is that the weak reference is invalid, the target monitoring object is considered to have no weak reference.
And S204, determining suspicious objects from the target monitoring objects according to the service logic state and the weak reference state of the target monitoring objects.
In an embodiment, the step of determining a suspicious object from each target monitoring object according to the service logic state and the weak reference state of each target monitoring object may specifically include: and determining the target monitoring object with the service logic state being service logic failure and the weak reference state being weak reference effective as a suspicious object.
Suspicious objects refer to objects that may have a memory leak. And when the service logic state of the target monitoring object is that the service logic is effective, the target monitoring object is considered to be in service use, so that the target monitoring object is judged to be a normal object. When the weak reference state of the target monitoring object is invalid, the target monitoring object is considered to be recovered by the garbage recoverer, and therefore the target monitoring object is judged to be a normal object. And eliminating normal objects in all the target monitoring objects, wherein the reserved target monitoring objects are target monitoring objects with service logic states of service logic failure and weak reference states of weak reference effectiveness, namely intersection of the service logic failure and the target monitoring objects which are not recovered by the garbage recoverer, and taking the intersection as an object set with possible memory leakage.
S206, according to the strong reference state of each suspicious object, determining the leaked object from each suspicious object, wherein the strong reference state is used for indicating whether strong application exists or not, and the strong reference represents a reference which can ensure that the referenced object cannot be recycled by the garbage collector.
In an embodiment, the step of determining a leaking object from each suspicious object according to the strong reference state of each suspicious object may specifically include: and determining the suspicious object with the strong reference state as the leaked object.
A strong reference is a reference that can ensure that the object to which it refers is not reclaimed by the garbage collector, and if an object has a strong reference, the object is not reclaimed by the garbage collector. The strong reference state of the suspicious object refers to whether the suspicious object has a strong reference, and the strong reference state may include two states of existence of a strong reference and absence of a strong reference. And when the strong reference state of the suspicious object is that no strong reference exists, judging that the suspicious object is a normal object. When the strong reference state of the suspicious object is that the strong reference exists, the suspicious object is determined to be a leaked object, because the suspicious object is an object already released by the upper service logic, the memory occupied by the suspicious object cannot be released due to the strong reference, and then cannot be recovered by the garbage collector, and finally the memory is leaked.
In the memory leak detection method, in the running process of an application program, the service logic state and the weak reference state of each target monitoring object in the application program are monitored, the weak reference state is used for indicating whether weak reference exists or not, and the weak reference represents reference which can not ensure that the referenced object cannot be recycled by a garbage collector; determining suspicious objects from the target monitoring objects according to the service logic state and the weak reference state of the target monitoring objects; and determining leaked objects from the suspicious objects according to the strong reference state of each suspicious object, wherein the strong reference state is used for indicating whether strong application exists or not, and the strong reference represents a reference which can ensure that the referenced objects cannot be recycled by the garbage collector. Therefore, whether the memory leakage exists or not is detected based on the business logic state, the weak reference state and the strong reference state of the target monitoring object, the detection result does not depend on the number of the leakage objects and the occupied memory amount, and the leakage objects can be detected even if the number of the leakage objects and the occupied memory amount are small, so that the detection accuracy is improved. In addition, the memory leak detection method can be embedded into the application program in a code mode, the memory use condition can be monitored in real time with less performance expense in the running process of the application program without manual intervention, the detection efficiency is improved, and the memory leak problem can be found and repaired quickly.
In one embodiment, as shown in FIG. 3, a flow diagram of object registration in one embodiment is provided. The method comprises the steps of registering an object to be monitored to a monitored object pool through instantiation, embedding a memory leakage detection program serving as an internal detection tool into an application program, starting a detection thread when the detection tool is called, traversing each object in the monitored object pool, and judging whether the object is a leakage object. In order to improve the usability degree, the detection tool uses a lazy initialization scheme, namely, a user does not need to display the initialization detection tool in advance, only completes initialization work in the detection tool when the detection tool is called for the first time, starts a background detection thread, and prepares for memory leakage detection.
In one embodiment, in registering the objects, the information provided may include, for each object that needs to be monitored: the instance of the object, the root object referred by the object and the judgment method of the effectiveness of the object in the business logic.
The root object may be a root node, which provides a scan entry for subsequent memory scanning, and in actual use, the root object may be an engine instance, a framework instance, a scene instance, and the like. The method for determining the effectiveness of the object in the business logic may be set in combination with an actual scene, for example, by determining whether the user has gone offline to determine whether the user instance has failed in the business logic.
In an embodiment, the step of monitoring the business logic state and the weak reference state of each target monitoring object in the application program may specifically include: calling a service logic check interface, and monitoring the service logic state of each target monitoring object in an application program; and monitoring the weak reference state of each target monitoring object in the application program by means of a weak reference mechanism.
A business logic check interface is provided at object registration to determine if the object is valid in the business logic. And for each target monitoring object, calling a business logic check interface corresponding to the target monitoring object, and monitoring the business logic state of the target monitoring object so as to judge whether the business logic of the target monitoring object is effective or invalid.
A weak reference mechanism is a mechanism that indirectly senses whether an object is reclaimed by a garbage collector, and if an object is referenced only by a weak reference, the object is considered inaccessible (or weakly accessible) and therefore may be reclaimed at any time. And for each target monitoring object, monitoring the weak reference state of the target monitoring object by means of a weak reference and reference queue mechanism so as to judge whether the target monitoring object has weak reference.
In one embodiment, before the step of determining the leaking object from the suspicious objects according to the strong reference state of the suspicious objects, the method further comprises the following steps: acquiring a root object referenced by each suspicious object; and starting from the root object referenced by each suspicious object, scanning the reference pointing to each suspicious object in the memory to obtain the strong reference state of each suspicious object.
And providing a root object referenced by the object during object registration, and providing a scanning entry for memory scanning as a root node. Calling a memory Object Layout scanning tool (such as Java Object Layout, JOL), starting from the root Object to scan each suspicious Object, specifically scanning the reference pointing to each suspicious Object in the memory, and obtaining the strong reference state of each suspicious Object.
In one embodiment, as shown in fig. 4, a memory leak detection method is provided, which includes two stages: a preliminary screening stage and a scan positioning stage. In the preliminary screening stage, for the target monitoring objects in the monitoring object pool, determining the target monitoring objects with valid business logic or invalid weak reference as normal objects, determining the target monitoring objects with invalid business logic and valid weak reference as suspicious objects, excluding the normal objects, and keeping the suspicious objects as the input of the next scanning positioning stage. And in the scanning and positioning stage, determining the suspicious object without strong reference as a normal object, determining the suspicious object with strong reference as a leakage object, and completing the memory leakage detection process.
In the above embodiment, the memory leak detection is divided into two stages, and the rapid screening of the target monitoring object is completed through the first stage with lower overhead, so as to reduce the scanning scale of the second stage with higher overhead, thereby reducing the overall processing resource and memory overhead.
In one embodiment, after the step of determining the leaking object from the suspicious objects, the following steps may be further included: and outputting the reference path of the leakage object to the log file.
After the leaked object is determined to be detected, a reference path of the leaked object can be output to a log file by means of a memory object layout scanning tool, relevant workers can find the reference path of the leaked object by checking the log, relevant code references of the object under the reference path in codes can be searched according to the reference path of the leaked object, improper or missing write operation is found, and memory leakage problem repair is carried out.
In one embodiment, after the step of determining the leaking object from the suspicious objects, the following steps may be further included: and sending an alarm prompt.
After the leakage object is determined to be detected, a real-time alarm mechanism is triggered, an alarm prompt is sent, specifically, the alarm prompt can be popped up in instant messaging software of relevant workers, and the alarm prompt can include a server identifier (such as a server name) where the leakage object is located, so that the relevant workers can be guided to go to the corresponding server to view detailed logs and further process the detailed logs. The alarm prompt may further include a process identifier (such as a process name) and time where the leakage object is located, which is helpful to find and repair the memory leakage problem more quickly.
In one embodiment, as shown in fig. 5, a flowchart illustrating processing steps after detecting a leaking object in one embodiment is provided, and after determining that the leaking object is detected, a reference path of the leaking object is output to a log file, and an alarm prompt is sent to the instant messaging software. Therefore, once the memory leakage is detected, the alarm prompt is triggered immediately to guide relevant workers to carry out processing, so that the memory leakage problem can be quickly repaired.
In one embodiment, as shown in fig. 6, a memory leak detection method is provided, which includes the following steps S601 to S605.
S601, in the running process of the application program, calling a service logic check interface to monitor the service logic state of each target monitoring object in the application program, and monitoring the weak reference state of each target monitoring object in the application program by means of a weak reference mechanism.
S602, determining the target monitoring object with the service logic state being service logic failure and the weak reference state being weak reference effective as a suspicious object.
S603, acquiring the root object referenced by each suspicious object, and scanning the reference pointing to each suspicious object in the memory from the root object referenced by each suspicious object to acquire the strong reference state of each suspicious object.
S604, the suspicious object with the strong reference state as the strong reference exists is determined as the leakage object.
S605, outputting the reference path of the leakage object to a log file, and sending an alarm prompt to the instant messaging software.
For specific limitations of step S601 to step S605, reference may be made to the above embodiments, which are not described herein again. In the embodiment, whether the memory leakage exists is detected based on the service logic state, the weak reference state and the strong reference state of the target monitoring object, the detection result does not depend on the number of the leakage objects and the memory occupation amount, and the leakage objects and the memory occupation amount can be detected even if the number of the leakage objects and the memory occupation amount are small, so that the detection accuracy is improved. The memory leak detection method can be embedded into the application program in a code form, can monitor the memory use condition in real time with less performance expense in the running process of the application program without manual intervention, improves the detection efficiency, and is favorable for quickly finding and repairing the memory leak problem. In addition, once the memory leakage is detected, an alarm prompt is triggered immediately to guide relevant workers to carry out processing, so that the memory leakage problem can be quickly repaired.
It should be understood that, although the steps in the flowcharts related to the above embodiments are shown in sequence as indicated by the arrows, the steps are not necessarily executed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in each flowchart related to the above embodiments may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
In one embodiment, as shown in fig. 7, there is provided a memory leak detection apparatus 700, which may be a part of a computer device using a software module or a hardware module, or a combination of the two, the apparatus specifically includes: a monitoring module 710, a suspect object determination module 720, and a leaked object determination module 730, wherein:
the monitoring module 710 is configured to monitor a service logic state and a weak reference state of each target monitoring object in the application program during the running process of the application program, where the weak reference state is used to indicate whether a weak reference exists, and the weak reference indicates a reference that cannot ensure that an object referred by the weak reference is not recycled by the garbage collector.
And the suspicious object determining module 720 is configured to determine a suspicious object from the target monitoring objects according to the service logic state and the weak reference state of each target monitoring object.
And the leaked object determining module 730 is configured to determine a leaked object from each suspicious object according to a strong reference state of each suspicious object, where the strong reference state is used to indicate whether a strong application exists, and the strong reference indicates a reference that can ensure that an object referred to by the strong reference is not recycled by the garbage collector.
In an embodiment, the monitoring module 710 is specifically configured to, when monitoring the business logic state and the weak reference state of each target monitoring object in the application program: calling a service logic check interface, and monitoring the service logic state of each target monitoring object in an application program; and monitoring the weak reference state of each target monitoring object in the application program by means of a weak reference mechanism.
In an embodiment, when the suspicious object determining module 720 determines a suspicious object from the target monitoring objects according to the service logic state and the weak reference state of each target monitoring object, it is specifically configured to: and determining the target monitoring object with the service logic state being service logic failure and the weak reference state being weak reference effective as a suspicious object.
In one embodiment, the apparatus further comprises a scanning module to: acquiring a root object referenced by each suspicious object; and starting from the root object referenced by each suspicious object, scanning the reference pointing to each suspicious object in the memory to obtain the strong reference state of each suspicious object.
In an embodiment, when determining a leaking object from suspicious objects according to the strong reference state of the suspicious objects, the leaking object determining module 730 is specifically configured to: and determining the suspicious object with the strong reference state as the leaked object.
In one embodiment, the apparatus further comprises an output module to output a reference path of the leaked object to the log file.
In one embodiment, the apparatus further comprises an alert module for issuing an alert prompt.
For specific limitations of the memory leak detection apparatus, reference may be made to the above limitations of the memory leak detection method, and details are not described herein again. All or part of the modules in the memory leak detection device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 8. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a memory leak detection method.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 9. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a memory leak detection method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the configurations shown in fig. 8 and 9 are merely block diagrams of portions of configurations related to aspects of the present application, and do not constitute limitations on the computing devices to which aspects of the present application may be applied, as particular computing devices may include more or fewer components than shown, or combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, in which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer-readable storage medium. The computer instructions are read by a processor of a computer device from a computer-readable storage medium, and the computer instructions are executed by the processor to cause the computer device to perform the steps in the above-mentioned method embodiments.
It should be understood that the terms "first", "second", etc. in the above-described embodiments are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Further, in the description of the present application, the meaning of "a plurality" means at least two unless otherwise specified.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.