Abnormal memory occupancy detection method and device, equipment and medium

By inserting detection call statements during the application compilation process, adding the user view object to the memory exception occupation list, the problem of low memory exception occupation detection efficiency in the existing technology is solved, and non-invasive and efficient detection is achieved.

CN119668915APending Publication Date: 2025-03-21BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411750161.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

In the operating system that automatically recycles memory and cannot obtain objects through the life cycle, the memory exception occupation detection efficiency is low, and the memory exception occupation problem cannot be solved in a timely manner.

Method used

By inserting detection call statements during the compilation process of the application by inserting instrumentation scripts in the compilation script, add the user view object to the memory exception occupation list and perform memory exception occupation detection on it.

Benefits of technology

It realizes non-invasive memory exception occupation detection, improves the efficiency of adding detection functions, and promptly discovers and solves memory exception occupation problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119668915A_ABST
    Figure CN119668915A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to an abnormal memory occupancy detection method and device, equipment and a medium, and the method comprises the steps that in response to the fact that a user view object is removed from a page, a detection call statement is executed to add the user view object into an abnormal memory occupancy list, the detection calling statement is inserted into a user view class of a code file of the application program in the compiling process of the application program through an instrumentation script in a compiling script; and performing memory exception occupancy detection on the user view objects included in the memory exception occupancy list. According to the embodiment of the invention, in the compiling process of the application program, the detection calling statement is automatically added to the user view class in the instrumentation mode, non-intrusive memory exception occupation detection is realized, manual implementation is not needed, the adding efficiency of a memory exception detection function is effectively improved, and the problem of memory exception occupation is found and solved in time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, equipment and medium for detecting abnormal memory usage. Background Art

[0002] The abnormal memory usage detection of an application can be implemented through the functional modules provided by the operating system. However, for operating systems that automatically recycle memory and cannot obtain objects through their life cycle, it is necessary to manually call the application programming interface (API) of the functional module when coding the application to add the abnormal object to the abnormal memory usage observation list, which is inefficient and makes it impossible to solve the abnormal memory usage problem in a timely manner. Summary of the invention

[0003] In order to solve the above technical problems, the present disclosure provides a method, device, equipment and medium for detecting abnormal memory usage.

[0004] The present disclosure provides a method for detecting abnormal memory usage, the method comprising:

[0005] In response to the user view object being removed from the page, executing a detection call statement to add the user view object to a memory abnormality occupancy list, wherein the detection call statement is inserted into a user view class of a code file of the application during the compilation process of the application through an instrumentation script in a compilation script;

[0006] Perform memory abnormality detection on the user view objects included in the memory abnormality list.

[0007] The present disclosure also provides a device for detecting abnormal memory usage, the device comprising:

[0008] a sending module, configured to execute a detection call statement to add the user view object to a memory abnormality occupancy list in response to the user view object being removed from the page, wherein the detection call statement is inserted into a user view class of a code file of the application during the compilation process of the application through an instrumentation script in a compilation script;

[0009] The detection module is used to perform abnormal memory usage detection on the user view objects included in the abnormal memory usage list.

[0010] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the memory abnormal occupancy detection method provided in the embodiment of the present disclosure.

[0011] The embodiment of the present disclosure also provides a computer-readable storage medium, which stores a computer program, and the computer program is used to execute the memory abnormality occupancy detection method provided by the embodiment of the present disclosure.

[0012] The technical solution provided by the embodiment of the present disclosure has the following advantages over the prior art: the memory abnormal occupancy detection solution provided by the embodiment of the present disclosure, in response to the removal of the user view object from the page, executes a detection call statement to add the user view object to the memory abnormal occupancy list, wherein the detection call statement is inserted into the user view class of the code file of the application program during the compilation process of the application program through the stub script in the compilation script; and performs memory abnormal occupancy detection on the user view object included in the memory abnormal occupancy list. With the above technical solution, the detection call statement is automatically inserted into the user view class during the compilation process of the application program through the stub script in the compilation script, so that when the user view object is removed from the page after the application program is started, the corresponding user view object is sent to the memory abnormal occupancy list through the detection call statement, and memory abnormal occupancy detection is implemented for the user view object in the memory abnormal occupancy list. Since the detection call statement is automatically added to the user view class by the stub method during the compilation process of the application program, non-intrusive memory abnormal occupancy detection is implemented without manual implementation, which effectively improves the efficiency of adding the memory abnormality detection function, thereby timely discovering and solving the memory abnormal occupancy problem. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0014] Figure 1 A flowchart of a method for detecting abnormal memory usage provided by an embodiment of the present disclosure;

