CN110858178A - Memory recovery method, device, equipment and medium - Google Patents

Memory recovery method, device, equipment and medium Download PDF

Info

Publication number
CN110858178A
CN110858178A CN201810892677.9A CN201810892677A CN110858178A CN 110858178 A CN110858178 A CN 110858178A CN 201810892677 A CN201810892677 A CN 201810892677A CN 110858178 A CN110858178 A CN 110858178A
Authority
CN
China
Prior art keywords
memory
threshold
preset
level
memory leakage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810892677.9A
Other languages
Chinese (zh)
Inventor
邓太平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Xiaopeng Motors Technology Co Ltd
Original Assignee
Guangzhou Xiaopeng Motors Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Xiaopeng Motors Technology Co Ltd filed Critical Guangzhou Xiaopeng Motors Technology Co Ltd
Priority to CN201810892677.9A priority Critical patent/CN110858178A/en
Publication of CN110858178A publication Critical patent/CN110858178A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44594Unloading

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses a memory recovery method, a memory recovery device, memory recovery equipment and a memory recovery medium, which are used for solving the problem of memory leakage caused by long-time running of a system. The memory recovery method comprises the following steps: acquiring a process identifier and an actually used physical memory of each process in a running state in a system; determining the memory leakage level of each process according to the obtained actually used physical memory of each process based on a pre-configured memory leakage level table, wherein the memory leakage level table comprises a process identifier, a memory leakage threshold value and a corresponding relation between the memory leakage levels; and closing part or all processes with the memory leakage level larger than the first preset level threshold.

Description

