CN116483575A - Memory management method, memory management device, electronic equipment and readable storage medium - Google Patents

Memory management method, memory management device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN116483575A
CN116483575A CN202310476995.8A CN202310476995A CN116483575A CN 116483575 A CN116483575 A CN 116483575A CN 202310476995 A CN202310476995 A CN 202310476995A CN 116483575 A CN116483575 A CN 116483575A
Authority
CN
China
Prior art keywords
components
memory
component
reclamation
priorities
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
CN202310476995.8A
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.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication 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 Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202310476995.8A priority Critical patent/CN116483575A/en
Publication of CN116483575A publication Critical patent/CN116483575A/en
Pending legal-status Critical Current

Links

Classifications

    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a memory management method, a memory management device, electronic equipment and a readable storage medium, and belongs to the technical field of communication. The method comprises the following steps: according to the attribute related information of the N components, N recycling priorities corresponding to the N components one by one are determined; and executing memory reclamation processing on M components in the N components according to the N reclamation priorities, wherein N, M is a positive integer, and M is smaller than or equal to N.

Description

Memory management method, memory management device, electronic equipment and readable storage medium
Technical Field
The application belongs to the technical field of communication, and particularly relates to a memory management method, a memory management device, electronic equipment and a readable storage medium.
Background
At present, a large number of applications are installed on the device, and the applications have high requirements on the quantity of memory requirements and the allocation speed, for example, when many applications are started or pages are switched, more memory is required to be allocated in a short time, so that the memory of the electronic device is insufficient. As such, the operation performance of the electronic device is poor.
Disclosure of Invention
An object of the embodiments of the present application is to provide a memory management method, a memory management device, an electronic device, and a readable storage medium, which can improve the operation performance of the electronic device.
In a first aspect, an embodiment of the present application provides a memory management method, where the method includes: according to the attribute related information of the N components, N recycling priorities corresponding to the N components one by one are determined, and the attribute related information of the components is used for representing the importance degree of the components; and executing memory reclamation processing on M components in the N components according to the N reclamation priorities, wherein N, M is a positive integer, and M is smaller than or equal to N.
In a second aspect, an embodiment of the present application provides a memory management device, including: the device comprises a determining module and a processing module. The determining module is used for determining N recycling priorities corresponding to the N components one by one according to the attribute related information of the N components, wherein the attribute related information of the components is used for representing the importance degree of the components; the processing module is configured to execute memory reclamation processing on M components in the N components according to the N reclamation priorities determined by the determining module, where N, M is a positive integer, and M is less than or equal to N.
In a third aspect, embodiments of the present application provide an electronic device comprising a processor and a memory storing a program or instructions executable on the processor, which when executed by the processor, implement the steps of the method as described in the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium having stored thereon a program or instructions which when executed by a processor implement the steps of the method according to the first aspect.
In a fifth aspect, embodiments of the present application provide a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and where the processor is configured to execute a program or instructions to implement a method according to the first aspect.
In a sixth aspect, embodiments of the present application provide a computer program product stored in a storage medium, the program product being executable by at least one processor to implement the method according to the first aspect.
In the embodiment of the application, N recycling priorities corresponding to the N components one by one can be determined according to the attribute related information of the N components, where the attribute related information of the components is used for representing the importance degree of the components; and executing memory reclamation processing on M components in the N components according to the N reclamation priorities, wherein N, M is a positive integer, and M is smaller than or equal to N. According to the scheme, N recycling priorities corresponding to the N components one by one can be determined according to the attribute related information of the N components, and memory recycling processing is directly carried out on M components in the N components according to the recycling priorities corresponding to the N components, so that the system memory, such as running memory, of the electronic equipment can be quickly recovered, and the running performance of the electronic equipment can be improved and optimized.
Drawings
FIG. 1 is a schematic diagram of a memory management method according to an embodiment of the present disclosure;
FIG. 2 is a second embodiment of a method for memory management according to the present disclosure;
FIG. 3 is a third embodiment of a method for memory management according to the present disclosure;
FIG. 4 is a diagram illustrating a method of memory management according to an embodiment of the present disclosure;
FIG. 5 is a fifth embodiment of a method of memory management according to the present disclosure;
fig. 6 is a schematic structural diagram of a memory management device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 8 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
Technical solutions in the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application are within the scope of the protection of the present application.
The terms first, second and the like in the description and in the claims, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged, as appropriate, such that embodiments of the present application may be implemented in sequences other than those illustrated or described herein, and that the objects identified by "first," "second," etc. are generally of a type and not limited to the number of objects, e.g., the first object may be one or more. Furthermore, in the description and claims, "and/or" means at least one of the connected objects, and the character "/", generally means that the associated object is an "or" relationship.
The terms or terms related to the memory management method, the device, the electronic equipment and the readable storage medium provided in the embodiments of the present application are explained below.
Memory: here, the running memory, and the program needs to be loaded from the storage to the running memory when running, so that the program can be quickly called by the central processing unit (Central Processing Unit, CPU).
System memory: here, the running memory of the electronic device.
The process comprises the following steps: a process is a basic unit of resource allocation, which is an instance of an application program when it executes. In a device, all Applications (APPs) are carried by a single process. One application includes multiple processes.
And (3) assembly: constitutes the basic unit of progress. A process consists of a number of scattered and interrelated components, different types of components carrying different functions of the process, such as: an activity (activity) component carries application display related content; a service component carries tasks that are not visible to the user.
And (3) memory recovery: when the process is just created and various components are not started, the memory occupation is smaller, after each task of the process is triggered, each component is started to bear different tasks, and the memory occupied by the process is expanded continuously along with the continuous running of the process. Memory recovery refers to recovering the memory of a process to a state just created, and simplifying the components and memory occupation of the process to improve the memory residual amount of the system memory.
Process type: classification based on the running condition of the component in the process may be performed, for example, and may include, but is not limited to: foreground processes, visible (visible) processes, service processes, and background processes.
Foreground process: the process where the Activity component currently interacting with the user is located;
visible progress: the component that does not contain the Activity component that is interacting, but contains a component that is visible to the user;
service process: the Service process processes work or tasks which cannot be seen by a user in the background, such as music playing and background downloading;
background process: the process of processing the background transaction is not perceived by the user, such as updating the version of the application.
The memory management method, the memory management device, the electronic equipment and the readable storage medium provided by the embodiment of the application are described in detail below through specific embodiments and application scenes thereof with reference to the accompanying drawings.
The memory management method, the memory management device, the electronic equipment and the readable storage medium provided by the embodiment of the application can be applied to the scene of recovering the process memory.
In the memory management method provided by the embodiment of the application, the recovery priority of the component can be determined according to the attribute related information of the component; and determining whether to execute memory reclamation processing on the component according to the reclamation priority of the component. Therefore, the memory of the component can be recovered based on the attribute related information of the component in the process, so that the system memory, such as the running memory, of the electronic equipment can be recovered rapidly, and the running performance of the electronic equipment can be improved and optimized.
Furthermore, the memory is recovered by taking the component as a unit, so that the recovery degree of the process memory can be improved while the process is prevented from being checked and killed.
Further, since the memory occupied by the component can be recovered according to the recovery priority of the component, different memory recovery processes can be executed on components with different priorities, and thus the flexibility and diversity of memory recovery can be improved.
Further, before performing memory reclamation processing on the component according to the reclamation priority of the component, snapshot information of the component may be backed up in the memory, and the snapshot information of the component may indicate contents of the component, so that when the memory is sufficient, the component may be reloaded according to the snapshot information of the component. Therefore, the speed of reloading the components can be increased, and the time consumption for reloading the components is reduced. This can increase the start-up speed of the process.
It should be noted that, since the memory occupied by the process is recovered according to the components, the memory occupied by the process can be partially recovered, so that the process can be kept alive, that is, after the memory recovery processing is performed on each component according to the recovery priority corresponding to each component in the process, the process remains alive, that is, is not checked and killed.
It can be seen that the memory management method provided by the embodiment of the application can reduce the recovery time of the memory while ensuring that the process is not checked and killed, improve the recovery efficiency and avoid the conflict between the process keep-alive and application starting experience and the memory recovery.
The execution body of the memory management method provided by the embodiment of the invention can be electronic equipment, including mobile electronic equipment or non-mobile electronic equipment, or can be a functional module or a functional entity which can realize the memory management method in the electronic equipment, and the execution body can be specifically determined according to actual use requirements. The memory management method provided in the embodiment of the present application is described below by taking the electronic device to execute the memory management method as an example.
Fig. 1 is a schematic flow chart of one possible method of a memory management method according to an embodiment of the present application, as shown in fig. 1, where the memory management method according to the embodiment of the present application may include step 101 and step 102.
And 101, the electronic equipment determines N recycling priorities corresponding to the N components one by one according to the attribute related information of the N components.
Wherein N is a positive integer.
Wherein the attribute related information of the component may be used to reflect the importance of survival of the component.
In this embodiment of the present application, determining, by the electronic device, N recycling priorities corresponding to N components one to one according to attribute related information of the N components may be understood as: and the electronic equipment determines the recovery priority corresponding to each component according to the attribute related information of each component in the N components.
For example, the electronic device determines the recycling priority corresponding to the component 1 according to the attribute related information of the component 1; the electronic device determines the recycling priority corresponding to the component 2 according to the attribute related information of the component 2.
In some embodiments of the present application, the electronic device may first obtain attribute related information of N components, and then determine N recycling priorities corresponding to the N components one-to-one according to the attribute related information of the N components.
In the embodiment of the application, the recycling priority corresponding to the component is inversely related to the importance degree of the component. That is, the higher the importance of the component, the lower the corresponding reclamation priority of the component, i.e. the lower the probability that the memory occupied by the component is reclaimed and the reclamation degree.
In some embodiments of the present application, the attribute related information of the component may indicate at least one of:
whether the component is operational;
whether the component is running in the foreground;
An execution period of the component;
whether the component contains a task timing task;
the duration of the component ending the task;
the component type of the component;
the process type of the process to which the component belongs.
In some embodiments of the present application, for an operating component, the component may be operating in the foreground of the electronic device, i.e., in the foreground; or may run in the background of the electronic device, i.e. in the background.
In some embodiments of the present application, component types may include, but are not limited to: an activity component, a service component, a content providing component, etc.
In some embodiments of the present application, process types may include, but are not limited to: foreground processes, service processes, visible processes, and background processes. For descriptions of foreground processes, service processes, visible processes, and background processes, see the relevant descriptions of the noun interpretation section above.
In some embodiments of the present application, the importance of a component that is running > the importance of a component that is not running.
In some embodiments of the present application, the importance of components that run in the foreground of the electronic device > the importance of components that run in the background of the electronic device.
In some embodiments of the present application, the importance of components that include timed tasks or periodic tasks > the importance of components that do not include timed tasks and periodic tasks.
It will be appreciated that the reclamation prioritization may be in terms of the time at which the component task execution is completed if the other conditions of the two components do not differ much.
In some embodiments of the present application, the longer the component finishes a task, the less important the component is.
In some embodiments of the present application, the importance of the active component, the service component, and the content providing component decreases in sequence.
In some embodiments of the present application, the importance of components in the foreground process, the visible process, the service process, and the background process decreases in sequence.
The principle of determining the recycling priority corresponding to the component according to the attribute related information of the component is further described below.
1. Taking the attribute related information of the component as an example of the execution cycle of the component, for example, a service of a resident process may have a requirement of periodic execution, and may periodically run certain logic. The electronic equipment can collect the operation cycle rules of the components, and according to the execution cycle of the components, the priority of the components which are not recycled is increased, namely the recycling priority corresponding to the components is reduced.
2. Taking the attribute related information of the component as an example of the process type of the process to which the component belongs, for example, if the component is a main process of an application and the component includes a user interface (UserInterface, UI) display function, a service component in the main process may affect UI display, so that the priority of not recycling the service in the main process can be improved, that is, the recycling priority corresponding to the components can be reduced.
3. Taking the attribute related information of the component as the component type of the component as an example, for example, the activity is related to display, the timeliness requirement is higher, and the information is not recovered as much as possible; service is a background task, and recovery priority can be lower than activity; the contentprovider may be the lowest of 3.
4. Taking attribute related information of the components as an example, when the execution time of the component ends the task, for example, when other conditions of the two components are not different, the priority ranking can be performed according to the execution time of the component task.
5. Taking attribute related information of the component as an example, if the component contains a timing task, for example, the component contains the timing task, before the timing task is completed, recovery is not performed as much as possible, that is, the recovery priority of the component containing the timing task needs to be adjusted to be high.
In some embodiments of the present application, assuming that the reclamation priorities are ranked by low to high, then: the component with periodical execution requirement < activity < comprising timing task < comprising displaying the service in the activity process < normal service, namely the service except the service with periodical execution requirement and the service in the activity process < contentProvider. The common service and the contentProvider may be ordered according to the time when the task is completed.
In some embodiments of the present application, as shown in fig. 2 in conjunction with fig. 1, in some embodiments of the present application, the above step 101 may be specifically implemented by the following step 101 a.
Step 101a, under the condition that the electronic device meets the memory reclamation triggering condition, determining N reclamation priorities corresponding to the N components one by one according to the attribute related information of the N components.
The memory reclamation triggering condition may include at least one of the following:
the component ends the task;
the memory occupied by the process is larger than or equal to the memory threshold value;
the system memory state changes.
In the embodiment of the present application, the component ending task may also be referred to as: the component times out.
In some embodiments of the present application, different processes may correspond to different memory thresholds, or different processes may correspond to the same memory threshold, which may be specifically determined according to actual use requirements.
In some embodiments of the present application, the electronic device may configure a memory threshold for each process according to an application type of an application to which the process belongs or a process type of the process. And if the memory occupied by the process is greater than or equal to the memory threshold value corresponding to the process, the memory recovery triggering condition is met.
For example, the electronic device may set a memory threshold a for a foreground process, a memory threshold b for a visible process, a memory threshold c for a service process, and a memory threshold d for a background process. Wherein the memory thresholds a, b, c and d decrease in sequence.
In some embodiments of the present application, the system memory state may include: a system memory occupancy state or a system memory remainder state. The system memory occupancy state may be represented by an occupancy amount and an occupancy proportion of the system memory. The system memory remaining state may be represented by a remaining amount or a remaining proportion of the system memory.
In some embodiments of the present application, the change in the state of the system memory may include: the amount of occupied system memory changes or the amount of remaining system memory changes.
In some embodiments of the present application, no matter what memory reclamation triggering conditions are satisfied, the electronic device may determine reclamation priorities corresponding to components of all processes in the system memory; in other words, the N components include all components in the system memory.
It should be noted that, the "system memory" in the embodiments of the present application may be understood as "running memory" or "system running memory".
In some embodiments of the present application, the memory reclamation triggering conditions satisfied by the electronic device are different, and the N components may also be different.
(one), in the case where the component finishes the task, the N components include at least one of: and the component for ending the task and the component associated with the component for ending the task.
It should be noted that two components are associated, and then the two components satisfy at least one of the following: there is information interaction between two components, and there is information interaction between two components and the same component.
For example, if the processing result data of the component 1 is input data of the component 2, the component 1 is associated with the component 2.
For example, if the input data of the component 1 is the processing result data of the component 2 and the input data of the component 3 is the processing result data of the component 2, the component 1 and the component 3 are associated.
Therefore, the electronic equipment can determine the recycling priority corresponding to at least one of the components and the components related to the components after the execution of the task is finished, so that the electronic equipment can timely recycle the memory occupied by at least one of the components and the components related to the task, and the running performance of the electronic equipment can be improved.
(II) in the case that the memory occupied by the process is greater than or equal to the memory threshold, the N components comprise at least one of the following: a component of a process, a component of a process associated with the process.
It should be noted that, two processes are associated, and then the two processes satisfy at least one of the following: information interaction exists between two processes, and information interaction exists between two processes and the same component or the same process.
For example, if the processing result data of the process 1 is input data of the process 2, the process 1 is associated with the process 2.
For example, if the input data of the process 1 is the processing result data of the process 2 and the input data of the process 3 is the processing result data of the process 2, the process 1 and the process 3 are associated.
For example, if the input data of process 1 includes the processing result data of component 0 and the input data of process 3 also includes the processing result data of component 0, then process 1 and process 3 are associated.
In this embodiment of the present application, the electronic device may scan all components of a process to obtain attribute related information of all components of the process when it is determined that a memory occupied by the process is greater than or equal to a memory threshold corresponding to the process, and then determine, according to the attribute related information of each component, a recycling priority corresponding to each component.
For example, the electronic device determines that the memory occupied by the foreground process a is greater than the corresponding memory threshold, and the foreground process a includes 20 components, so that the electronic device may acquire attribute related information of the 20 components, and then determine 20 recycling priorities corresponding to the 20 components one by one according to the attribute related information of the 20 components. So that the electronic device can determine which components of the 20 components occupy memory that can be reclaimed and the extent to which the reclaimed components can be reclaimed based on the 20 reclamation priorities.
In this way, the electronic device may determine, according to the attribute related information of each component of the process, the reclamation priority corresponding to each component of the process, and/or determine, according to the attribute related information of each component of the process associated with the process, the reclamation priority corresponding to each component of the process associated with the process, where the memory occupied by the process is greater than or equal to the memory threshold, so that the electronic device may conveniently restore, in units of components, the memory occupied by one or more processes. Thus, the flexibility of memory occupation of the recovery process can be improved.
(III) in the event of a change in system memory state, the N components may include: all process components in system memory.
In this embodiment of the present application, when the state of the system memory changes, the electronic device may scan, in units of processes, components in all processes in the system memory to obtain attribute related information of the components in all processes, and determine, according to the attribute related information of each of the components, a recycling priority corresponding to each of the components.
For example, assume that the running memory of the electronic device includes 2 processes, namely a foreground process a and a background process b, where the foreground process a includes components 1 and 2, and the background process b includes components 2 and 4. When the system memory state changes, for example, when the system memory state enters a low memory state, the electronic device can determine the recovery priority corresponding to the component 1 according to the attribute related information of the component 1; determining the recovery priority corresponding to the component 2 according to the attribute related information of the component 2; determining the recovery priority corresponding to the component 3 according to the attribute related information of the component 3; and determining the recycling priority corresponding to the component 4 according to the attribute related information of the component 4. Thus 4 reclamation priorities can be obtained.
Therefore, when the state of the system memory changes, the electronic equipment determines the recovery priority corresponding to all components in the system memory, so that the recovery of the system memory can be performed to the greatest extent at one time.
Step 102, the electronic device executes memory reclamation processing on M components in the N components according to the N reclamation priorities.
Wherein M is an integer greater than or equal to 0 and less than or equal to N.
In some embodiments of the present application, the M components may be at least some of the N components. For example, the M components are the components of the N components that correspond to the lowest reclamation priorities.
In some embodiments of the present application, the reclamation priority corresponding to the M components is lower than the reclamation priority corresponding to components other than the M components in the N components.
In some embodiments of the present application, the electronic device may keep the memory occupied by the components other than the M components in the N components unchanged, or the electronic device may not perform the memory reclamation process on the components other than the M components in the N components.
In this embodiment of the present application, according to N recycling priorities, the electronic device performs memory recycling processing on M components among N components, where the purpose is: and the memory occupation of the process where the component is located is reduced, for example, the memory occupied by the process just created is restored, so that the memory residual amount of the system memory is improved.
In the embodiment of the application, the memory is recovered according to the component, so that the process where the component is located can be prevented from being checked and killed, that is, the survival of the process can be ensured while the memory occupation of the process is recovered.
In this embodiment of the present application, the electronic device may execute memory reclamation processing on each component according to the reclamation priority corresponding to each component in the M components.
Specifically, the electronic device may determine a memory reclamation policy corresponding to each component according to the reclamation priority corresponding to each component, and reclaim the memory occupied by each component according to the memory reclamation policy.
For example, the electronic device performs memory reclamation processing on the component 1 according to the reclamation priority of the component 1; and performs memory reclamation processing on the component 2 according to the reclamation priority of the component 2. The memory reclamation processing executed on the component 1 and the component 2 is determined according to the respective corresponding reclamation priorities.
In some embodiments of the present application, the electronic device may perform different memory reclamation processes on components corresponding to different reclamation priorities, and may specifically be determined according to actual use requirements, such as a system memory state.
In some embodiments of the present application, the "memory reclamation process" in step 102 includes at least one of the following:
fourthly, the electronic equipment destroys the assembly from the system memory;
and fifthly, recycling part of the memory occupied by the component by the electronic equipment.
It should be noted that, for each component in the M components, the electronic device may destroy the component from the system memory, or may recycle a portion of the memory occupied by the component. It is to be understood that the electronic apparatus performs the processing shown in (four) or (five) above for each of the above-described M components. The memory recovery processing of the electronic device on different components in the M components can be the same or different, and can be specifically determined according to actual use requirements.
In (IV), destroying the component from the system memory may also be referred to as: all algorithms to remove components from system memory, all algorithms to remove components from system memory. After destroying the component from the system memory, the component is not included in the system memory, and thus the component is deactivated.
In some embodiments of the present application, destroying components from system memory may be understood as: destroying the components from the running memory of the electronic device. Destroying the component means that all contents in the component are released so as to recycle all memories occupied by the component.
In the fifth step, the part of the memory occupied by the electronic device recycling component can be understood as: the electronic device destroys some of the content in the assembly, such as some logic algorithms, to reclaim the memory occupied by the content. For example, unimportant logic algorithms in the destruction component, such as some logic algorithms that are used only to optimize performance.
In the fifth step, the recycling priorities corresponding to the components are different, and the recycling degree or recycling ratio of the electronic device to the memory occupied by the components may be different.
For example, assuming that the M components include 2 components, namely, component 1, component 2 and component 3, respectively, component 1 is a service having a periodic execution requirement, component 2 is a component containing a timing task, and component 2 is a common service; and the components 1-3 are arranged in order of higher recovery priority: assembly 1, assembly 2, assembly 3. Then: the electronic device can recycle 10% of the memory occupied by the component 1, recycle 20% of the memory occupied by the component 2, and recycle 70% of the memory occupied by the component.
It should be noted that (fifth) is to recycle a part of the memory occupied by the component, that is, another part of the memory is not recycled, so that the component still survives.
In some embodiments of the present application, in (v), the electronic device may recycle a java heap (heap) in the component through a Garbage Collector (GC), for example, by adopting an Android native recycling policy, and recycle the memory that has been released in the component through the garbage collector. Alternatively, the electronic device may use a Trim Memory (Trim Memory) to reclaim the unimportant parts of the component; if the application developer employs Android native reclamation policies, the trim memory (onTrimMemory) of the component is rewritten to define which content of the component can be reclaimed.
Therefore, the electronic device can execute recovery of different levels or degrees for different components of the process according to the recovery priority corresponding to the components in the process, such as maintaining the memory occupied by important components as much as possible and recovering the memory occupied by unimportant components, so that the memory occupied by the process can be recovered as much as possible under the condition of ensuring that the process is not destroyed. Therefore, the memory recovery efficiency can be improved, and the keep-alive of the process can be realized.
In some embodiments of the present application, when M is greater than 1, the electronic device may sequentially execute corresponding memory reclamation processing on the M components according to the reclamation priorities corresponding to the M components according to the order of the reclamation priorities from high to low. If the electronic equipment firstly recovers the memory occupied by the component corresponding to the higher recovery priority, and then recovers the memory occupied by the component corresponding to the lower recovery priority; the memory occupied by the unimportant components is recovered first, and then the memory occupied by the important components is recovered.
In some embodiments of the present application, the reclaiming priorities corresponding to the components are different, and the electronic device may perform different memory reclaiming processes on the components according to the reclaiming priorities corresponding to the components.
For example, assuming that the recycling priorities of the component 1, the component 2 and the component are sequentially reduced, the electronic device can destroy the component 1 from the system memory, destroy the unimportant logic in the component 2, and keep the memory occupied by the component 3 unchanged, that is, not destroy any logic in the component 3.
Therefore, for each component in the M components requiring memory reclamation, the electronic device can destroy one component from the system memory or reclaim part of the memory occupied by the component, so that the flexibility of executing memory reclamation processing on the component can be improved.
In some embodiments of the present application, the above step 102 may be specifically implemented by the following steps 102a and 102 b.
Step 102a, the electronic device determines M components from the N components according to the N recycling priorities.
In some embodiments, the electronic device may sort the N components in order of the N reclamation priorities from high to low and select the first M components of the N components. Alternatively, the electronic device may divide the N components into a plurality of groups according to the reclamation priority, and the plurality of groups are ordered from high to low according to the priority, and the components in at least one group of the plurality of groups are regarded as the M components.
Step 102b, the electronic device executes memory reclamation processing on the M components according to the reclamation priorities of the M components.
In some embodiments of the present application, different reclamation priorities correspond to different memory reclamation processes, or different memory reclamation priority ranges correspond to different memory reclamation processes.
For each of the M components, the electronic device may destroy the component from the system memory if the reclamation priority corresponding to the component is greater than or equal to the first reclamation priority threshold.
If the reclaiming priority corresponding to a component is smaller than the first reclaiming priority threshold, the electronic device can reclaim part of the memory occupied by the component. Further, if the reclaiming priority corresponding to the component is greater than or equal to the second reclaiming priority threshold, the electronic device may reclaim 90% of the memory occupied by the component; if the reclaiming priority corresponding to the component is smaller than the second reclaiming priority threshold and is larger than or equal to the third reclaiming priority threshold, the electronic equipment can reclaim 70% of the memory occupied by the component; if the reclaiming priority corresponding to the component is smaller than the third reclaiming priority threshold and is greater than or equal to the third reclaiming priority threshold, the electronic device can reclaim 60% of the memory occupied by the component.
Wherein the first reclamation priority threshold > the second reclamation priority threshold > the third reclamation priority threshold.
It should be noted that the number of the reclaiming priority thresholds is merely illustrative, and more or fewer reclaiming priority thresholds may be used in actual implementation to reclaim the memory occupied by the component.
Illustratively, assume that reclamation priority range 1 corresponds to destroying a component from memory and reclamation priority range 2 corresponds to a portion of memory occupied by the reclamation component.
Further, the recycling priority range 2 includes a plurality of recycling priority sub-ranges, each recycling priority sub-range corresponding to one recycling ratio.
In fig. 3, an example is shown in which step 102a and step 102b are performed after step 101, and in a practical implementation, step 102a and step 102b may be performed after step 101 a.
Therefore, the electronic equipment can determine M components from N components according to the recovery priorities corresponding to the N components, and then recover the memory occupied by the M components according to the recovery priorities corresponding to the components in the M components, so that the accuracy of memory recovery can be improved.
In some embodiments of the present application, in conjunction with fig. 1, as shown in fig. 4, the step 102 may be specifically implemented by the following step 102 c.
Step 102c, the electronic device executes memory reclamation processing on M components in the N components according to the system memory state and the N reclamation priorities.
It should be noted that, the M components are determined by the electronic device from the N components according to the system memory state and the at least one reclamation priority. And what memory reclamation processing is performed by the electronic device on the M components is also related to the system memory state and the reclamation priority of the components.
In some embodiments of the present application, the smaller the system memory remaining amount indicated by the system memory status, the greater the number of M components determined by the electronic device from the N components; and the higher the recovery degree or recovery ratio of the electronic equipment to the memory occupied by the M components.
For example, assuming that the N components are 10 components, and recovery priorities corresponding to the 10 components are sequentially reduced, then:
(1) If the system memory status indicates that the remaining amount of the system memory is greater than the first low memory threshold, for example, 50%, the remaining memory of the system is sufficient, so that the electronic device may perform a partial reclamation process on the component with the highest priority, for example, destroy unimportant logic in the components, and keep the memory occupied by the components with other reclamation priorities unchanged.
(2) If the system memory status indicates that the remaining amount of the system memory is less than or equal to the first low memory threshold and greater than the second low memory threshold, for example, 30%, the remaining amount of the system memory may be insufficient, so that the electronic device may destroy 10 components with highest recovery priority from the system memory, keep the memory occupied by the component with lowest recovery priority unchanged, and destroy unimportant logic in other components.
(3) If the system memory status indicates that the remaining amount of the system memory is less than or equal to the second low memory threshold and greater than the third low memory threshold, for example, 20%, the remaining amount of the system memory is insufficient, so that the electronic device can destroy 10 components with highest priority and next highest priority from the system memory, keep the memory occupied by the component with the lowest recovery priority unchanged, and destroy unimportant logic in other components.
(4) If the system memory indicates that the system memory remaining amount is less than or equal to the third low memory threshold and greater than the fourth low memory threshold, for example, 5%, the system memory remaining amount is seriously insufficient, so that the electronic device can destroy other components except the component with the lowest priority from the 10 components in the system memory and destroy unimportant logic in the component with the lowest priority.
(5) If the system memory indicates that the remaining amount of the system memory is less than or equal to the fourth low memory threshold, the electronic device is indicated to be blocked, so that the electronic device can destroy 10 components from the system memory. And the memory occupied by all the components is completely recovered.
It can be seen that the first low memory threshold, the second low memory threshold, the third low memory threshold, and the fourth low memory threshold decrease in sequence.
The number of low memory thresholds in the above examples is for illustration only, and more or fewer low memory thresholds may be used in actual implementations to achieve reclamation of component-occupied memory.
For other descriptions of step 102c, refer to the descriptions of step 102a and step 102b in the above embodiments, and in order to avoid repetition, the descriptions are omitted here.
Therefore, the memory recycling processing can be executed on M components in N components according to the system memory state and N recycling priorities, namely, the electronic equipment can determine whether the memory occupied by the components in the process is required to be recycled and the recycling degree according to the tension degree of the system memory, so that the surplus of the system memory can be ensured to meet the normal use of the subsequent program, and the keep-alive of the process can be ensured to the greatest extent. Therefore, the problems of process keep-alive and conflict between application starting experience and memory recovery can be solved.
In the above embodiment, step 102c is performed after step 101 as an example, and in practical implementation, step 102c may be performed after step 101 a.
Therefore, N recycling priorities corresponding to N components one by one can be determined according to the attribute related information of the N components, and memory recycling processing is directly carried out on M components in the N components according to the recycling priorities corresponding to the N components, so that time consumption of memory recycling can be reduced, and memory recycling efficiency is improved.
In some embodiments of the present application, as shown in fig. 5 in conjunction with fig. 1, before step 102, the memory management method provided in the embodiments of the present application may further include step 103 described below, and after step 102, the memory management method provided in the embodiments of the present application may further include step 104 described below.
Step 103, the electronic device backs up snapshot information of the M components.
Wherein the snapshot information of the component indicates the content of the component.
It may be appreciated that the snapshot information of the M components backed up by the electronic device may indicate the content of the M components before the electronic device performs the memory reclamation process on the M components.
In some embodiments of the present application, the electronic device may backup snapshot information of M components in system memory.
In some embodiments of the present application, the snapshot information of the component may include, but is not limited to, at least one of: snapshot information of pages of the component, snapshot information of logical algorithms of the component, etc.
It will be appreciated that the snapshot information of the component occupies less memory, on the KB level.
In some embodiments of the present application, the electronic device may associate the snapshot information of the M components with information of the process to which the M components belong, such as an identification of the process, for backup.
Specifically, the electronic device may generate the mapping table from the snapshot information of the M components and the information of the processes to which the M components belong.
It may be appreciated that, after determining M components from the N components, the electronic device may first obtain snapshot information of the M components and then back up the snapshot information of the M components.
It is to be appreciated that snapshot information of a component may also be referred to as an activity record of the component.
Step 104, the electronic device reloads the M components according to the snapshot information of the M components.
In some embodiments of the present application, when the system memory is sufficient, the electronic device may reload M components into the memory according to the snapshot-related information of the M components that have been backed up.
In some embodiments of the present application, the electronic device may backup snapshot information of a component that may be reclaimed in the process, so as to restore the content of the component when the memory is sufficient.
For example, activity Record (activity Record) is kept, which is just a snapshot of the component, with little impact on memory usage, activity Record is on KB level. When the memory is sufficient, the activity is reloaded into the process according to the reserved snapshot information through a system interface such as a start activity (startActivity) interface, so that the time consumption of reloading the component is reduced.
In some embodiments of the present application, the electronic device may further back up recycling priorities corresponding to the M components.
It should be noted that, the electronic device may load M components multiple times, or load M components at a time.
For example, the electronic device may reload the M components sequentially according to the recycling priorities corresponding to the M components.
For the description of step 101 and step 102, see the relevant description in the above embodiments.
Therefore, the electronic equipment can reload the corresponding components according to the backed-up snapshot information when the memory is sufficient because the snapshot information of the M components can be backed up, so that the time for reloading the components is reduced, and the running performance of the electronic equipment is improved.
According to the memory management method provided by the embodiment of the application, the execution subject can be a memory management device. In the embodiment of the present application, a memory management device is used as an example to execute a memory management method by using a memory management device.
Fig. 6 shows a schematic structural diagram of a memory management device according to an embodiment of the present application, and as shown in fig. 6, the memory management device 500 may include: a determination module 501 and a processing module 502.
The determining module 501 is configured to determine N recycling priorities corresponding to the N components one to one according to attribute related information of the N components;
the processing module 502 is configured to execute memory reclamation processing on M components of the N components according to the N reclamation priorities determined by the determining module 501, where N, M is a positive integer, and M is less than or equal to N.
In some embodiments of the present application, the attribute related information of the component indicates at least one of:
whether the component is operational;
whether the component is running in the foreground;
an execution period of the component;
whether the component contains a timed task;
the duration of the component ending the task;
the component type of the component;
the process type of the process to which the component belongs.
In some embodiments of the present application, the processing module 502 is specifically configured to perform memory reclamation processing on M components of the N components according to a system memory state and the N reclamation priorities.
In some embodiments of the present application, the memory reclamation process may include at least one of:
destroying the components from the system memory;
and recycling part of the memory occupied by the component.
In some embodiments of the present application, the determining module 501 is specifically configured to determine, according to the attribute related information of the N components, N reclamation priorities corresponding to the N components one to one, where a memory reclamation triggering condition is satisfied;
Wherein the memory reclamation triggering condition comprises at least one of the following:
the component ends the task;
the memory occupied by the process is larger than or equal to the memory threshold value;
the system memory state changes.
In some embodiments of the present application, in the event that a component ends a task, the N components include at least one of: a component that ends the task, a component associated with the component that ends the task; or alternatively, the first and second heat exchangers may be,
in the case that the memory occupied by the process is greater than or equal to the memory threshold, the N components include at least one of: the components of the process, the components of the process associated with the process; or alternatively, the first and second heat exchangers may be,
in the case of a change in the system memory state, the N components include: all process components in system memory.
In some embodiments of the present application, the processing module 502 is specifically configured to determine M components from the N components according to the N recycling priorities; and respectively executing memory recycling processing on the M components according to the recycling priority of the M components.
In some embodiments of the present application, the processing module 502 is specifically configured to backup snapshot information of M components of the N components before performing memory reclamation processing on the M components according to the N reclamation priorities, where the snapshot information of the components is used to indicate contents of the components;
The processing module 502 is further configured to reload the M components according to snapshot information of the M components after performing memory reclamation processing on the M components in the N components according to the N reclamation priorities.
Therefore, the N recycling priorities corresponding to the N components one by one can be determined according to the attribute related information of the N components, and the memory recycling processing is directly executed on M components in the N components according to the recycling priorities corresponding to the N components, so that the system memory, such as the running memory, of the electronic equipment can be quickly recovered, and the running performance of the electronic equipment can be improved and optimized.
The memory management device in the embodiments of the present application may be an electronic device, or may be a component in an electronic device, for example, an integrated circuit or a chip. The electronic device may be a terminal, or may be other devices than a terminal. By way of example, the electronic device may be a mobile phone, tablet computer, notebook computer, palm computer, vehicle-mounted electronic device, mobile internet appliance (Mobile Internet Device, MID), augmented reality (augmented reality, AR)/Virtual Reality (VR) device, robot, wearable device, ultra-mobile personal computer, UMPC, netbook or personal digital assistant (personal digital assistant, PDA), etc., but may also be a server, network attached storage (Network Attached Storage, NAS), personal computer (personal computer, PC), television (TV), teller machine or self-service machine, etc., and the embodiments of the present application are not limited in particular.
The memory recovery in the embodiments of the present application may be a device with an operating system. The operating system may be an Android operating system, an ios operating system, or other possible operating systems, which are not specifically limited in the embodiments of the present application.
The memory recovery provided in the embodiments of the present application can implement each process implemented by the embodiments of the methods shown in fig. 1 to 5, and in order to avoid repetition, a detailed description is omitted here.
Optionally, as shown in fig. 7, the embodiment of the present application further provides an electronic device 600, including a processor 601 and a memory 602, where the memory 602 stores a program or an instruction that can be executed on the processor 601, and the program or the instruction implements each step of the above-mentioned memory management method embodiment when executed by the processor 601, and the steps can achieve the same technical effects, so that repetition is avoided, and no further description is given here.
Fig. 8 is a schematic hardware structure of an electronic device implementing an embodiment of the present application.
The electronic device 700 includes, but is not limited to: radio frequency unit 701, network module 702, audio output unit 703, input unit 704, sensor 705, display unit 706, user input unit 707, interface unit 708, memory 709, and processor 710.
Those skilled in the art will appreciate that the electronic device 700 may also include a power source (e.g., a battery) for powering the various components, which may be logically connected to the processor 710 via a power management system so as to perform functions such as managing charge, discharge, and power consumption via the power management system. The electronic device structure shown in fig. 8 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than shown, or may combine certain components, or may be arranged in different components, which are not described in detail herein.
The processor 710 is configured to determine N recycling priorities corresponding to the N components one by one according to attribute related information of the N components;
the processor 710 is configured to execute memory reclamation processing on M components of the N components according to the N reclamation priorities determined by the processor 710, where N, M is a positive integer, and M is less than or equal to N.
In some embodiments of the present application, the attribute related information of the component indicates at least one of:
whether the component is operational;
whether the component is running in the foreground;
an execution period of the component;
whether the component contains a timed task;
the duration of the component ending the task;
The component type of the component;
the process type of the process to which the component belongs.
In some embodiments of the present application, the processor 710 is specifically configured to perform memory reclamation processing on M components of the N components according to a system memory state and the N reclamation priorities.
In some embodiments of the present application, the memory reclamation process may include at least one of:
destroying the components from the system memory;
and recycling part of the memory occupied by the component.
In some embodiments of the present application, the processor 710 is specifically configured to determine, according to the attribute related information of the N components, N reclamation priorities corresponding to the N components one to one, where a memory reclamation triggering condition is satisfied;
wherein the memory reclamation triggering condition comprises at least one of the following:
the component ends the task;
the memory occupied by the process is larger than or equal to the memory threshold value;
the system memory state changes.
In some embodiments of the present application, in the event that a component ends a task, the N components include at least one of: a component that ends the task, a component associated with the component that ends the task; or alternatively, the first and second heat exchangers may be,
in the case that the memory occupied by the process is greater than or equal to the memory threshold, the N components include at least one of: the components of the process, the components of the process associated with the process; or alternatively, the first and second heat exchangers may be,
In the case of a change in the system memory state, the N components include: all process components in system memory.
In some embodiments of the present application, the processor 710 is specifically configured to determine M components from the N components according to the N reclamation priorities; and respectively executing memory recycling processing on the M components according to the recycling priority of the M components.
In some embodiments of the present application, the processor 710 is specifically configured to backup snapshot information of M components of the N components before performing memory reclamation processing on the M components according to the N reclamation priorities, where the snapshot information of the components is used to indicate contents of the components;
the processor 710 is further configured to reload the M components according to snapshot information of the M components after performing memory reclamation processing on the M components of the N components according to the N reclamation priorities.
Therefore, the N recycling priorities corresponding to the N components one by one can be determined according to the attribute related information of the N components, and the memory recycling processing is directly executed on M components in the N components according to the recycling priorities corresponding to the N components, so that the system memory, such as the running memory, of the electronic equipment can be quickly recovered, and the running performance of the electronic equipment can be improved and optimized.
It should be appreciated that in embodiments of the present application, the input unit 704 may include a graphics processor (Graphics Processing Unit, GPU) 7041 and a microphone 7042, with the graphics processor 7041 processing image data of still pictures or video obtained by an image capturing device (e.g., a camera) in a video capturing mode or an image capturing mode. The display unit 706 may include a display panel 7061, and the display panel 7061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 707 includes at least one of a touch panel 7071 and other input devices 7072. The touch panel 7071 is also referred to as a touch screen. The touch panel 7071 may include two parts, a touch detection device and a touch controller. Other input devices 7072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and so forth, which are not described in detail herein.
The memory 709 may be used to store software programs as well as various data. The memory 709 may mainly include a first storage area storing programs or instructions and a second storage area storing data, wherein the first storage area may store an operating system, application programs or instructions (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like. Further, the memory 709 may include volatile memory or nonvolatile memory, or the memory 709 may include both volatile and nonvolatile memory. The nonvolatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable EPROM (EEPROM), or a flash Memory. The volatile memory may be random access memory (Random Access Memory, RAM), static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (ddr SDRAM), enhanced SDRAM (Enhanced SDRAM), synchronous DRAM (SLDRAM), and Direct RAM (DRRAM). Memory 709 in embodiments of the present application includes, but is not limited to, these and any other suitable types of memory.
Processor 710 may include one or more processing units; optionally, processor 710 integrates an application processor that primarily processes operations involving an operating system, user interface, application programs, and the like, and a modem processor that primarily processes wireless communication signals, such as a baseband processor. It will be appreciated that the modem processor described above may not be integrated into the processor 710.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the embodiment of the memory management method, and the same technical effects can be achieved, so that repetition is avoided, and no further description is given here.
Wherein the processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes computer readable storage medium such as computer readable memory ROM, random access memory RAM, magnetic or optical disk, etc.
The embodiment of the application further provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled with the processor, and the processor is used for running a program or an instruction, so as to implement each process of the above memory management method embodiment, and achieve the same technical effect, so that repetition is avoided, and no redundant description is provided here.
It should be understood that the chips referred to in the embodiments of the present application may also be referred to as system-on-chip chips, chip systems, or system-on-chip chips, etc.
The embodiments of the present application provide a computer program product stored in a storage medium, where the program product is executed by at least one processor to implement the respective processes of the embodiments of the memory management method described above, and achieve the same technical effects, and are not repeated herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Furthermore, it should be noted that the scope of the methods and apparatus in the embodiments of the present application is not limited to performing the functions in the order shown or discussed, but may also include performing the functions in a substantially simultaneous manner or in an opposite order depending on the functions involved, e.g., the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solutions of the present application may be embodied essentially or in a part contributing to the prior art in the form of a computer software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the methods described in the embodiments of the present application.
The embodiments of the present application have been described above with reference to the accompanying drawings, but the present application is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those of ordinary skill in the art without departing from the spirit of the present application and the scope of the claims, which are also within the protection of the present application.

Claims (18)

1. A memory management method, the method comprising:
according to the attribute related information of the N components, N recycling priorities corresponding to the N components one by one are determined;
and executing memory reclamation processing on M components in the N components according to the N reclamation priorities, wherein N, M is a positive integer, and M is smaller than or equal to N.
2. The method of claim 1, wherein the attribute related information of the component indicates at least one of:
whether the component is operational;
whether the component is running in the foreground;
an execution period of the component;
whether the component contains a timed task;
the duration of the component ending the task;
the component type of the component;
the process type of the process to which the component belongs.
3. The method of claim 1, wherein performing memory reclamation processing on M components of the N components according to the N reclamation priorities comprises:
and executing memory recycling processing on M components in the N components according to the system memory state and the N recycling priorities.
4. A method according to any one of claims 1 to 3, wherein the memory reclamation process comprises at least one of:
Destroying the components from the system memory;
and recycling part of the memory occupied by the component.
5. The method according to claim 1, wherein determining N recycling priorities corresponding to the N components one to one according to attribute related information of the N components comprises:
under the condition that the memory reclamation triggering condition is met, determining N reclamation priorities corresponding to the N components one by one according to attribute related information of the N components;
wherein the memory reclamation triggering condition comprises at least one of the following:
the component ends the task;
the memory occupied by the process is larger than or equal to the memory threshold value;
the system memory state changes.
6. The method of claim 5, wherein the step of determining the position of the probe is performed,
in the case where a component ends a task, the N components include at least one of: a component that ends the task, a component associated with the component that ends the task; or alternatively, the first and second heat exchangers may be,
in the case that the memory occupied by the process is greater than or equal to the memory threshold, the N components include at least one of: the components of the process, the components of the process associated with the process; or alternatively, the first and second heat exchangers may be,
in the case of a change in the system memory state, the N components include: all process components in system memory.
7. The method of claim 1, wherein the step of determining the position of the substrate comprises,
and executing memory reclamation processing on M components in the N components according to the N reclamation priorities, wherein the memory reclamation processing comprises the following steps:
determining M components from the N components according to the N recycling priorities;
and respectively executing memory recycling processing on the M components according to the recycling priorities of the M components.
8. The method of claim 1, wherein before performing memory reclamation processing on M components of the N components according to the N reclamation priorities, the method further comprises:
backing up snapshot information of the M components, wherein the snapshot information of the components is used for indicating contents of the components;
after performing memory reclamation processing on M components of the N components according to the N reclamation priorities, the method further includes:
and reloading the M components according to the snapshot information of the M components.
9. A memory management device, the device comprising: a determining module and a processing module;
the determining module is used for determining N recycling priorities corresponding to the N components one by one according to the attribute related information of the N components;
The processing module is configured to execute memory reclamation processing on M components in the N components according to the N reclamation priorities determined by the determining module, where N, M is a positive integer, and M is less than or equal to N.
10. The apparatus of claim 9, wherein the attribute related information of the component indicates at least one of:
whether the component is operational;
whether the component is running in the foreground;
an execution period of the component;
whether the component contains a timed task;
the duration of the component ending the task;
the component type of the component;
the process type of the process to which the component belongs.
11. The apparatus of claim 9, wherein the processing module is specifically configured to perform memory reclamation processing on M components of the N components according to a system memory state and the N reclamation priorities.
12. The apparatus of any one of claims 9 to 11, wherein the memory reclamation process comprises at least one of:
destroying the components from the system memory;
and recycling part of the memory occupied by the component.
13. The apparatus of claim 9, wherein the determining module is specifically configured to determine N reclamation priorities corresponding to the N components one-to-one according to attribute related information of the N components if a memory reclamation trigger condition is satisfied;
Wherein the memory reclamation triggering condition comprises at least one of the following:
the component ends the task;
the memory occupied by the process is larger than or equal to the memory threshold value;
the system memory state changes.
14. The apparatus of claim 13, wherein in the event that a component ends a task, the N components include at least one of: a component that ends the task, a component associated with the component that ends the task; or alternatively, the first and second heat exchangers may be,
in the case that the memory occupied by the process is greater than or equal to the memory threshold, the N components include at least one of: the components of the process, the components of the process associated with the process; or alternatively, the first and second heat exchangers may be,
in the case of a change in the system memory state, the N components include: all process components in system memory.
15. The apparatus according to claim 9, wherein the processing module is configured to determine M components from the N components according to the N reclamation priorities; and respectively executing memory recycling processing on the M components according to the recycling priority of the M components.
16. The apparatus of claim 9, wherein the processing module is specifically configured to backup snapshot information of M components of the N components before performing memory reclamation processing on the M components according to the N reclamation priorities, where the snapshot information of the components is used to indicate contents of the components;
The processing module is further configured to reload the M components according to snapshot information of the M components after performing memory reclamation processing on the M components in the N components according to the N reclamation priorities.
17. An electronic device comprising a processor and a memory storing a program or instructions executable on the processor, which when executed by the processor, implement the steps of the memory management method of any one of claims 1 to 8.
18. A readable storage medium, wherein a program or instructions is stored on the readable storage medium, which when executed by a processor, implements the steps of the memory management method according to any one of claims 1 to 8.
CN202310476995.8A 2023-04-27 2023-04-27 Memory management method, memory management device, electronic equipment and readable storage medium Pending CN116483575A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310476995.8A CN116483575A (en) 2023-04-27 2023-04-27 Memory management method, memory management device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310476995.8A CN116483575A (en) 2023-04-27 2023-04-27 Memory management method, memory management device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN116483575A true CN116483575A (en) 2023-07-25

Family

ID=87219210

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310476995.8A Pending CN116483575A (en) 2023-04-27 2023-04-27 Memory management method, memory management device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN116483575A (en)

Similar Documents

Publication Publication Date Title
EP3388946B1 (en) Memory collection method and device
JP6138774B2 (en) Computer-implemented method and computer system
MXPA06013666A (en) Method, software and apparatus for using application state history information when re-launching applications.
CN107665098B (en) Information processing method, storage device, and computer storage medium
CN103635876A (en) Memory management model and interface for unmodified applications
CN115509953A (en) Memory recovery method and device
US20060053260A1 (en) Computing system with memory mirroring and snapshot reliability
US20060161598A1 (en) Method and apparatus for data versioning and recovery using delta content save and restore management
CN107689892B (en) Coexistence attack defense method
CN117170872A (en) Memory management method, device, equipment and storage medium
CN116483575A (en) Memory management method, memory management device, electronic equipment and readable storage medium
US8209443B2 (en) System and method for identifying lost/stale hardware in a computing system
CN113032290B (en) Flash memory configuration method, flash memory configuration device, electronic equipment and storage medium
CN114385368A (en) Method and device for flashing pre-written log
KR102563648B1 (en) Multi-processor system and method of operating the same
CN113687942A (en) Detection method and device and electronic equipment
CN116954924A (en) Memory management method and device and electronic equipment
CN117271383A (en) Memory recycling management method and device, electronic equipment and readable storage medium
CN112306668A (en) Object recovery event monitoring method and device and computer readable storage medium
CN112000471B (en) Memory optimization method and device
CN116755884A (en) Memory management method, device, electronic equipment and storage medium
US20220050754A1 (en) Method to optimize restore based on data protection workload prediction
CN116756056A (en) Memory recycling method and device, electronic equipment and storage medium
JP2009223713A (en) Memory content restoration device, memory content restoration method, and memory content restoration program
CN116431338A (en) Memory optimization method, memory manager, electronic device and storage medium

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