[0015] Figure 2 A flowchart of another method for detecting abnormal memory usage provided by an embodiment of the present disclosure;

[0016] Figure 3 A schematic diagram of a prompt pop-up window provided in an embodiment of the present disclosure;

[0017] Figure 4 A schematic diagram of the structure of a device for detecting abnormal memory usage provided by an embodiment of the present disclosure;

[0018] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0019] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0020] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0021] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0022] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0023] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0024] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0025] In order to solve the problem of low efficiency in manually implementing abnormal memory usage detection of an application program, an embodiment of the present disclosure provides a method for detecting abnormal memory usage, which is introduced below in conjunction with a specific embodiment.

[0026] Figure 1 The present invention provides a flowchart of a method for detecting abnormal memory usage, which can be performed by a device for detecting abnormal memory usage, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 1 As shown, the method includes:

[0027] Step 101, in response to the user view object being removed from the page, executing a detection call statement to add the user view object to a memory abnormality occupancy list, wherein the detection call statement is inserted into the user view class of the code file of the application during the compilation process of the application through an instrumentation script in the compilation script.

[0028] The abnormal memory occupancy detection method of the disclosed embodiment is applied to the client of the target operating system, and the application program can be a program of the target operating system, and the target operating system can be an operating system that automatically recycles memory and cannot obtain objects through the life cycle, that is, the memory recycling mechanism in the target operating system can automatically trigger recycling when the life cycle of an object ends and is not referenced, and cannot actively pay attention to the life cycle detection to obtain the required object. The disclosed embodiment is not limited to the type of application program, for example, the application program can be a video application program, a reading application program, etc.

[0029] The user view object can be a specific instance created according to the definition of the user view class, including the properties and methods defined in the class, and can hold its own state information. The user view object has a clear life cycle, and the life cycle can determine whether the object should be recycled. The user view class can be a class that provides basic components in the user interface (UI) framework of the target operating system, and is the direct or indirect parent class of the interface component. Each component can occupy a rectangular area on the screen and is responsible for drawing and time processing in this rectangular area. The subclasses of the user view class can include display class interaction components and container class components.

[0030] The detection call statement may be a statement inserted in the code file of the application program by means of an instrumentation method for calling a memory abnormality occupancy detection module to implement the memory abnormality occupancy detection function. By adding the detection call statement, the memory abnormality occupancy detection function is added to the user view object of the application program. The detection call statement may be automatically added by an instrumentation script in a compilation script. The compilation script may be used to convert the language of the code file of the application program into machine code or an intermediate language. The compilation script may include a series of commands and parameters to instruct the compiler to perform necessary steps, including preprocessing, compilation, assembly, linking, etc. The instrumentation script may be a partial script file newly added to the compilation script in the embodiment of the present disclosure for automatically adding detection call statements during the compilation process.

[0031] The abnormal memory occupancy detection module can be a functional module used to detect whether abnormal memory occupancy occurs in an application. The abnormal memory occupancy detection module can be a functional module provided by the target operating system, or it can be a functional module that adds additional functions such as information storage and switch control on the basis of calling the functional module provided by the target operating system. The information storage can collect relevant information of the user view object according to the actual scenario requirements, such as collecting the removal time, object name, object string, etc. of the user view object. The switch control can control whether the abnormal memory occupancy detection module is turned on to perform the abnormal memory occupancy detection function according to actual needs.

[0032] In some embodiments, the stub script in the compilation script is used to traverse the code files of the application program to identify the user view class during the compilation process of the application program, and insert a detection call statement in the disappearance execution method of the user view class. Optionally, when the stub script determines that the user view class does not include the disappearance execution method, it first adds the disappearance execution method and inserts a detection call statement in the disappearance execution method.

[0033] The disappearance execution method may be a method executed before a component is about to be destroyed by destructor, and is part of the life cycle of a custom component in the target operating system. The disappearance execution method may perform cleanup tasks such as releasing resources and stopping animation to ensure that no potential problems are left when the component is destroyed.

