Memory management method of mine lamp control system and related equipment

By monitoring the life cycle and reference status of the component in the mining lamp control system, and using the reference queue for memory management, the problem of low memory management efficiency and inability to effectively handle memory leakage in the existing technology is solved, and the long-term stable operation and efficient memory of the system are achieved. manage.

CN119473584APending Publication Date: 2025-02-18SHENZHEN ZHONGFUNENG ELECTRIC EQUIPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411511307.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The memory management efficiency of existing mining lamp control systems is low and cannot effectively handle memory leakage, resulting in system performance and stability being affected.

Method used

By obtaining the life cycle change information of the preset component, determining the target component, and monitoring the target component through the reference queue, obtaining its reference status, and memory management is performed based on the reference status and garbage collection status.

Benefits of technology

It realizes timely handling of memory leakage, ensures the long-term and stable operation of the mining lamp control system, reduces system lag or crash problems caused by memory leakage, and improves memory management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473584A_ABST
    Figure CN119473584A_ABST
Patent Text Reader

Abstract

The embodiment of the invention belongs to the field of mobile application development, and relates to a memory management method for a mine lamp control system, which comprises the following steps: acquiring life cycle change information of a preset component; determining a target component according to the life cycle change information; performing reference monitoring on the target component through a reference queue to obtain a reference condition of the target component; and performing memory management according to the reference condition and the current garbage collection state to obtain a memory management result. The invention further provides a memory management device of the mine lamp control system, computer equipment and a storage medium. According to the invention, the memory management efficiency of the mine lamp control system developed based on the Android system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of mobile application development, and in particular to a memory management method and related equipment for a mining lamp control system. Background Art

[0002] In modern society, mining lamp technology is developing rapidly. As an important safety equipment in coal mines, mines and other underground workplaces, the performance of mining lamps directly affects the life safety and work efficiency of miners.

[0003] In the field of mining lamp control technology, mining lamp control systems are generally developed based on the Android system to control the on and off of mining lamps and monitor the status of mining lamps. For mining lamp control systems, memory management is one of the key factors to ensure its stable operation. Once a memory leak occurs, the available memory may be reduced, affecting the performance and stability of the system.

[0004] At present, the traditional solution for memory management is mainly to monitor the garbage collection status through JVMTI (Java Virtual Machine Tool Interface) callbacks, and to monitor the callbacks created by the Activity according to the Activity life cycle. However, although this solution can monitor memory leaks, it cannot effectively deal with the memory leak body itself, resulting in poor results in solving the memory leak problem, and may result in misjudgment or missed judgment, resulting in untimely or unnecessary memory cleanup, thus making memory management inefficient. Summary of the invention

[0005] The purpose of the embodiments of the present application is to propose a memory management method and related equipment for a mining lamp control system, so as to solve the technical problem of low memory management efficiency of a mining lamp control system developed based on an Android system.

[0006] In order to solve the above technical problems, the embodiment of the present application provides a memory management method for a mining lamp control system, which adopts the following technical solution:

[0007] A memory management method for a mining lamp control system comprises the following steps:

[0008] Get the life cycle change information of the preset component;

[0009] Determining a target component according to the life cycle change information;

[0010] Monitor the reference of the target component through a reference queue to obtain the reference status of the target component;

[0011] Memory management is performed according to the reference situation and the current garbage collection state to obtain a memory management result.

[0012] Furthermore, the step of performing memory management according to the reference situation and the current garbage collection state to obtain a memory management result specifically includes:

[0013] If the garbage collection state is a valid state, a memory leak result is generated according to the reference situation;

[0014] Execute a memory management process according to the memory leak result to obtain the memory management result;

[0015] If the garbage collection state is an invalid state, wait until the garbage collection state is a valid state.

[0016] Further, the preset component includes a registered interface carrier activity, the target component includes a current activity, and if the garbage collection state is a valid state, the step of generating a memory leak result according to the reference situation specifically includes:

[0017] Determine whether the current activity exists in the reference queue;

[0018] If the current activity exists, determining that there is no memory leak is taken as the memory leak result;

[0019] If the current activity does not exist, it is determined that a memory leak exists as the memory leak result.