Memory recovery method, device, equipment and medium
Technical Field
The present invention relates to the field of memory management technologies, and in particular, to a method, an apparatus, a device, and a medium for memory recovery.
Background
Currently, more and more vehicle-mounted central control systems use android (android) systems, and in practical applications, the vehicle-mounted central control systems are generally not powered off even in a non-driving state in order to respond to various control operations (for example, remote control) in real time.
Due to the defect of memory management of the android system, if the android system is in a running state for a long time, the memory leakage problem is difficult to repair. In the prior art, some memory leak detection methods exist, and such methods usually involve complex calculation and logic processing during memory leak detection, which brings extra overhead to the system.
Therefore, a memory recovery method is needed to solve the memory leakage problem caused by long-time operation of the system.
Disclosure of Invention
The embodiment of the invention provides a memory recovery method, a memory recovery device, memory recovery equipment and a memory recovery medium, which are used for solving the problem of memory leakage caused by a system in a running state for a long time.
In a first aspect, an embodiment of the present invention provides a memory recycling method, including:
acquiring a process identifier and an actually used physical memory of each process in a running state in a system;
determining the memory leakage level of each process according to the obtained actually used physical memory of each process based on a pre-configured memory leakage level table, wherein the memory leakage level table comprises a process identifier, a memory leakage threshold value and a corresponding relation between the memory leakage levels;
and closing part or all processes with the memory leakage level larger than the first preset level threshold.
In a possible implementation manner, in the method provided in an embodiment of the present invention, closing a process in which a part or all of the memory leakage level is greater than a first preset level threshold includes:
acquiring the running priority of each process in a running state in the system;
and in the process with the running priority higher than the preset priority threshold, closing part or all processes with the memory leakage level higher than the first preset level threshold.
In a possible implementation manner, in the method provided in an embodiment of the present invention, closing a process in which a part or all of the memory leakage level is greater than a first preset level threshold includes:
and closing part or all processes with the memory leakage levels larger than the first preset level threshold according to the amount of the memory space required to be released and the actually used physical memory of each process with the memory leakage level larger than the first preset level threshold, wherein the sum of the actually used physical memories of all the closed processes is larger than or equal to the amount of the memory space required to be released.
In a possible implementation manner, in the foregoing method provided in an embodiment of the present invention, the method further includes:
and under the condition that the system is determined to be in an idle state, closing the process of which the memory leakage level is greater than a second preset level threshold, wherein the first preset level threshold is higher than the second preset level threshold.
In a possible implementation manner, the method provided in an embodiment of the present invention, acquiring a process identifier and an actually used physical memory of each process in a running state in a system, includes:
and acquiring the process identification and the actually used physical memory of each process in the running state in the system under the condition that the allocable physical memory space of the system is smaller than a preset space threshold.
In a second aspect, an embodiment of the present invention provides a memory recycling device, including:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a process identifier and an actually used physical memory of each process in a running state in the system;
the processing unit is used for determining the memory leakage level of each process according to the acquired actually used physical memory of each process based on a pre-configured memory leakage level table, wherein the memory leakage level table comprises a process identifier, a memory leakage threshold and a corresponding relation among the memory leakage levels;
and the recovery unit is used for closing part or all processes with the memory leakage level larger than the first preset level threshold.
In a possible implementation manner, in the above apparatus provided by an embodiment of the present invention, the recycling unit is specifically configured to:
acquiring the running priority of each process in a running state in the system;
and in the process with the running priority higher than the preset priority threshold, closing part or all processes with the memory leakage level higher than the first preset level threshold.
In a possible implementation manner, in the above apparatus provided by an embodiment of the present invention, the recycling unit is specifically configured to:
and closing part or all processes with the memory leakage levels larger than the first preset level threshold according to the amount of the memory space required to be released and the actually used physical memory of each process with the memory leakage level larger than the first preset level threshold, wherein the sum of the actually used physical memories of all the closed processes is larger than or equal to the amount of the memory space required to be released.
In a possible implementation manner, in the above apparatus provided by an embodiment of the present invention, the recycling unit is further configured to:
and under the condition that the system is determined to be in an idle state, closing the process of which the memory leakage level is greater than a second preset level threshold, wherein the first preset level threshold is higher than the second preset level threshold.
In a possible implementation manner, in the apparatus provided in an embodiment of the present invention, the obtaining unit is specifically configured to:
and acquiring the process identification and the actually used physical memory of each process in the running state in the system under the condition that the allocable physical memory space of the system is smaller than a preset space threshold.
In a third aspect, an embodiment of the present invention provides a memory recycling device, including: at least one processor, at least one memory, and computer program instructions stored in the memory, which when executed by the processor, implement the method provided by the first aspect of an embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which computer program instructions are stored, which, when executed by a processor, implement the method provided by the first aspect of the embodiment of the present invention.
The embodiment of the invention provides a memory recovery method, a device, equipment and a medium, which are used for acquiring a process identifier and an actually used physical memory of each process in an operating state in a system, determining the memory leakage level of each process according to the acquired actually used physical memory of each process based on a pre-configured memory leakage level table, releasing the physical memory occupied by the partially leaked memory processes by closing part or all of the processes with the memory leakage level greater than a first preset level threshold value, and recovering the memory space of the system, thereby solving the problem of memory leakage caused by the long-time operation state of the system.
Drawings
Fig. 1 is a schematic flow chart of a memory recovery method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart illustrating a specific flow of a memory recovery method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a memory recovery device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a memory recycling device according to an embodiment of the present invention.
Detailed Description
The following describes in detail specific embodiments of a memory recovery method, device, apparatus, and medium according to an embodiment of the present invention with reference to the accompanying drawings.
It should be noted that the memory recovery scheme provided in the embodiment of the present invention is not only applicable to the android system used in the vehicle-mounted central control system, but also applicable to other android systems in a long-term operating state or other operating systems with memory leakage.
As shown in fig. 1, the memory recycling method provided in the embodiment of the present invention may include the following steps:
step 101, acquiring a process identifier and an actually used physical memory of each process in a running state in a system.
The process identification is used for uniquely identifying each process, and the process identifications of different processes are different. In a specific implementation, the process identifier may be a process identifier of each process, or a process name of each process, or may be a combination of multiple attribute features of each process, for example, the process identifier may be a combination of a process identifier and a process name of each process, which is not limited in this embodiment of the present invention.
In a possible implementation manner, when the process identifier and the actually used physical memory of each process in the running state in the system are acquired, the process identifier and the actually used physical memory of each process in the running state in the system may be triggered to be acquired under the condition that the allocable physical memory space of the system is smaller than the preset space threshold, so as to reduce the system computation amount and reduce the influence on the user. The preset space threshold may be flexibly set according to the size of the system memory space, for example, the preset space threshold is set to 500 Mega (MB).
In another possible implementation manner, when the process identifier and the actually used physical memory of each process in the running state in the system are obtained, each process in the running state may be periodically traversed in the running process of the system, and the process identifier and the actually used physical memory of each process in the running state in the system are obtained, so as to provide data support for subsequently analyzing the cause of the memory leak. Wherein, the period of traversal can be set according to experience flexibility, such as: the cycle time was 60 minutes.
It should be noted that, when each process in the running state is periodically traversed during the running process of the system and the process identifier and the actually used physical memory of each process in the running state in the system are acquired, if the allocable physical memory space of the system is smaller than the preset space threshold, when it is triggered that the process identifier and the actually used physical memory of each process in the running state in the system need to be acquired, the latest acquisition result in the periodic acquisition results may be used as the acquired process identifier and the actually used physical memory of each process in the running state in the system. Of course, when the allocable physical memory space of the system is smaller than the preset space threshold value and the process identifier of each process in the running state in the system needs to be acquired and the physical memory is actually used, the process identifier can be acquired again, that is, the process identifier is acquired in real time, so that the accuracy is improved.
In specific implementation, when the process identifier of each process in the running state in the system is acquired, the process identifier may be directly or indirectly acquired from the attribute information of the process. Specifically, when a single attribute information in the process attribute information is used as the process identifier, for example, when a process name or a process identifier is used as the process identifier, the process identifier may be directly obtained from the attribute information of each process; when a combination of a plurality of pieces of attribute information in the process attribute information is used as the process identification, for example, when a combination of a process name and a process identifier is used as the process identification, the process identification may be indirectly acquired from the attribute information of each process.
In specific implementation, when the actually used physical memory of each process in the running state in the system is obtained, one thread or work queue may be started, and the actually used physical memory of each process is obtained through a get _ mm _ rss kernel function. Of course, in other embodiments of the present invention, the data may be obtained in other manners, and the present invention is not limited to the specific limitations.
Step 102, determining a memory leakage level of each process according to the obtained actually used physical memory of each process based on a pre-configured memory leakage level table, where the memory leakage level table includes a process identifier, a memory leakage threshold, and a corresponding relationship between the memory leakage levels.
It should be noted that the pre-configured memory leak level table includes a corresponding relationship among the process identifier, the memory leak threshold, and the memory leak level. The memory leak threshold refers to a threshold value at which a process actually uses a physical memory.
In the memory leakage level table, different processes may configure different memory leakage thresholds because different processes use different physical memories. In order to determine the severity of the process memory leak, one or more memory leak thresholds may be set for each process, where different memory leak thresholds correspond to different memory leak levels.
The correspondence between the memory leakage threshold and the memory leakage level may be set according to an empirical value. For example, if the memory leakage levels are 1 level, 2 levels, and 3 levels in sequence from low to high, the memory leakage level corresponding to the memory leakage threshold of 100M may be set to be 1 level; the memory leakage level corresponding to the 300M memory leakage threshold is 2 levels; the memory leak level corresponding to the memory leak threshold of 500M is level 3.
In specific implementation, the process identifier and the actually used physical memory of each process in the running state in the system are acquired in step 101, so that the memory leakage level of each process in the running state can be determined based on the pre-configured memory leakage level table, the process identifier and the actually used physical memory of each process acquired in step 101.
It should be noted that, if a certain process in the running state does not have the configuration of the memory leak threshold and the memory leak level of the process in the memory leak level table, the process may be determined by using a system default value or may be omitted, which is not limited in the embodiment of the present invention.
Step 103, closing part or all processes with the memory leakage level larger than the first preset level threshold.
In specific implementation, after the memory leakage level of each process is determined in step 102, some or all processes with memory leakage levels greater than the first preset level threshold may be closed to recycle the physical memory of the system. The first preset level threshold may be set according to an empirical value. For example, when the memory leakage level is divided into 1-10 levels from low to high, the first preset level threshold may be set to 8 levels.
In a possible implementation manner, when closing a part or all of the processes whose memory leakage levels are greater than the first preset level threshold, in order to reduce the influence on normal use of the user as much as possible, the running priority of each process in a running state in the system may be obtained, and in the processes whose running priorities are greater than the preset priority threshold, the processes whose memory leakage levels are greater than the first preset level threshold are closed. The preset priority threshold value can be set according to an empirical value.
In specific implementation, if the system is an android system, when closing part or all of the processes with the memory leakage level greater than the first preset level threshold, the system can be combined with a native low memory killer mechanism of the android system, and in the processes with the operation priority higher than the preset priority threshold, the process with the memory leakage level greater than the first preset level threshold is closed.
In another possible implementation manner, when closing a part or all of the processes with the memory leakage level greater than the first preset level threshold, in order to reduce the influence on the normal use of the user as much as possible, according to the amount of the memory space required to be released and the actually used physical memory of each process with the memory leakage level greater than the first preset level threshold, the process with the part or all of the memory leakage level greater than the first preset level threshold may be closed, wherein the sum of the actually used physical memories of all the closed processes is greater than or equal to the amount of the memory space required to be released.
It should be noted that the memory space released by the process that closes each memory leak is the actual used physical memory of the process.
In a possible implementation manner, the memory recovery amount is increased, and a process in which the memory leakage level is greater than a second preset level threshold may be closed under the condition that the system is determined to be in the idle state, where the first preset level threshold is higher than the second preset level threshold.
The system may be determined in various ways when the system is in the idle state, which is not limited in the present invention. For example, when the system screen is in an off state and does not enter a sleep mode, it is determined that the system is in an idle state; for another example, when the system does not receive an operation instruction from the user for a long time, it is determined that the system is in the idle state.
In specific implementation, under the condition that the system is determined to be in the idle state, closing the process of which the memory leakage level is greater than the second preset level threshold, wherein the second preset level threshold may be one of the memory leakage levels, so as to close the process of which the memory leakage level is greater than the second preset level threshold; or may be a value less than the lowest memory leak level to shut down all processes that leak memory.
In practical applications, the memory recovery scheme provided in the embodiment of the present invention can recover the memory space of the system, solve the problem of memory fragmentation of the system to a certain extent, and ensure the healthy operation of the system when closing a process in which part or all of the memory leakage levels are greater than the first preset level threshold.
The following describes the memory recovery method according to the embodiment of the present invention in detail with reference to fig. 2.
As shown in fig. 2, the memory recovery method provided in the embodiment of the present invention may include the following specific steps:
in step 201, a system assignable physical memory space is obtained. The system may allocate a physical memory space, that is, an unused physical memory space in the system.
Step 202, determining whether the system allocable physical memory space is smaller than a preset space threshold, if so, executing step 203, otherwise, continuing to execute step 201 to obtain the system allocable physical memory space.
In step 203, when it is determined that the allocable physical memory space of the system is smaller than the preset space threshold, the process identifier and the actually used physical memory of each process in the running state in the system are obtained.
In specific implementation, the process identifier of each process in the running state in the system and the physical memory are acquired in real time when the physical memory is actually used. If the system periodically acquires the process identifier of each process in the running state and actually uses the physical memory, the system may not acquire the process identifier again but use the acquisition result of the previous cycle.
Step 204, determining the memory leakage level of each process based on the pre-configured memory leakage level table. The memory leakage level table includes a process identifier, a memory leakage threshold, and a corresponding relationship between memory leakage levels.
Step 205, acquiring the running priority of the process in running state in the system.
It should be noted that, because the running priority of the process in the system changes more frequently, the running priority of the process needs to be obtained in real time, that is, the running priority of the process in the running state in the system at the current time is obtained.
In step 206, in the process with the operation priority higher than the preset priority threshold, closing part or all of the processes with the memory leakage level higher than the first preset level threshold. The preset priority threshold and the first preset level threshold can be set according to empirical values.
Step 207, determining whether the system is in an idle state, if so, executing step 208, otherwise, executing step 207 to determine whether the system is in an idle state.
And step 208, when the system is determined to be in the idle state, closing the process of which the memory leakage level is greater than the second preset level threshold value. Wherein the second preset level threshold is lower than the first preset level threshold.
In practical applications, the second preset level threshold may be one of the memory leakage levels, so as to close a process in which the memory leakage level is greater than the second preset level threshold; or may be a value less than the lowest memory leak level to shut down all processes that leak memory.
Based on the same inventive concept, the embodiment of the invention also provides a memory recovery device.
As shown in fig. 3, the memory recovery apparatus provided in the embodiment of the present invention includes:
an obtaining unit 301, configured to obtain a process identifier and an actually used physical memory of each process in an operating state in the system.
A processing unit 302, configured to determine a memory leakage level of each process according to an obtained actually used physical memory of each process based on a pre-configured memory leakage level table, where the memory leakage level table includes a process identifier, a memory leakage threshold, and a corresponding relationship between the memory leakage levels.
The recycling unit 303 is configured to close a process in which a part or all of the memory leakage level is greater than a first preset level threshold.
The memory recovery device provided in the embodiment of the present invention obtains the process identifier and the actually used physical memory of each process in the system in the running state, determines the memory leakage level of each process according to the obtained actually used physical memory of each process based on the pre-configured memory leakage level table, and releases the physical memory occupied by the processes with partial memory leakage by closing part or all of the processes with the memory leakage level greater than the first preset level threshold, and recovers the memory space of the system, thereby solving the memory leakage problem caused by the long-time running state of the system.
In a possible embodiment, the recovery unit 303 is specifically configured to: acquiring the running priority of each process in a running state in the system; and in the process with the running priority higher than the preset priority threshold, closing part or all processes with the memory leakage level higher than the first preset level threshold.
In a possible embodiment, the recovery unit 303 is specifically configured to: and closing part or all processes with the memory leakage levels larger than the first preset level threshold according to the amount of the memory space required to be released and the actually used physical memory of each process with the memory leakage level larger than the first preset level threshold, wherein the sum of the actually used physical memories of all the closed processes is larger than or equal to the amount of the memory space required to be released.
In a possible embodiment, the recycling unit 303 is further configured to: and under the condition that the system is determined to be in an idle state, closing the process of which the memory leakage level is greater than a second preset level threshold, wherein the first preset level threshold is higher than the second preset level threshold.
In a possible implementation, the obtaining unit 301 is specifically configured to: and acquiring the process identification and the actually used physical memory of each process in the running state in the system under the condition that the allocable physical memory space of the system is smaller than a preset space threshold.
In addition, the memory reclamation method and apparatus described in conjunction with fig. 1-3 according to the embodiments of the present invention may be implemented by a memory reclamation device. Fig. 4 is a schematic diagram illustrating a hardware structure of the memory recycling device according to the embodiment of the present invention.
The memory recovery device may include a processor 401 and a memory 402 storing computer program instructions.
Specifically, the processor 401 may include a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC), or may be configured as one or more Integrated circuits implementing embodiments of the present invention.
Memory 402 may include mass storage for data or instructions. By way of example, and not limitation, memory 402 may include a Hard Disk Drive (HDD), floppy Disk Drive, flash memory, optical Disk, magneto-optical Disk, tape, or Universal Serial Bus (USB) Drive or a combination of two or more of these. Memory 402 may include removable or non-removable (or fixed) media, where appropriate. The memory 402 may be internal or external to the data processing apparatus, where appropriate. In a particular embodiment, the memory 402 is a non-volatile solid-state memory. In a particular embodiment, the memory 402 includes Read Only Memory (ROM). Where appropriate, the ROM may be mask-programmed ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), electrically rewritable ROM (EAROM), or flash memory or a combination of two or more of these.
The processor 401 reads and executes the computer program instructions stored in the memory 402 to implement any one of the memory reclamation methods in the above embodiments.
In one example, the memory reclamation apparatus may also include a communication interface 403 and a bus 410. As shown in fig. 4, the processor 401, the memory 402, and the communication interface 403 are connected via a bus 410 to complete communication therebetween.
The communication interface 403 is mainly used for implementing communication between modules, apparatuses, units and/or devices in the embodiments of the present invention.
The bus 410 may comprise hardware, software, or both that couple the components of the memory reclamation apparatus to one another. By way of example, and not limitation, a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hypertransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an infiniband interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a video electronics standards association local (VLB) bus, or other suitable bus or a combination of two or more of these. Bus 410 may include one or more buses, where appropriate. Although specific buses have been described and shown in the embodiments of the invention, any suitable buses or interconnects are contemplated by the invention.
The memory recovery device may execute the memory recovery method in the embodiment of the present invention based on the acquired process identifier of each process in the running state in the system and the actually used physical memory, thereby implementing the memory recovery method and apparatus described in conjunction with fig. 1 to 3.
In addition, in combination with the memory recycling method in the foregoing embodiments, embodiments of the present invention may provide a computer-readable storage medium to implement the memory recycling method. The computer readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the memory reclamation methods in the above embodiments.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (12)