[0034] Specifically, in the process of compiling an application based on a compilation script, the user view class is instrumented according to the instrumentation script. Specifically, the code files of the application can be traversed first, and the class names of the classes with preset annotations are identified. The preset annotations are annotations that characterize the current class as a user view class. These classes with recorded class names are determined as user view classes, and the user view classes are traversed to determine whether each user view class includes a disappearance execution method. If so, a detection call statement is inserted into the disappearance execution method. For user view classes that do not include a disappearance execution method, the disappearance execution method can be first added and a detection call statement can be inserted into the added disappearance execution method.

[0035] After the application is compiled, the memory abnormal occupation detection device executes the detection call statement in the disappearance execution method when the user view object is removed from the page after the application is started, and can send the user view object to the memory abnormal occupation detection module, so that the memory abnormal occupation detection module obtains the user view object that needs to be detected for memory abnormal occupation, and adds the user view object to the memory abnormal occupation list for subsequent detection. Among them, the memory abnormal occupation list may include objects that may have memory abnormal occupation, and the memory abnormal occupation list in the embodiment of the present disclosure may include user view objects removed from the page.

[0036] Since memory recycling in the target operating system involves a garbage collection algorithm, it will not be triggered until the number of objects that need to be recycled reaches a preset number or a preset time point. Therefore, you can first add user view objects that may have abnormal memory occupation to the abnormal memory occupation list for observation, and then detect it after memory recycling occurs.

[0037] Step 102: Perform a memory abnormality detection on the user view objects included in the memory abnormality list.

[0038] Abnormal memory usage may be caused by the application failing to properly release the allocated memory during operation, resulting in a continuous increase in memory usage, which may lead to system resource exhaustion, performance degradation, or even program crashes. The abnormal memory usage in the disclosed embodiment is for the situation where the memory used by the user view object of the application should be reclaimed but is still occupied and cannot be reclaimed by the garbage collector. The user view object has a clear life cycle. When the life cycle ends and memory recycling occurs, the user view object application is recycled.

[0039] For example, Figure 2 A flowchart of another method for detecting abnormal memory usage provided by an embodiment of the present disclosure is shown in FIG. Figure 2 As shown, in a feasible implementation manner, performing abnormal memory usage detection on the user view objects included in the abnormal memory usage list may include:

[0040] Step 201 , determining at every preset time period whether the observed objects in the abnormal memory occupancy list are recycled, if so, executing step 202 ; otherwise, returning to executing step 201 .

[0041] The preset time period may be the interval for periodically detecting the abnormal memory usage of the abnormal memory usage list, and the preset time period may be set according to actual conditions, for example, the preset time period may be 30 seconds. The observed object may be an object used to observe whether garbage collection occurs, and the observed object is a weak reference object that will be recycled when garbage collection occurs without strong references.

[0042] Specifically, the memory abnormal occupancy detection device can perform a detection on the memory abnormal occupancy list once every preset time period. The specific detection process may include: first detect whether the observed object is recycled. If the observed object is not recycled, it means that no memory recycling has occurred within the preset time period before the current moment, and there is no need to continue to judge, and continue to wait for execution of step 201; if the observed object is recycled, it means that memory recycling has occurred within the preset time period before the current moment, and the judgment of step 202 can be further executed.

[0043] Step 202, determine whether the user view object included in the abnormal memory usage list is recycled, if so, execute step 203; otherwise, return to execute step 201.

[0044] If the observed object is recycled, it means that memory recycling has occurred within the preset time period before the current moment. It can be further determined whether each user view object in the memory abnormal occupation list has been recycled. If there are user view objects that have not been recycled, it is determined that memory abnormal occupation has occurred, and step 203 is executed; if all user view objects in the memory abnormal occupation list are recycled, it is determined that memory abnormal occupation has not occurred within the preset time period before the current moment, and continue waiting to execute step 201.

[0045] Step 203: Determine the user view object that has not been recycled as an object that abnormally occupies memory.

[0046] The abnormal memory occupation object may be a user view object that should be recycled but has not been recycled. If there is a user view object that has not been recycled, it is determined that abnormal memory occupation has occurred, and the user view object that has not been recycled is determined as the abnormal memory occupation object.