[0020] Furthermore, the step of executing a memory management process according to the memory leak result to obtain the memory management result specifically includes:

[0021] If there is no memory leak, no memory cleanup operation is performed;

[0022] If there is a memory leak, a memory cleanup operation is performed on the current activity and the fragments nested in the current activity.

[0023] Furthermore, the step of monitoring the reference of the target component through the reference queue to obtain the reference status of the target component specifically includes:

[0024] Create a weak reference and a reference list corresponding to the target component, and start the reference queue;

[0025] The weak references and the reference list are monitored according to the reference queue to obtain the reference status.

[0026] Further, after the steps of creating the weak reference and reference list corresponding to the target component and opening the reference queue, the method further includes:

[0027] Obtaining recycling information of the target component;

[0028] The reference queue is configured according to the recycling information.

[0029] Further, the step of configuring the reference queue according to the recycling information specifically includes:

[0030] If the target component is recycled, the weak reference is added to the reference queue;

[0031] If the target component has not been recycled, the weak reference is not added to the reference queue.

[0032] In order to solve the above technical problems, the embodiment of the present application also provides a memory management device for a mining lamp control system, which adopts the following technical solution:

[0033] A memory management device for a mining lamp control system, comprising:

[0034] The acquisition module is used to obtain the life cycle change information of the preset component;

[0035] A determination module, used to determine a target component according to the life cycle change information;

[0036] A monitoring module, used to monitor the reference of the target component through a reference queue to obtain the reference status of the target component;

[0037] The management module is used to perform memory management according to the reference situation and the current garbage collection state to obtain a memory management result.

[0038] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0039] A computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the memory management method of the mining lamp control system as described above are implemented.

[0040] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0041] A computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the memory management method of the mining lamp control system as described above.

[0042] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0043] The memory management method of the mining lamp control system disclosed in the present application obtains the life cycle change information of the preset component; determines the target component according to the life cycle change information; then, monitors the reference of the target component through the reference queue to obtain the reference status of the target component; and then performs memory management according to the reference status and the current garbage collection status to obtain the memory management result. The present application monitors the Activity life cycle and reference status in real time, handles memory leaks in a timely manner, ensures the long-term stable operation of the mining lamp control system, and can effectively reduce the system freeze or crash caused by memory leaks, especially in complex operation scenarios, thereby improving the memory management efficiency of the mining lamp control system developed based on the Android system. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0045] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0046] Figure 2 is a flow chart of an embodiment of a memory management method for a mining lamp control system according to the present application;

[0047] Figure 3 It is a structural schematic diagram of an embodiment of a memory management device of a mining lamp control system according to the present application;

[0048] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION

[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0050] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0051] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0052] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0053] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0054] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 (Moving Picture Experts Group Audio Layer III) players, MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, etc.

[0055] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .

[0056] It should be noted that the memory management method of the mining lamp control system provided in the embodiment of the present application is generally executed by a terminal device, and accordingly, the memory management device of the mining lamp control system is generally arranged in the terminal device.

[0057] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0058] Continue to refer Figure 2 , shows a flow chart of an embodiment of a memory management method for a mining lamp control system according to the present application. The memory management method for a mining lamp control system comprises the following steps:

[0059] Step S201, obtaining life cycle change information of a preset component.