1. A memory reclamation method, comprising:
acquiring a process identifier and an actually used physical memory of each process in a running state in a system;
determining the memory leakage level of each process according to the obtained actually used physical memory of each process based on a pre-configured memory leakage level table, wherein the memory leakage level table comprises a process identifier, a memory leakage threshold value and a corresponding relation between the memory leakage levels;
and closing part or all processes with the memory leakage level larger than the first preset level threshold.
2. The method of claim 1, wherein shutting down some or all processes having a memory leakage level greater than a first predetermined level threshold comprises:
acquiring the running priority of each process in a running state in the system;
and in the process with the running priority higher than the preset priority threshold, closing part or all processes with the memory leakage level higher than the first preset level threshold.
3. The method of claim 1, wherein shutting down some or all processes having a memory leakage level greater than a first predetermined level threshold comprises:
and closing part or all processes with the memory leakage levels larger than the first preset level threshold according to the amount of the memory space required to be released and the actually used physical memory of each process with the memory leakage level larger than the first preset level threshold, wherein the sum of the actually used physical memories of all the closed processes is larger than or equal to the amount of the memory space required to be released.
4. The method of claim 1, further comprising:
and under the condition that the system is determined to be in an idle state, closing the process of which the memory leakage level is greater than a second preset level threshold, wherein the first preset level threshold is higher than the second preset level threshold.
5. The method according to any one of claims 1 to 4, wherein the obtaining the process identifier and the actually used physical memory of each process in a running state in the system comprises:
and under the condition that the allocable physical memory space of the system is smaller than a preset space threshold value, acquiring the process identification and the actually used physical memory of each process in the running state in the system.
6. A memory recycling device, comprising:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a process identifier and an actually used physical memory of each process in a running state in the system;
the processing unit is used for determining the memory leakage level of each process according to the acquired actually used physical memory of each process based on a pre-configured memory leakage level table, wherein the memory leakage level table comprises a process identifier, a memory leakage threshold and a corresponding relation among the memory leakage levels;
and the recovery unit is used for closing part or all processes with the memory leakage level larger than the first preset level threshold.
7. The device according to claim 6, characterized in that the recovery unit is in particular adapted to:
acquiring the running priority of each process in a running state in the system;
and in the process with the running priority higher than the preset priority threshold, closing part or all processes with the memory leakage level higher than the first preset level threshold.
8. The device according to claim 6, characterized in that the recovery unit is in particular adapted to:
and closing part or all processes with the memory leakage levels larger than the first preset level threshold according to the amount of the memory space required to be released and the actually used physical memory of each process with the memory leakage level larger than the first preset level threshold, wherein the sum of the actually used physical memories of all the closed processes is larger than or equal to the amount of the memory space required to be released.
9. The apparatus of claim 6, wherein the recovery unit is further configured to:
and under the condition that the system is determined to be in an idle state, closing the process of which the memory leakage level is greater than a second preset level threshold, wherein the first preset level threshold is higher than the second preset level threshold.
10. The apparatus according to any one of claims 6 to 9, wherein the obtaining unit is specifically configured to:
and under the condition that the allocable physical memory space of the system is smaller than a preset space threshold value, acquiring the process identification and the actually used physical memory of each process in the running state in the system.
11. A memory reclamation apparatus, comprising: at least one processor, at least one memory, and computer program instructions stored in the memory that, when executed by the processor, implement the method of any of claims 1-5.
12. A computer-readable storage medium having computer program instructions stored thereon, which when executed by a processor implement the method of any one of claims 1-5.
CN201810892677.9A 2018-08-07 2018-08-07 Memory recovery method, device, equipment and medium Pending CN110858178A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810892677.9A CN110858178A (en) 2018-08-07 2018-08-07 Memory recovery method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810892677.9A CN110858178A (en) 2018-08-07 2018-08-07 Memory recovery method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN110858178A true CN110858178A (en) 2020-03-03