[0047] In the above scheme, a weak reference object is set to first determine whether memory recycling has occurred based on its recycling situation, and then determine the accurate timing of abnormal memory occupancy detection. After determining that memory recycling has occurred, abnormal memory occupancy detection is performed. There is no need to manually set the detection timing, which effectively improves the efficiency of determining the detection timing, thereby improving the efficiency and accuracy of abnormal memory occupancy detection.

[0048] The memory abnormality occupancy detection scheme provided by the embodiment of the present disclosure executes a detection call statement to add the user view object to the memory abnormality occupancy list in response to the removal of the user view object from the page, wherein the detection call statement is inserted into the user view class of the code file of the application program during the compilation process of the application program through the stub script in the compilation script; and the memory abnormality occupancy detection is performed on the user view object included in the memory abnormality occupancy list. The above technical scheme is adopted, and the detection call statement is automatically inserted into the user view class during the compilation process of the application program through the stub script in the compilation script, so that when the user view object is removed from the page after the application program is started, the corresponding user view object is sent to the memory abnormality occupancy list through the detection call statement, and the memory abnormality occupancy detection is implemented for the user view object in the memory abnormality occupancy list. Since the detection call statement is automatically added to the user view class by the stub method during the compilation process of the application program, non-intrusive memory abnormality occupancy detection is implemented without manual implementation, which effectively improves the efficiency of adding the memory abnormality detection function, thereby timely discovering and solving the memory abnormality occupancy problem.

[0049] In some embodiments, the abnormal memory occupation detection method provided by the embodiments of the present disclosure may further include: displaying or reporting the object information of the abnormal memory occupation object to the server through a prompt pop-up window.

[0050] The object information of the abnormal memory occupation object may include the removal time, object name, object string, etc. of the abnormal memory occupation object, which is set according to the actual situation. The prompt pop-up window may be a pop-up window for displaying the abnormal memory occupation of the application, which may pop up in the application to interrupt the user's current operation and display the object information of the abnormal memory occupation object to remind the user to solve the problem.

[0051] After determining the abnormal memory occupation object, the abnormal memory occupation detection device can obtain the object information of the abnormal memory occupation object through the local detection component integrated by the application, and display the object information of the abnormal memory occupation object to the user through a prompt pop-up window, which can include the object information of the abnormal memory occupation object, or report the object information of the abnormal memory occupation object to the server. It is understandable that the display of the prompt pop-up window is performed during the testing phase of the application, and the prompt pop-up window will not be displayed after the application is launched.

[0052] For example, Figure 3 A schematic diagram of a prompt pop-up window provided in an embodiment of the present disclosure, such as Figure 3 As shown, the figure shows a page 300 of an application, and the page 300 may include a prompt pop-up window 301, and the prompt pop-up window 301 is used to remind of abnormal memory occupation. For example, the prompt pop-up window 301 in the figure includes object information of 8 objects that have not been released and specific memory abnormal occupation objects. The memory abnormal occupation objects in the figure include two user view objects corresponding to user view class A and one user view object corresponding to user view class B, and the prompt pop-up window 301 also includes a prompt of "regular monitoring, there may be a false alarm that the object that has just been released has not been recycled in time". In addition, the prompt pop-up window 301 also includes a function button for generating a memory snapshot. When the user triggers the function button, a memory snapshot can be generated and stored at this time for reference in the subsequent solution of the memory abnormal occupation problem.

[0053] The abnormal memory occupancy detection scheme of the disclosed embodiment is aimed at operating systems that automatically recycle memory and cannot obtain objects through life cycles. It can non-invasively monitor the abnormal memory occupancy of user view objects of an application during the development phase through instrumentation, without the need for program developers to implement it manually. Program developers and users can use this method to immediately discover problems when memory is not released in the user view objects of an application, solve the problem of abnormal memory occupancy of the program, optimize the memory occupancy of the program virtual machine, and avoid memory overflow (Out Of Memory, OOM) or even crash problems.

[0054] Figure 4 This is a schematic diagram of the structure of a memory abnormal occupancy detection device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 4 As shown, the device comprises:

[0055] The sending module 401 is used for executing a detection call statement to add the user view object to a memory abnormality occupancy list in response to the user view object being removed from the page, wherein the detection call statement is inserted into the user view class of the code file of the application during the compilation process of the application through an instrumentation script in a compilation script;

[0056] The detection module 402 is used to perform abnormal memory usage detection on the user view objects included in the abnormal memory usage list.