[0060] In this embodiment, the memory management method of the mining lamp control system is run on the electronic device (for example Figure 1 The terminal device shown in the figure can send or receive data through a wired connection or a wireless connection. It should be noted that the above wireless connection methods may include but are not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.

[0061] In this embodiment, in the mining lamp control system, Activity and Fragment are the core components for controlling and monitoring the mining lamp. The system monitors the status of the component (such as creation, destruction, etc.) in real time by registering the component's life cycle callback. Exemplarily, when the user interface of the mining lamp system (such as the mining lamp switch operation interface) is started, the system will call onCreate(), and when the interface is closed, it will call onDestroy(), and monitor memory usage through these callbacks. Of course, in addition to the Activity controlled by the mining lamp, the system can also monitor the life cycle of the Service running in the background (such as the monitoring service of the mining lamp status) to ensure that the background tasks will not cause memory leaks.

[0062] It should be noted that Activity is a basic component in Android applications, representing a screen or a page of an application. Each Activity is responsible for interacting with the user and displaying a user interface. Activity is the entry point for the application to interact with the user. It usually contains UI elements such as buttons, text boxes, pictures, etc.; Activity has a complete life cycle management. The system will call different methods in different states (such as start, pause, and destroy) so that developers can handle related events. For example, the onCreate() method is called when the Activity is created, and the onDestroy() method is called when the Activity is destroyed. Each Activity is usually an independent screen. When the user switches screens in the application, they usually switch to different Activities. Fragment is a more flexible and modular component, usually nested in Activity, used to create reusable UI modules. An Activity can contain multiple Fragments, which can run independently, be added or removed. Fragment provides more fine-grained control and can manage multiple Fragments in an Activity to achieve a dynamic and flexible user interface. For example, part of a screen can be managed by one Fragment and the other part by another Fragment. The life cycle of a Fragment is dependent on the life cycle of the Activity in which it resides. Similar to an Activity, a Fragment also has its own life cycle management methods, such as onCreateView() for creating the Fragment interface and onDestroyView() for destroying the Fragment interface. Fragments can be dynamically added, removed, or replaced while the Activity is running, making the application interface more flexible. It is very suitable for use on tablet devices to help manage complex layouts. A Fragment must be nested in an Activity to run, it cannot exist alone, and the life cycle of a Fragment is determined by the Activity in which it resides.

[0063] Step S202: determining a target component according to the lifecycle change information.

[0064] In this embodiment, the specific component that currently needs to be memory managed (for example, the currently running Activity) is determined based on the acquired lifecycle information. For example, if an Activity is about to be destroyed, the system can use it as the target component for subsequent memory management. The system can also dynamically determine whether to release the memory of certain components in advance based on the memory usage to optimize the overall memory utilization.

[0065] Step S203: Monitor the reference of the target component through a reference queue to obtain the reference status of the target component.

[0066] In this embodiment, a weak reference and a reference queue are created, and weak references are used to monitor whether the target component is processed by garbage collection (GC). Specifically, when the Activity is destroyed, weak references will not prevent it from being recycled by GC, and the system can monitor whether these weak references are cleared from the memory through the reference queue; different reference types (such as soft references or phantom references) can also be used for monitoring according to the type and priority of the target component to improve the flexibility of memory management.

[0067] Step S204, performing memory management according to the reference situation and the current garbage collection state to obtain a memory management result.

[0068] In this embodiment, the system decides whether to clean up the memory based on the situation in the reference queue and the current GC status. Specifically, if the target component has been recycled by GC, no cleanup is required; if it has not been recycled and the GC status is valid, the relevant memory is cleaned up. A custom garbage collection strategy can also be introduced to automatically start memory management when the system memory is tight, without relying on the system GC.

[0069] This application monitors the Activity life cycle and reference status in real time, handles memory leaks in a timely manner, and ensures the long-term stable operation of the mining lamp control system. Especially in complex operation scenarios, it can effectively reduce system freezes or crashes caused by memory leaks, thereby improving the memory management efficiency of the mining lamp control system developed based on the Android system.

[0070] In some optional implementations of this embodiment, the step of performing memory management according to the reference situation and the current garbage collection state to obtain a memory management result includes:

[0071] If the garbage collection state is a valid state, a memory leak result is generated according to the reference situation;

[0072] Execute a memory management process according to the memory leak result to obtain the memory management result;

[0073] If the garbage collection state is an invalid state, wait until the garbage collection state is a valid state.

[0074] In this embodiment, when the GC state of the mining lamp control system is valid, it checks whether the target component in the reference queue is recycled and generates a memory leak judgment result. If the mining lamp control Activity is not recycled during the effective GC period, the system determines that a memory leak has occurred; based on the memory leak situation, the system decides whether to perform a memory cleanup operation. If the system detects that the mining lamp control interface has not been recycled, the system will immediately release the relevant memory; when the GC state is invalid, the system will not perform memory management to avoid invalid cleanup. It can be optimized to actively trigger GC when the system memory is tight, thereby improving memory management efficiency.

[0075] Through intelligent judgment of GC status, this application enables the system to clean up memory at appropriate times, reduce unnecessary memory consumption in the mining lamp control system, and maintain efficient operation of the system, which is especially suitable for device environments with limited resources.

[0076] In some optional implementations of this embodiment, the preset component includes a registered interface carrier activity, the target component includes a current activity, and if the garbage collection state is a valid state, the step of generating a memory leak result according to the reference situation specifically includes:

[0077] Determine whether the current activity exists in the reference queue;

[0078] If the current activity exists, determining that there is no memory leak is taken as the memory leak result;

[0079] If the current activity does not exist, it is determined that a memory leak exists as the memory leak result.

[0080] In this embodiment, the system determines whether the target Activity has been recycled by checking the reference queue. For example, if the Activity of the mining lamp control interface has been recycled, the system determines that no memory leak has occurred; if the Activity does not exist in the reference queue, a memory leak is determined and a memory leak result is generated.

[0081] This application can accurately determine the status of the Activity, effectively prevent misjudgment or missed judgment, ensure that the mining lamp control system can accurately identify memory leaks, and improve the accuracy and reliability of memory management.

[0082] In some optional implementations of this embodiment, the step of executing the memory management process according to the memory leak result to obtain the memory management result specifically includes:

[0083] If there is no memory leak, no memory cleanup operation is performed;

[0084] If there is a memory leak, a memory cleanup operation is performed on the current activity and the fragments nested in the current activity.

[0085] In this embodiment, if it is confirmed that there is no memory leak in the Activity, the system will not perform unnecessary memory cleaning operations. If there is a memory leak, the system will clean up the target Activity and its related Fragment memory. For example, multiple Fragments are nested in the mining lamp system to display different status information. If these Fragments are not recycled by GC, the system will clean them together.

[0086] This application ensures that the system performs cleanup operations only when an actual memory leak is detected, avoiding frequent invalid memory releases and maintaining stable performance of the mining lamp control system.

[0087] In some optional implementations of this embodiment, the step of monitoring the reference of the target component through the reference queue to obtain the reference status of the target component specifically includes:

[0088] Create a weak reference and a reference list corresponding to the target component, and start the reference queue;

[0089] The weak references and the reference list are monitored according to the reference queue to obtain the reference status.

[0090] In this embodiment, a weak reference is created for the target Activity or Fragment, and a reference queue is enabled for monitoring. When the mining lamp control interface or its nested Fragment is started, the system creates a weak reference and adds it to the reference queue for real-time monitoring. For mining lamp status images that occupy a large amount of memory (such as real-time monitoring data), a similar weak reference mechanism can also be used for memory management.

[0091] This application uses weak references to avoid strong references to components, and the system can effectively prevent memory leaks, especially for objects that occupy a large amount of memory, which can significantly reduce the memory burden and improve the stability of the mining lamp control system.

[0092] In some optional implementations of this embodiment, after the steps of creating the weak reference and reference list corresponding to the target component and opening the reference queue, the following steps are further included:

[0093] Obtaining recycling information of the target component;

[0094] The reference queue is configured according to the recycling information.

[0095] In this embodiment, the system obtains information on whether the target Activity or other components have been recycled by GC, which is further used for memory management. The system detects whether the mining lamp control interface has been released from the memory to decide whether additional cleanup operations are required. According to the recycling status of the component, the system dynamically configures the reference queue. The reference queue can be configured according to the priority of different components (such as core control components are retained first, and non-core components are recycled first) to optimize the memory usage strategy.

[0096] This application obtains and adjusts the reference queue in real time, so that the system can dynamically adapt to the memory status and ensure that the mining lamp control system maintains the best memory management strategy during operation.

[0097] In some optional implementations of this embodiment, the step of configuring the reference queue according to the recycling information specifically includes:

[0098] If the target component is recycled, the weak reference is added to the reference queue;

[0099] If the target component has not been recycled, the weak reference is not added to the reference queue.

[0100] In this embodiment, if the target component has been recycled by GC, the system adds its weak reference to the reference queue to indicate that the object has been processed; if the target component has not been recycled, the system continues to monitor it.

[0101] This application ensures that the system will process related memory release operations only after GC completes recycling, avoiding invalid cleanup steps and further improving the operating efficiency of the mining lamp control system.

[0102] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0103] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0104] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0105] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0106] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a memory management device for a mining lamp control system. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0107] like Figure 3 As shown, the memory management device 300 of the mining lamp control system described in this embodiment includes: an acquisition module 301, a determination module 302, a monitoring module 303 and a management module 304. Among them:

[0108] The acquisition module 301 is used to acquire the life cycle change information of the preset component;

[0109] A determination module 302, configured to determine a target component according to the life cycle change information;

[0110] The monitoring module 303 is used to monitor the reference of the target component through the reference queue to obtain the reference status of the target component;

[0111] The management module 304 is used to perform memory management according to the reference situation and the current garbage collection state to obtain a memory management result.

[0112] The memory management device of the mining lamp control system provided by the present application has beneficial effects.

[0113] In some optional implementations of this embodiment, the management module 304 is further configured to:

[0114] If the garbage collection state is a valid state, a memory leak result is generated according to the reference situation;

[0115] Execute a memory management process according to the memory leak result to obtain the memory management result;

[0116] If the garbage collection state is an invalid state, wait until the garbage collection state is a valid state.

[0117] The memory management device of the mining lamp control system provided in the present application monitors the Activity life cycle and reference status in real time, handles memory leaks in a timely manner, and ensures the long-term stable operation of the mining lamp control system. Especially in complex operation scenarios, it can effectively reduce the system freeze or crash caused by memory leaks, thereby improving the memory management efficiency of the mining lamp control system developed based on the Android system.

[0118] In some optional implementations of this embodiment, the preset component includes a registered interface carrier activity, the target component includes a current activity, and if the garbage collection state is a valid state, the monitoring module 303 is further used to:

[0119] Determine whether the current activity exists in the reference queue;

[0120] If the current activity exists, determining that there is no memory leak is taken as the memory leak result;

[0121] If the current activity does not exist, it is determined that a memory leak exists as the memory leak result.

[0122] The memory management device of the mining lamp control system provided in the present application can perform memory cleanup at an appropriate time through intelligent judgment of the GC status, thereby reducing unnecessary memory consumption in the mining lamp control system and maintaining efficient operation of the system, and is particularly suitable for device environments with limited resources.

[0123] In some optional implementations of this embodiment, the monitoring module 303 is further configured to:

[0124] If there is no memory leak, no memory cleanup operation is performed;

[0125] If there is a memory leak, a memory cleanup operation is performed on the current activity and the fragments embedded in the current activity. The memory management device of the mining lamp control system provided by the present application can accurately determine the state of the Activity, effectively prevent misjudgment or missed judgment, ensure that the mining lamp control system can accurately identify memory leaks, and improve the accuracy and reliability of memory management.

[0126] In some optional implementations of this embodiment, the management module 304 is further configured to:

[0127] Create a weak reference and a reference list corresponding to the target component, and start the reference queue;

[0128] The weak reference and the reference list are monitored according to the reference queue to obtain the reference status. The memory management device of the mining lamp control system provided by the present application ensures that the system performs a cleanup operation only when an actual memory leak is detected, avoids frequent invalid memory release, and maintains stable performance of the mining lamp control system.

[0129] In some optional implementations of this embodiment, the management module 304 is further configured to:

[0130] Obtaining recycling information of the target component;

[0131] The reference queue is configured according to the recycling information.

[0132] The memory management device of the mining lamp control system provided in the present application uses weak references to avoid strong references to components. The system can effectively prevent memory leaks, especially for objects that occupy a large amount of memory. It can significantly reduce the memory burden and improve the stability of the mining lamp control system.

[0133] In some optional implementations of this embodiment, the management module 304 is further configured to:

[0134] If the target component is recycled, the weak reference is added to the reference queue;

[0135] If the target component is not recycled, the weak reference is not added to the reference queue. The memory management device of the mining lamp control system provided by the present application obtains and adjusts the reference queue in real time, so that the system can dynamically adapt to the memory state and ensure that the mining lamp control system maintains the best memory management strategy during operation.