Family

ID=69634758

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810892677.9A Pending CN110858178A (en) 2018-08-07 2018-08-07 Memory recovery method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN110858178A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113722086A (en) * 2020-05-26 2021-11-30 南宁富桂精密工业有限公司 Application process daemon method, server and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101145128A (en) * 2007-06-13 2008-03-19 中兴通讯股份有限公司 Method for detecting RAM leakage
CN101908018A (en) * 2010-07-20 2010-12-08 北京海泰方圆科技有限公司 System and method for judging memory leak
US20110040938A1 (en) * 2009-08-12 2011-02-17 Samsung Electronics Co., Ltd. Electronic apparatus and method of controlling the same
CN104182320A (en) * 2013-05-23 2014-12-03 联想(北京)有限公司 Method and device for monitoring leakage of memory
CN105446814A (en) * 2014-09-30 2016-03-30 青岛海信移动通信技术股份有限公司 Cache recovery method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101145128A (en) * 2007-06-13 2008-03-19 中兴通讯股份有限公司 Method for detecting RAM leakage
US20110040938A1 (en) * 2009-08-12 2011-02-17 Samsung Electronics Co., Ltd. Electronic apparatus and method of controlling the same
CN101908018A (en) * 2010-07-20 2010-12-08 北京海泰方圆科技有限公司 System and method for judging memory leak
CN104182320A (en) * 2013-05-23 2014-12-03 联想(北京)有限公司 Method and device for monitoring leakage of memory
CN105446814A (en) * 2014-09-30 2016-03-30 青岛海信移动通信技术股份有限公司 Cache recovery method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113722086A (en) * 2020-05-26 2021-11-30 南宁富桂精密工业有限公司 Application process daemon method, server and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN106547574A (en) The outside download system and method for a kind of DSP programs and FPGA programs
CN105528225A (en) Application loading method and loading apparatus
CN106547653B (en) Computer system fault state detection method, device and system
CN105607937B (en) A kind of hot patch method and apparatus
CN104615471A (en) System upgrading method and device for terminal
CN110858178A (en) Memory recovery method, device, equipment and medium
US7996658B2 (en) Processor system and method for monitoring performance of a selected task among a plurality of tasks
CN107506293B (en) Software performance data acquisition method and device
CN110473585B (en) Replacement method, device and equipment for erasing failed storage unit and storage medium
CN112015587B (en) Method and device for enhancing reliability of operating system
CN107357682A (en) A kind of method and device for recovering to go back original system
CN102073571A (en) Method for measuring service life of storage device and data storage system
CN116795718A (en) eBPF-based Linux system memory leak detection method and system
CN116991641A (en) FIO-based compatibility testing method and device, electronic equipment and storage medium
CN107957878B (en) Embedded equipment software online upgrading method based on storage resource redistribution
CN113127314A (en) Method and device for detecting program performance bottleneck and computer equipment
CN116225317A (en) Data read-write method and device for user identification card, user identification card and medium
CN113568581A (en) Multi-application resource recovery method and system for embedded equipment
CN104678292A (en) Test method and device for CPLD (Complex Programmable Logic Device)
CN106293620B (en) The method of parameter in intel detection of platform Flash Rom
CN104111873B (en) Memory release method and system
CN113759790A (en) System optimization method and device for unmanned equipment
CN114371954A (en) Automatic recovery method of micro-service system
US20160275011A1 (en) Microcomputer with built-in flash memory, method for writing data to built-in flash memory of microcomputer, and program for writing data to flash memory
US9934035B2 (en) Device and method for tracing updated predicate values

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200303