[0057] Optionally, the stub script in the compilation script is used to traverse the code files of the application program to identify the user view class during the compilation process of the application program, and insert the detection call statement into the disappearance execution method of the user view class.

[0058] Optionally, when the instrumentation script determines that the user view class does not include the disappearance execution method, it first adds the disappearance execution method and inserts the detection call statement into the disappearance execution method.

[0059] Optionally, the detection module 402 is used to:

[0060] At each preset time interval, determine whether the observation object in the abnormal memory occupancy list is recycled, and if it is recycled, determine whether the user view object included in the abnormal memory occupancy list is recycled;

[0061] If there is an unrecycled user view object, the unrecycled user view object is determined as an abnormally memory-occupying object.

[0062] Optionally, the device further comprises a processing module, configured to:

[0063] The object information of the abnormally occupied memory object is displayed or reported to the server through a prompt pop-up window.

[0064] Optionally, the application program is a program of a target operating system, and the target operating system is an operating system that automatically reclaims memory and cannot obtain objects through a life cycle.

[0065] The abnormal memory occupancy detection device provided in the embodiments of the present disclosure can execute the abnormal memory occupancy detection method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0066] The embodiments of the present disclosure also provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the abnormal memory occupancy detection method provided by any embodiment of the present disclosure.

[0067] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure.

[0068] The following specific reference Figure 5 , which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present disclosure. The electronic device 500 in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0069] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0070] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0071] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the memory abnormal occupancy detection method of the embodiment of the present disclosure are executed.

[0072] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0073] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0074] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0075] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: in response to a user view object being removed from a page, executes a detection call statement to add the user view object to a memory exception occupancy list, wherein the detection call statement is inserted into the user view class of the code file of the application during the compilation process of the application via an instrumentation script in a compilation script; and performs memory exception occupancy detection on the user view objects included in the memory exception occupancy list.

[0076] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0077] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0078] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, constitute a limitation on the unit itself.

[0079] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0080] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0081] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0082] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0083] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0084] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A method for detecting abnormal memory usage, characterized in that: include: In response to the user view object being removed from the page, executing a detection call statement to add the user view object to a memory abnormality occupancy list, wherein the detection call statement is inserted into a user view class of a code file of the application during the compilation process of the application through an instrumentation script in a compilation script; Perform memory abnormality detection on the user view objects included in the memory abnormality list.

2. The method according to claim 1, characterized in that: The stub script in the compilation script is used to traverse the code files of the application program to identify the user view class during the compilation process of the application program, and insert the detection call statement into the disappearance execution method of the user view class.

3. The method according to claim 2, characterized in that When the plug-in script determines that the user view class does not include the disappearance execution method, it first adds the disappearance execution method and inserts the detection call statement into the disappearance execution method.

4. The method according to claim 1, characterized in that: Performing a memory abnormality detection on the user view objects included in the memory abnormality list includes: At each preset time interval, determine whether the observation object in the abnormal memory occupancy list is recycled, and if it is recycled, determine whether the user view object included in the abnormal memory occupancy list is recycled; If there is an unrecycled user view object, the unrecycled user view object is determined as an abnormal memory occupation object.

5. The method according to claim 4, characterized in that The method further comprises: The object information of the abnormally occupied object is displayed or reported through a prompt pop-up window.

6. The method according to any one of claims 1 to 5, characterized in that: The application program is a program of a target operating system, and the target operating system is an operating system that automatically reclaims memory and cannot obtain objects through a life cycle.

7. A memory abnormality occupancy detection device, characterized in that: include: a sending module, configured to execute a detection call statement to add the user view object to a memory abnormality occupancy list in response to the user view object being removed from the page, wherein the detection call statement is inserted into a user view class of a code file of the application during the compilation process of the application through an instrumentation script in a compilation script; The detection module is used to perform abnormal memory usage detection on the user view objects included in the abnormal memory usage list.

8. The device according to claim 7, characterized in that The detection module is used for: At each preset time interval, determine whether the observation object in the abnormal memory occupancy list is recycled, and if it is recycled, determine whether the user view object included in the abnormal memory occupancy list is recycled; If there is an unrecycled user view object, the unrecycled user view object is determined as an abnormally memory-occupying object.

9. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the memory abnormal occupancy detection method described in any one of claims 1-6 above.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the memory abnormal occupancy detection method described in any one of claims 1-6 above.