[0136] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.

[0137] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components 41-43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0138] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0139] The memory 41 includes at least one type of readable storage medium, which includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the computer device 4. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions of the memory management method of the mining lamp control system, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.

[0140] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run the computer-readable instructions stored in the memory 41 or process data, such as computer-readable instructions for running the memory management method of the mining lamp control system.

[0141] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.

[0142] The computer device provided in this application monitors the Activity life cycle and reference status in real time, handles memory leaks in a timely manner, and ensures the long-term stable operation of the mining lamp control system. Especially in complex operation scenarios, it can effectively reduce system freezes or crashes caused by memory leaks, thereby improving the memory management efficiency of the mining lamp control system developed based on the Android system.

[0143] The present application also provides another embodiment, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the memory management method of the mining lamp control system as described above.

[0144] The computer-readable storage medium provided by the present application monitors the Activity life cycle and reference status in real time, handles memory leaks in a timely manner, and ensures the long-term stable operation of the mining lamp control system. Especially in complex operation scenarios, it can effectively reduce the system freeze or crash caused by memory leaks, thereby improving the memory management efficiency of the mining lamp control system developed based on the Android system.

[0145] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0146] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A memory management method for a mining lamp control system, characterized in that: The steps include: Get the life cycle change information of the preset component; Determining a target component according to the life cycle change information; Monitor the reference of the target component through a reference queue to obtain the reference status of the target component; Memory management is performed according to the reference situation and the current garbage collection state to obtain a memory management result.

2. The memory management method of the mining lamp control system according to claim 1, characterized in that: The step of performing memory management according to the reference situation and the current garbage collection state to obtain a memory management result specifically includes: If the garbage collection state is a valid state, a memory leak result is generated according to the reference situation; Execute a memory management process according to the memory leak result to obtain the memory management result; If the garbage collection state is an invalid state, wait until the garbage collection state is a valid state.

3. The memory management method of the mining lamp control system according to claim 2, characterized in that: The preset component includes a registered interface carrier activity, the target component includes a current activity, and if the garbage collection state is a valid state, the step of generating a memory leak result according to the reference situation specifically includes: Determine whether the current activity exists in the reference queue; If the current activity exists, determining that there is no memory leak is taken as the memory leak result; If the current activity does not exist, it is determined that a memory leak exists, which is taken as the memory leak result.

4. The memory management method of the mining lamp control system according to claim 3, characterized in that: The step of executing the memory management process according to the memory leak result to obtain the memory management result specifically includes: If there is no memory leak, the memory cleanup operation will not be performed; If there is a memory leak, a memory cleanup operation is performed on the current activity and the fragments nested in the current activity.

5. The memory management method of a mining lamp control system according to any one of claims 1 to 4, characterized in that: The step of monitoring the reference of the target component through the reference queue to obtain the reference status of the target component specifically includes: Create a weak reference and a reference list corresponding to the target component, and start the reference queue; The weak references and the reference list are monitored according to the reference queue to obtain the reference status.

6. The memory management method of the mining lamp control system according to claim 5, characterized in that: After the steps of creating the weak reference and reference list corresponding to the target component and opening the reference queue, the method further includes: Obtaining recycling information of the target component; The reference queue is configured according to the recycling information.

7. The memory management method of the mining lamp control system according to claim 6, characterized in that: The step of configuring the reference queue according to the recycling information specifically includes: If the target component is recycled, the weak reference is added to the reference queue; If the target component has not been recycled, the weak reference is not added to the reference queue.

8. A memory management device for a mining lamp control system, characterized in that: include: The acquisition module is used to obtain the life cycle change information of the preset component; A determination module, used to determine a target component according to the life cycle change information; A monitoring module, used to monitor the reference of the target component through a reference queue to obtain the reference status of the target component; The management module is used to perform memory management according to the reference situation and the current garbage collection state to obtain a memory management result.

9. A computer device, characterized in that: The invention comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the memory management method of the mining lamp control system as described in any one of claims 1 to 7 when executing the computer-readable instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the memory management method of the mining lamp control system according to any one of claims 1 to 7 are implemented.