[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

WO2021036993A1 - 内存回收方法及装置 - Google Patents

内存回收方法及装置 Download PDF

Info

Publication number
WO2021036993A1
WO2021036993A1 PCT/CN2020/110827 CN2020110827W WO2021036993A1 WO 2021036993 A1 WO2021036993 A1 WO 2021036993A1 CN 2020110827 W CN2020110827 W CN 2020110827W WO 2021036993 A1 WO2021036993 A1 WO 2021036993A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
application
group
waterline
group information
Prior art date
Application number
PCT/CN2020/110827
Other languages
English (en)
French (fr)
Inventor
易见
李昌龙
李家欣
周未来
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021036993A1 publication Critical patent/WO2021036993A1/zh

Links

Images

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/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
    • 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]
    • 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

Definitions

  • This application relates to the field of information technology, and in particular to a method and device for recovering memory.
  • the memory recovery strategy is mainly based on the memory waterline design.
  • the system memory occupancy information is monitored through the kernel process.
  • the memory recovery mechanism is triggered. For example, according to the priority level, the file page and anonymous page of the APP with the lowest priority are recovered from the memory, and written back to the storage device or data compression is performed.
  • the existing memory reclamation strategy sometimes fails to meet actual needs.
  • the present application provides a memory recovery method and device, which improves the flexibility of memory recovery, and can avoid the problems of excessive memory recovery and insufficient recovery.
  • this application provides a memory recovery method, including:
  • the application whose memory is to be recycled is determined from the applications currently running on the terminal device, and the memory waterline of the application is transferred to the kernel space , For the kernel to perform memory recycling according to the memory waterline of the application.
  • the memory waterline of the application is obtained from multiple sets of pre-stored memory waterlines, according to the memory waterline and system memory of the application
  • the occupancy information determines that the memory reclaim condition is met
  • the application that will be reclaimed is determined from the applications currently running on the terminal device, and the memory waterline of the application is transferred to the kernel space for the kernel to execute according to the memory waterline of the application Memory reclamation. Therefore, for applications with different memory requirements, memory recycling can be performed according to different memory pipelines, so that the problems of over-recycling and under-recycling of memory can be avoided, and the keep-alive rate of the application can also be improved.
  • the obtaining the memory waterline of the application from multiple sets of pre-stored memory waterlines includes:
  • the first group information includes the mapping relationship between the application in the group and the memory waterline
  • the target group to which the application belongs according to the memory requirement of the application and the second group information, where the second group information includes the mapping relationship between the memory requirement range of the group and the memory waterline;
  • the first group information and the second group information are pre-stored.
  • the determining the target group to which the application belongs based on the memory requirement of the application and pre-stored second group information includes:
  • the group is determined as the target group.
  • the method further includes:
  • the memory requirement is the memory required at startup; or, the memory requirement is the sum of the memory required at startup and the memory that is expected to grow during the use phase;
  • the memory requirement of the APP is considered to be the sum of the memory required at startup and the increased memory during the expected use phase during memory recycling, which can further improve the accuracy of memory recycling.
  • the obtaining the first group information according to the predicted memory requirements of each application includes:
  • All applications corresponding to a set of memory waterlines are elements in a group, and a group includes at least one Application to obtain the first group information.
  • the obtaining the second group information according to the predicted memory requirements of each application includes:
  • all applications are divided into groups to obtain multiple groups.
  • One set of memory waterlines corresponds to one group, and applications within the range of memory requirements belong to the same Group to obtain the second group information.
  • the method further includes:
  • the first group information is updated according to the update of the application in the group indicated by the configuration file.
  • the transferring the memory waterline of the application into the kernel space includes:
  • this application provides a memory recovery device, including:
  • the acquiring module is used to monitor the application's memory waterline from multiple sets of pre-stored memory waterlines when it is monitored that an application is started or switched to the foreground interface;
  • the processing module is used to determine the application whose memory will be recovered from the applications currently running on the terminal device when it is determined that the memory recovery condition is satisfied according to the memory waterline of the application and the system memory occupancy information, and to compare the memory level of the application
  • the line is passed into the kernel space for the kernel to perform memory recycling according to the memory waterline of the application.
  • the acquisition module is used to:
  • the first group information includes the mapping relationship between the application in the group and the memory waterline
  • the target group to which the application belongs according to the memory requirement of the application and the second group information, where the second group information includes the mapping relationship between the memory requirement range of the group and the memory waterline;
  • the first group information and the second group information are pre-stored.
  • the acquisition module is used to:
  • the group is determined as the target group.
  • the acquisition module is also used to:
  • the memory requirement is the memory required at startup; or, the memory requirement is the sum of the memory required at startup and the memory that is expected to grow during the use phase;
  • the acquisition module is used to:
  • All applications corresponding to a set of memory waterlines are elements in a group, and a group includes at least one Application to obtain the first group information.
  • the acquisition module is used to:
  • all applications are divided into groups to obtain multiple groups.
  • One set of memory waterlines corresponds to one group, and applications within the range of memory requirements belong to the same Group to obtain the second group information.
  • the processing module is also used to:
  • the first group information is updated according to the update of the application in the group indicated by the configuration file.
  • the processing module is used to:
  • the memory waterline of the application is transferred to the kernel space through the reserved function interface.
  • this application provides a terminal device, including: a memory and a processor;
  • a memory for storing executable instructions of the processor
  • the processor is configured to execute the first aspect and the memory recovery method in any one of the possible designs of the first aspect by executing the executable instruction.
  • the present application provides a readable storage medium in which an execution instruction is stored.
  • the terminal device executes any one of the first aspect and the first aspect.
  • the present application provides a program product.
  • the program product includes an execution instruction, and the execution instruction is stored in a readable storage medium.
  • At least one processor of the terminal device can read the execution instruction from the readable storage medium, and the execution of the execution instruction by the at least one processor causes the terminal device to implement the memory recovery method in the first aspect and any one of the possible designs of the first aspect.
  • the present application provides a chip which is connected to a memory, or a memory is integrated on the chip, and when the software program stored in the memory is executed, any one of the first aspect and the first aspect is implemented.
  • Figure 1 is a schematic diagram of a memory recovery process provided by this application.
  • FIG. 2 is a flowchart of an embodiment of a memory recovery method provided by this application.
  • FIG. 3 is a flowchart of an embodiment of a memory recovery method provided by this application.
  • FIG. 4 is a flowchart of an embodiment of a memory recovery method provided by this application.
  • FIG. 5 is a flowchart of an embodiment of a memory recovery method provided by this application.
  • FIG. 6 is a flowchart of an embodiment of a memory recovery method provided by this application.
  • FIG. 7 is a schematic structural diagram of an embodiment of a memory recovery device provided by this application.
  • FIG. 8 is a schematic structural diagram of a terminal device provided by this application.
  • words such as “exemplary” or “for example” are used to represent examples, illustrations or illustrations, and any embodiment or solution described as “exemplary” or “for example” in the embodiments of this application It should not be construed as being more preferable or advantageous than other embodiments or solutions. To be precise, words such as “exemplary” or “for example” are used to present related concepts in a specific manner.
  • first and second are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance. "At least one” means one or more, and “plurality” means two or more.
  • the memory recovery method of the present application can be used in the memory recovery of terminal equipment.
  • the terminal equipment in the embodiment of the present application can be a wireless terminal or a wired terminal, and the wireless terminal can provide voice and/or other service data connectivity to users.
  • a wireless terminal can communicate with one or more core networks via a radio access network (RAN).
  • the wireless terminal can be a mobile terminal, such as a mobile phone (or called a "cellular" phone) and a computer with a mobile terminal, for example, They are portable, pocket-sized, handheld, computer built-in or vehicle-mounted mobile devices that exchange language and/or data with the wireless access network.
  • Wireless terminal can also be called system, subscriber unit (Subscriber Unit), subscriber station (Subscriber Station), mobile station (Mobile Station), mobile station (Mobile), remote station (Remote Station), remote terminal (Remote Terminal), connection The access terminal (Access Terminal), user terminal (User Terminal), user agent (User Agent), and user equipment (User Device or User Equipment) are not limited here.
  • FIG. 1 is a schematic diagram of a memory recovery process provided by this application. As shown in FIG. 1, this application runs a memory recovery strategy in user mode to determine that the memory is satisfied.
  • the memory waterline corresponding to the currently started application or the application currently switched to the foreground interface is transferred to the kernel space, and the kernel performs memory reclaim according to the memory waterline of the application.
  • the memory waterline of the application is obtained from multiple sets of pre-stored memory waterlines, and the memory waterline of the application and the system memory occupation information are determined
  • the memory recycling condition is met, the application whose memory will be recycled is determined from the applications currently running on the terminal device, and the memory waterline of the application is transferred to the kernel space, and the kernel performs memory recycling according to the memory waterline of the application.
  • memory recycling can be performed according to different memory pipelines, so that the problems of over-recycling and under-recycling of memory can be avoided.
  • memory demand of APP tends to increase with the time of use
  • memory recovery can be further improved
  • the accuracy of the memory recovery method avoids excessive memory recovery and insufficient memory recovery.
  • FIG. 2 is a flowchart of an embodiment of a memory recycling method provided by this application. As shown in FIG. 2, the method in this embodiment may include:
  • the running status of each application in the terminal device system can be monitored in the user mode in real time.
  • the memory waterline of the application can be obtained from multiple sets of pre-stored memory waterlines.
  • the corresponding memory waterline may also be different. It should be noted that the memory waterline in the embodiment of the present application is divided into three water levels: high (High), low (Low), and minimum (Min).
  • the memory waterline of the application is obtained from multiple sets of pre-stored memory waterlines, which may be:
  • the first group information includes the mapping relationship between the applications in the group and the memory waterline, and the memory waterline of the target group is determined as the memory waterline of the application
  • the first group information may also include a group identifier.
  • the currently activated application is APP1
  • the target group to which APP1 belongs is found from the first group information shown in Table 1
  • the memory waterline 1 of group 1 is used as the memory waterline of APP1.
  • Table 1 is only an example, and the group identifier may not be included, and only the mapping relationship between applications and memory waterlines in the group.
  • the first group information can be obtained offline, that is, pre-stored, or obtained online. If the first group information is pre-stored, the first group information can be Obtained by:
  • the first group information is obtained according to the historical memory usage data of each application.
  • the historical memory usage data is the memory required when the application starts, or the historical memory usage data is the memory required when the application starts and the memory required for the preset time period. with.
  • the historical memory usage data is the memory required when the app is started
  • the memory required at the start of each application is counted, that is, the memory occupied when the application is started. It can be run on different terminal devices and count The memory data occupied after each application is run on different terminal devices, and then the first group information is obtained according to all the historical memory usage data.
  • the preset time period can be, for example, half a day, one day, or one week. Because some APP memory requirements tend to increase with the use time Take Honor of Kings as an example. Every game played, the anonymous page size will increase significantly. Therefore, when memory recovery, consider the memory requirement of APP as the sum of the memory required at startup and the memory that is expected to increase during the use phase, which can further improve memory recovery Accuracy.
  • it can be to run each application on different terminal devices, and count the memory required to run each application on different terminal devices when it is started and the memory required to use the preset time period, and the memory required and used when an application is started
  • the sum of the memory required for the preset time period is used as the historical memory usage data to obtain the historical memory usage data of each application, and then the first group information is obtained according to all the historical memory usage data.
  • the first group information may be obtained in the following manner:
  • S101a Predict the memory requirements of each application according to the historical memory usage data of each application, where the memory requirement is the memory required at startup; or, the memory requirement is the sum of the memory required at startup and the memory that is expected to grow during the use phase.
  • the predicted memory demand of each application is the memory required at startup. If the historical memory usage data is the sum of the memory required at startup and the memory required to use the preset time period, correspondingly, the predicted memory demand of each application is the sum of the memory required at startup and the memory that is expected to grow during the use phase.
  • S101b Determine the memory waterline corresponding to each application according to the predicted memory requirements of each application and multiple sets of memory waterlines. All applications corresponding to a set of memory waterlines are elements in a group, and a group includes at least one Application, the mapping relationship between the application in the group and the memory waterline is obtained, which is the first group information.
  • applications with memory requirements within a range may be divided into a group, for example, applications with memory requirements of 0MB-50MB Divide into a group, divide applications with a memory requirement of 50MB to 100MB into a group, divide applications with a memory requirement of 1GB to 2GB into a group, and so on.
  • a group identifier can be set for each group respectively, and the mapping relationship between the group identifier, the application in the group, and the memory waterline is obtained, which is the first group information.
  • the first group information may be updated subsequently according to the group identifier indicated by the configuration file and the application in the group or the update of the application in the group. That is to say, the applications in the group can be changed. For example, after a certain application version is upgraded, the memory requirement changes and the corresponding group also changes. At this time, the application in the group needs to be updated.
  • the memory waterline of the application is obtained from multiple sets of pre-stored memory waterlines, which can be:
  • the target group to which the application belongs is determined according to the memory requirements of the application and the pre-stored second group information.
  • the second group information includes the mapping relationship between the memory requirement range of the group and the memory waterline, and the memory waterline of the target group Determine the memory waterline of the application.
  • the target group to which the application belongs is determined according to the memory requirement of the application and the pre-stored second group information, which may specifically be: if the memory requirement of the application is within the memory requirement range of a group, then the group Determined as the target group.
  • the second group information may also include a group identifier.
  • the second group information is shown in Table 2 below:
  • Group ID Memory requirement range Memory waterline 1 0MB ⁇ 100MB Memory waterline one 2 100MB ⁇ 200MB Memory waterline two 3 1GB ⁇ 1.5GB Memory waterline three ... ... ...
  • the memory requirement of APP3 is 150MB
  • 150MB is within the memory requirement range of group 2 from 100MB to 200MB
  • group 2 is determined as the target group, and the memory waterline of group 2 The second is the memory waterline of APP1.
  • the second group information can be obtained offline, that is, pre-stored, or obtained online. If the second group information is pre-stored, the second group information can be Obtained in the following manner: in the second implementable manner, further, the above method may further include:
  • the second group information is obtained according to the historical memory usage data of each application.
  • the historical memory usage data is the memory required at startup, or the historical memory usage data is the sum of the memory required at startup and the memory required for the preset time period.
  • the historical memory usage data is the memory required when the app is started
  • the memory required at the start of each application is counted, that is, the memory occupied when the application is started. It can be run on different terminal devices and count The memory data occupied after each application is run on different terminal devices, and then the second group information is obtained according to all the historical memory usage data.
  • the preset time period can be, for example, half a day, one day, or one week. Because some APP memory requirements tend to increase with the use time Take Honor of Kings as an example. Every game played, the anonymous page size will increase significantly. Therefore, when memory recovery, consider the memory requirement of APP as the sum of the memory required at startup and the memory that is expected to increase during the use phase, which can further improve memory recovery Accuracy.
  • it can be to run each application on different terminal devices, and count the memory required to run each application on different terminal devices when it is started and the memory required to use the preset time period, and the memory required and used when an application is started
  • the sum of the memory required for the preset time period is used as the historical memory usage data to obtain the historical memory usage data of each application, and then the second group information is obtained according to all the historical memory usage data.
  • the second group information can be obtained according to the following way:
  • S101a' respectively predict the memory requirements of each application according to the historical memory usage data of each application, the memory requirement is the memory required at startup; or, the memory requirement is the sum of the memory required at startup and the memory that is expected to increase during the use phase.
  • the predicted memory demand of each application is the memory required at startup. If the historical memory usage data is the sum of the memory required at startup and the memory required to use the preset time period, correspondingly, the predicted memory demand of each application is the sum of the memory required at startup and the memory that is expected to grow during the use phase.
  • S101b' divides all applications into groups based on the predicted memory requirements of each application and multiple sets of memory waterlines to obtain multiple groups, one set of memory waterlines corresponds to one group, and applications within the range of memory requirements belong to the same Group to obtain the mapping relationship between the memory demand range and the memory waterline, that is, the second group information divides all applications into groups according to the predicted memory demand of each application, and obtains multiple groups, one memory demand range Apps belong to the same group.
  • applications with memory requirements within a range can be divided into a group, for example, applications with memory requirements of 0MB-50MB can be divided As a group, divide the applications with memory requirements of 50MB-100MB into a group, divide the applications with memory requirements of 1GB-2GB into a group, and so on, to obtain the range of memory requirements corresponding to each group,
  • the memory ranges corresponding to the three groups are 0MB ⁇ 50MB, 50MB ⁇ 100MB and 1GB ⁇ 2GB respectively.
  • the memory requirement range corresponding to each group can be obtained, and a set of memory waterline and a group identifier are set for each group to obtain the group identifier, memory requirement range, and memory level.
  • the mapping relationship of the lines is the second group information.
  • the method of this embodiment may further include:
  • the historical memory usage data is the memory occupied when the application is started, or the historical memory usage data is the sum of the memory occupied when the application is started and the memory occupied by the preset time period.
  • the preset time can be set by the user.
  • S104 Predict the memory requirements of each application separately according to the historical memory usage data of each application, where the memory requirement is the memory required at startup; or, the memory requirement is the sum of the memory required at startup and the memory that is expected to grow during the use phase.
  • predicting the memory demand it may be predicted according to a preset rule, for example, taking the average value of the used memory after each application is run, or taking the maximum value.
  • obtaining the first group information according to the predicted memory requirements of each application may be:
  • the first group information may be updated subsequently according to the group identifier indicated by the configuration file and the application in the group or the update of the application in the group. That is to say, the applications in the group can be changed. For example, after a certain application version is upgraded, the memory requirement changes and the corresponding group also changes. At this time, the application in the group needs to be updated.
  • all applications are divided into groups, and multiple groups are obtained.
  • One set of memory waterlines corresponds to one group, and applications within the range of memory requirements belong to the same group , Get the second group information.
  • the memory recovery condition is satisfied.
  • the application that will be reclaimed After determining that the memory recycling condition is met, determine the application that will be reclaimed from the currently running applications of the terminal device. For example, it can be determined from the currently running applications according to the pre-saved priority order of the applications whose memory is reclaimed. The application whose memory is to be reclaimed may also be based on other existing methods, which are not limited in the embodiment of the present application.
  • the system call can be made by passing the memory waterline of the application to the kernel space through the reserved function interface, and the kernel determines the condition of the reclaim termination according to the memory waterline of the application. And perform memory reclamation.
  • the memory recycling method obtaineds the memory waterline of the application from multiple sets of pre-stored memory waterlines by monitoring when an application is started or switched to the foreground interface, and according to the memory waterline and system memory of the application
  • the occupancy information determines that the memory reclaim condition is met
  • the application that will be reclaimed is determined from the applications currently running on the terminal device, and the memory waterline of the application is transferred to the kernel space for the kernel to execute according to the memory waterline of the application Memory reclamation. Therefore, for applications with different memory requirements, memory recycling can be performed according to different memory pipelines, so that the problems of over-recycling and under-recycling of memory can be avoided, and the keep-alive rate of the application can also be improved.
  • FIG. 3 is a flowchart of an embodiment of a memory recycling method provided by this application. As shown in FIG. 3, the method in this embodiment may include:
  • the first group information includes the group identifier, the application in the group, and the memory level.
  • the mapping relationship of the lines determines the memory waterline of the target group as the memory waterline of the application.
  • the currently activated application is APP4, the target group to which APP4 belongs is found from the first group information shown in Table 1, and the memory waterline 2 of group 2 is used as the memory waterline of APP2.
  • the first group information may be obtained according to the process of S101a to S101b in the embodiment shown in FIG. 2 and the first group information is stored.
  • the process of S101a to S101b in the embodiment shown in FIG. 2 please refer to the detailed description of S101a to S101b in the embodiment shown in FIG. 2 , I won’t repeat it here.
  • the first group information may be updated subsequently according to the group identifier indicated by the configuration file and the update of the application in the group.
  • the applications in the group can be changed.
  • S202 Determine whether the memory recovery condition is met according to the memory waterline of the application and the system memory occupancy information, if yes, execute S203, if not, return to execute S201.
  • S203 Determine the application whose memory will be reclaimed from the applications currently running on the terminal device, and pass the memory waterline of the application to the kernel space through the reserved function interface, so that the kernel executes the memory according to the memory waterline of the application. Recycling.
  • FIG. 4 is a flowchart of an embodiment of a memory recycling method provided by this application. As shown in FIG. 4, the method in this embodiment may include:
  • the target group to which the application belongs is determined according to the memory requirement of the application and the pre-stored second group information, the second group information includes the group identifier and the memory requirement
  • the mapping relationship between the range and the memory waterline determines the memory waterline of the target group as the memory waterline of the application.
  • the target group to which the application belongs is determined according to the memory requirement of the application and the pre-stored second group information, which may specifically be: if the memory requirement of the application is within the memory requirement range of a group, then the group Determined as the target group.
  • the currently activated application is APP6. If the memory requirement of APP6 is 1.2GB, and 1.2GB is within the memory requirement range of group 3 from 1GB to 1.5GB, group 3 Determine as the target group, and use the memory waterline 3 of group 3 as the memory waterline of APP6.
  • the second group information may be obtained according to the process of S101a' to S101b' in the embodiment shown in FIG. 2, and the second group information is stored.
  • the process of S101a' to S101b' in the embodiment shown in FIG. 2 please refer to S101a' to S101b in the embodiment shown in FIG. The detailed description will not be repeated here.
  • S302 Determine whether the memory recovery condition is satisfied according to the memory waterline of the application and the system memory occupancy information, if yes, execute S303, if not, return to execute S301.
  • S303 Determine the application whose memory will be reclaimed from the applications currently running on the terminal device, and pass the memory waterline of the application to the kernel space through the reserved function interface, so that the kernel executes the memory according to the memory waterline of the application. Recycling.
  • FIG. 5 is a flowchart of an embodiment of a memory recycling method provided by this application. The difference from FIG. 3 and FIG. 4 is that the first group information in this embodiment is obtained online. As shown in FIG. 5, this embodiment Examples of methods can include:
  • the historical memory usage data is the memory occupied when the application is started, or the historical memory usage data is the sum of the memory occupied when the application is started and the memory occupied by the preset time period.
  • the preset time can be set by the user.
  • S402 Predict the memory requirements of each application separately according to the historical memory usage data of each application.
  • the memory requirement is the memory required at startup; or, the memory requirement is the sum of the memory required at startup and the memory that is expected to grow during the use phase.
  • predicting the memory demand it may be predicted according to a preset rule, for example, taking the average value of the used memory after each application is run, or taking the maximum value.
  • S403 Acquire first group information according to the predicted memory requirements of each application, where the first group information includes a group identifier, a mapping relationship between applications in the group, and a memory waterline.
  • the first group information is obtained according to the predicted memory requirements of each application, specifically:
  • the first group information may be updated subsequently according to the group identifier indicated by the configuration file and the application in the group or the update of the application in the group. That is to say, the applications in the group can be changed. For example, after a certain application version is upgraded, the memory requirement changes and the corresponding group also changes. At this time, the application in the group needs to be updated.
  • S404 When it is monitored that an application is started or switched to the foreground interface, search for the target group to which the application belongs from the first group information, and determine the memory waterline of the target group as the memory waterline of the application.
  • S405 Determine whether the memory recovery condition is met according to the memory waterline of the application and the system memory occupancy information, if yes, execute S403, if not, return to execute S404.
  • S406. Determine the application whose memory will be reclaimed from the applications currently running on the terminal device, and pass the memory waterline of the application to the kernel space through the reserved function interface, so that the kernel executes the memory according to the memory waterline of the application. Recycling.
  • FIG. 6 is a flowchart of an embodiment of a memory recycling method provided by this application. The difference from FIG. 3 and FIG. 4 is that the second group information in this embodiment is obtained online. As shown in FIG. 6, this embodiment Examples of methods can include:
  • the historical memory usage data is the memory occupied when the application is started, or the historical memory usage data is the sum of the memory occupied when the application is started and the memory occupied by the preset time period.
  • the preset time can be set by the user.
  • S502 Predict the memory requirements of each application separately according to the historical memory usage data of each application.
  • the memory requirement is the memory required at startup; or, the memory requirement is the sum of the memory required at startup and the memory that is expected to grow during the use phase.
  • predicting the memory demand it may be predicted according to a preset rule, for example, taking the average value of the used memory after each application is run, or taking the maximum value.
  • S503 Obtain second group information according to the predicted memory requirements of each application, where the second group information includes a group identifier, a memory requirement range, and a mapping relationship between a memory waterline.
  • the second group information is acquired according to the predicted memory requirements of each application, specifically:
  • all applications are divided into groups, and multiple groups are obtained.
  • One set of memory waterlines corresponds to one group, and applications within the range of memory requirements belong to the same group , Get the second group information.
  • S505 Determine whether the memory recovery condition is met according to the memory waterline of the application and the system memory occupancy information, if yes, execute S503, if not, return to execute S504.
  • S506. Determine the application whose memory will be reclaimed from the applications currently running on the terminal device, and pass the memory waterline of the application to the kernel space through the reserved function interface, so that the kernel executes the memory according to the memory waterline of the application. Recycling.
  • FIG. 7 is a schematic structural diagram of an embodiment of a memory recovery device provided by this application.
  • the device of this embodiment may include: an acquisition module 11 and a processing module 12, where the acquisition module 11 is used to monitor When the application is started or switched to the foreground interface, obtain the memory waterline of the application from multiple sets of pre-stored memory waterlines;
  • the processing module 12 is configured to determine the application whose memory is to be recovered from the applications currently running on the terminal device when it is determined that the memory recovery condition is met according to the memory waterline of the application and the system memory occupancy information, and to compare the memory level of the application The line is passed into the kernel space for the kernel to perform memory recycling according to the memory waterline of the application.
  • the acquisition module 11 is used for:
  • the first group information includes the mapping relationship between the application in the group and the memory waterline
  • the target group to which the application belongs according to the memory requirement of the application and the second group information, where the second group information includes the mapping relationship between the memory requirement range of the group and the memory waterline;
  • the first group information and the second group information are pre-stored.
  • the acquisition module 11 is used for:
  • the group is determined as the target group.
  • the acquisition module 11 is also used for:
  • the memory requirement is the memory required at startup; or, the memory requirement is the sum of the memory required at startup and the memory that is expected to grow during the use phase;
  • the acquisition module 11 is used for:
  • All applications corresponding to a set of memory waterlines are elements in a group, and a group includes at least one Application to obtain the first group information.
  • the acquisition module 11 is used for:
  • all applications are divided into groups to obtain multiple groups.
  • One set of memory waterlines corresponds to one group, and applications within the range of memory requirements belong to the same Group to obtain the second group information.
  • processing module 12 is also used for:
  • the first group information is updated according to the update of the application in the group indicated by the configuration file.
  • processing module 12 is used for:
  • the memory waterline of the application is transferred to the kernel space through the reserved function interface.
  • the device of this embodiment can be used to implement the technical solution of the method embodiment shown in FIG. 2, and its implementation principles are similar, and will not be repeated here.
  • the present application may divide the memory recovery device into functional modules according to the foregoing method examples.
  • each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software function modules. It should be noted that the division of modules in the embodiments of the present application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
  • FIG. 8 is a schematic structural diagram of a terminal device provided by this application, and the terminal device 200 includes:
  • the memory 201 is used to store computer programs
  • the processor 202 is configured to execute a computer program stored in the memory to implement the memory recycling method in the foregoing embodiment. For details, refer to the relevant description in the foregoing method embodiment.
  • the memory 201 may be independent or integrated with the processor 202.
  • the terminal device 200 may further include:
  • the bus 203 is used to connect the memory 201 and the processor 202.
  • this embodiment further includes: a communication interface 204, and the communication interface 204 may be connected to the processor 202 through the bus 203.
  • the processor 202 may control the communication interface 203 to implement the aforementioned receiving and sending functions of the terminal device 200.
  • the terminal device may be used to execute various steps and/or procedures corresponding to the terminal device in the foregoing method embodiments.
  • the present application also provides a readable storage medium in which an execution instruction is stored.
  • the terminal device executes the memory recovery method in the foregoing method embodiment.
  • the application also provides a program product, which includes an execution instruction, and the execution instruction is stored in a readable storage medium.
  • At least one processor of the terminal device can read the execution instruction from the readable storage medium, and the execution of the execution instruction by the at least one processor causes the terminal device to implement the memory recovery method in the foregoing method embodiment.
  • the present application also provides a chip, which is connected to a memory, or a memory is integrated on the chip, and when the software program stored in the memory is executed, the memory recovery method in the above method embodiment is implemented.
  • a person of ordinary skill in the art can understand that: in the foregoing embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof.
  • software it can be implemented in the form of a computer program product in whole or in part.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center. Transmission to another website site, computer, server or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.).
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种内存回收方法及装置,该方法包括:监控到有应用被启动或切换到前台界面时,从预存的多套内存水线中获取所述应用的内存水线(S101);根据所述应用的内存水线和系统内存占用信息判定满足内存回收条件时,从终端设备当前正在运行的应用中确定将被回收内存的应用,并将所述应用的内存水线传入内核空间,用于内核根据所述应用的内存水线执行内存回收(S102)。从而,可避免内存过度回收和回收不足的问题,提高应用的保活率。

Description

内存回收方法及装置
本申请要求于2019年08月30日提交中国专利局、申请号为201910812574.1、申请名称为“内存回收方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及信息技术领域,尤其涉及一种内存回收方法及装置。
背景技术
近年来,移动应用(application,APP)对内存的需求量日益增多,呈现逐年增长的趋势,而终端设备的内存容量有限,无法容纳大量应用常驻内存。因此,当内存不足时,系统将进行内存回收。
现有技术中,内存回收策略主要是基于内存水线设计,通过内核进程对系统内存占用信息进行监控,当监控到内存剩余空间低于内存水线中的低(low)水位则触发内存回收机制,例如根据优先级的高低将优先级最低的APP的文件页、匿名页从内存回收,并写回存储器件或进行数据压缩。然而,现有的内存回收策略有时满足不了实际需求。
发明内容
本申请提供一种内存回收方法及装置,提高内存回收的灵活性,可避免内存过度回收和回收不足的问题。
第一方面,本申请提供一种内存回收方法,包括:
监控到有应用被启动或切换到前台界面时,从预存的多套内存水线中获取所述应用的内存水线;
根据所述应用的内存水线和系统内存占用信息判定满足内存回收条件时,从终端设备当前正在运行的应用中确定将被回收内存的应用,并将所述应用的内存水线传入内核空间,用于内核根据所述应用的内存水线执行内存回收。
通过第一方面提供的内存回收方法,监控到有应用被启动或切换到前台界面时,从预存的多套内存水线中获取该应用的内存水线,根据该应用的内存水线和系统内存占用信息判定满足内存回收条件时,从终端设备当前正在运行的应用中确定将被回收内存的应用,并将该应用的内存水线传入内核空间,用于内核根据该应用的内存水线执行内存回收。从而,针对不同内存需求的应用,可根据不同的内存水线进行内存回收,因此可避免内存过度回收和回收不足的问题,还可提高应用的保活率。
在一种可能的设计中,所述从预存的多套内存水线中获取所述应用的内存水线,包括:
从第一群组信息中查找所述应用所属的目标群组,所述第一群组信息包括群组内应用和内存水线的映射关系;
将所述目标群组的内存水线确定为所述应用的内存水线;或者,
根据所述应用的内存需求和第二群组信息确定所述应用所属的目标群组,所述第 二群组信息包括群组内存需求范围和内存水线的映射关系;
将所述目标群组的内存水线确定为所述应用的内存水线。
在一种可能的设计中,所述第一群组信息和所述第二群组信息是预先存储的。
在一种可能的设计中,所述根据所述应用的内存需求和预存的第二群组信息确定所述应用所属的目标群组,包括:
若所述应用的内存需求在一群组的内存需求范围内,则将所述群组确定为所述目标群组。
在一种可能的设计中,所述方法还包括:
获取预设时间内各个应用运行后的历史使用内存数据,所述历史使用内存数据为应用启动时所占内存,或者,所述历史占用内存数据为应用启动时所占内存和使用预设时间段所占内存之和;
根据各个应用的历史使用内存数据分别预测各个应用的内存需求,所述内存需求为启动时所需内存;或者,所述内存需求为启动时所需内存和预期使用阶段增长内存之和;
根据预测的各个应用的内存需求获取所述第一群组信息或所述第二群组信息。
通过该实施方式提供的内存回收方法,在内存回收时考虑APP内存需求为启动时所需内存和预期使用阶段增长内存之和,可进一步提高内存回收的准确性。
在一种可能的设计中,所述根据预测的各个应用的内存需求获取所述第一群组信息,包括:
根据预测的各个应用的内存需求和所述多套内存水线确定各个应用对应的内存水线,与一套内存水线对应的所有应用为一个群组内的元素,一个群组内包括至少一个应用,得到所述第一群组信息。
在一种可能的设计中,所述根据预测的各个应用的内存需求获取所述第二群组信息,包括:
根据预测的各个应用的内存需求和所述多套内存水线将所有应用进行群组划分,得到多个群组,一套内存水线对应一个群组,一个内存需求范围内的应用属于同一个群组,得到所述第二群组信息。
在一种可能的设计中,所述方法还包括:
根据配置文件指示的群组内应用的更新,更新所述第一群组信息。
在一种可能的设计中,所述将所述应用的内存水线传入内核空间,包括:
第二方面,本申请提供一种内存回收装置,包括:
获取模块,用于监控到有应用被启动或切换到前台界面时,从预存的多套内存水线中获取所述应用的内存水线;
处理模块,用于根据所述应用的内存水线和系统内存占用信息判定满足内存回收条件时,从终端设备当前正在运行的应用中确定将被回收内存的应用,并将所述应用的内存水线传入内核空间,用于内核根据所述应用的内存水线执行内存回收。
在一种可能的设计中,所述获取模块用于:
从第一群组信息中查找所述应用所属的目标群组,所述第一群组信息包括群组内应用和内存水线的映射关系;
将所述目标群组的内存水线确定为所述应用的内存水线;或者,
根据所述应用的内存需求和第二群组信息确定所述应用所属的目标群组,所述第二群组信息包括群组内存需求范围和内存水线的映射关系;
将所述目标群组的内存水线确定为所述应用的内存水线。
在一种可能的设计中,所述第一群组信息和所述第二群组信息是预先存储的。
在一种可能的设计中,所述获取模块用于:
若所述应用的内存需求在一群组的内存需求范围内,则将所述群组确定为所述目标群组。
在一种可能的设计中,所述获取模块还用于:
获取预设时间内各个应用运行后的历史使用内存数据,所述历史使用内存数据为应用启动时所占内存,或者,所述历史占用内存数据为应用启动时所占内存和使用预设时间段所占内存之和;
根据各个应用的历史使用内存数据分别预测各个应用的内存需求,所述内存需求为启动时所需内存;或者,所述内存需求为启动时所需内存和预期使用阶段增长内存之和;
根据预测的各个应用的内存需求获取所述第一群组信息或所述第二群组信息。
在一种可能的设计中,所述获取模块用于:
根据预测的各个应用的内存需求和所述多套内存水线确定各个应用对应的内存水线,与一套内存水线对应的所有应用为一个群组内的元素,一个群组内包括至少一个应用,得到所述第一群组信息。
在一种可能的设计中,所述获取模块用于:
根据预测的各个应用的内存需求和所述多套内存水线将所有应用进行群组划分,得到多个群组,一套内存水线对应一个群组,一个内存需求范围内的应用属于同一个群组,得到所述第二群组信息。
在一种可能的设计中,所述处理模块还用于:
根据配置文件指示的群组内应用的更新,更新所述第一群组信息。
在一种可能的设计中,所述处理模块用于:
通过预留的函数接口将所述应用的内存水线传入内核空间。
上述第二方面以及上述第二方面的各可能的设计中所提供的内存回收装置,其有益效果可以参见上述第一方面和第一方面的各可能的实施方式所带来的有益效果,在此不再赘述。
第三方面,本申请提供一种终端设备,包括:存储器和处理器;
处理器;以及
存储器,用于存储所述处理器的可执行指令;
其中,所述处理器配置为经由执行所述可执行指令来执行第一方面及第一方面任一种可能的设计中的内存回收方法。
第四方面,本申请提供一种可读存储介质,可读存储介质中存储有执行指令,当终端设备的至少一个处理器执行该执行指令时,终端设备执行第一方面及第一方面任一种可能的设计中的内存回收方法。
第五方面,本申请提供一种程序产品,该程序产品包括执行指令,该执行指令存储在可读存储介质中。终端设备的至少一个处理器可以从可读存储介质读取该执行指令,至少 一个处理器执行该执行指令使得终端设备实施第一方面及第一方面任一种可能的设计中的内存回收方法。
第六方面,本申请提供一种芯片,所述芯片与存储器相连,或者所述芯片上集成有存储器,当所述存储器中存储的软件程序被执行时,实现第一方面及第一方面任一种可能的设计中的内存回收方法。
附图说明
图1为本申请提供的一种内存回收过程示意图;
图2为本申请提供的一种内存回收方法实施例的流程图;
图3为本申请提供的一种内存回收方法实施例的流程图;
图4为本申请提供的一种内存回收方法实施例的流程图;
图5为本申请提供的一种内存回收方法实施例的流程图;
图6为本申请提供的一种内存回收方法实施例的流程图;
图7为本申请提供的一种内存回收装置实施例的结构示意图;
图8为本申请提供的一种终端设备结构示意图。
具体实施方式
本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明,本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或方案不应被解释为比其它实施例或方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
本申请实施例中,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性。“至少一个”是指一个或者多个,“多个”是指两个或两个以上。
本申请的内存回收方法可用于对终端设备的内存回收中,其中,本申请实施例的终端设备:可以是无线终端或有线终端,无线终端可以是指向用户提供语音和/或其他业务数据连通性的设备,具有无线连接功能的手持式设备、或连接到无线调制解调器的其他处理设备。无线终端可以经无线接入网(RAN)与一个或多个核心网进行通信,无线终端可以是移动终端,如移动电话(或称为“蜂窝”电话)和具有移动终端的计算机,例如,可以是便携式、袖珍式、手持式、计算机内置的或者车载的移动装置,它们与无线接入网交换语言和/或数据。例如,个人通信业务(Personal Communication Service,PCS)电话、无绳电话、会话发起协议(Session Initiation Protocol,SIP)话机、无线本地环路(Wireless Local Loop,WLL)站、个人数字助理(Personal Digital Assistant,PDA)等设备。无线终端也可以称为系统、订户单元(Subscriber Unit)、订户站(Subscriber Station),移动站(Mobile Station)、移动台(Mobile)、远程站(Remote Station)、远程终端(Remote Terminal)、接入终端(Access Terminal)、用户终端(User Terminal)、用户代理(User Agent)、用户设备(User Device or User Equipment),在此不作限定。
相关技术中,通过设置一套内存水线,当监控到内存剩余空间低于内存水线中的低(low)水位则触发内存回收,但是在实际使用过程中,有时会出现一些特殊的应用,例如大型的游戏应用,若还是按照相关技术中的内存回收策略进行内存回收,会出现内存回 收不足或者内存回收过度的情况,不能很好地满足实际需求。为解决这一问题,本申请提供一种内存回收方法,图1为本申请提供的一种内存回收过程示意图,如图1所示,本申请通过在用户态运行内存回收策略,在判定满足内存回收条件时,将当前被启动的应用或当前切换到前台界面的应用对应的内存水线传入内核空间,由内核根据该应用的内存水线执行内存回收。具体地,通过在用户态监控到有应用被启动或切换到前台界面时,从预存的多套内存水线中获取该应用的内存水线,根据该应用的内存水线和系统内存占用信息判定满足内存回收条件时,从终端设备当前正在运行的应用中确定将被回收内存的应用,并将该应用的内存水线传入内核空间,由内核根据该应用的内存水线执行内存回收。从而,针对不同内存需求的应用,可根据不同的内存水线进行内存回收,因此可避免内存过度回收和回收不足的问题。进一步地,由于APP的内存需求随使用时间往往呈递增趋势,本申请实施例中在内存回收时考虑到APP内存需求为启动时所需内存和预期使用阶段增长内存之和,可进一步提高内存回收的准确性,避免内存过度回收和回收不足,下面结合附图详细说明本申请提供的内存回收方法的具体过程。
图2为本申请提供的一种内存回收方法实施例的流程图,如图2所示,本实施例的方法可以包括:
S101、监控到有应用被启动或切换到前台界面时,从预存的多套内存水线中获取所述应用的内存水线。
具体地,可以在用户态实时监控终端设备系统内各个应用的运行状态,在监控到有应用被启动或切换到前台界面时,从预存的多套内存水线中获取该应用的内存水线,不同的应用,由于内存需求的不同,对应的内存水线也可能不同。需要说明的是,本申请实施例中的内存水线分为高(High)、低(Low)、最小(Min)三个水位。
作为第一种可实施的方式,从预存的多套内存水线中获取所述应用的内存水线,可以为:
从第一群组信息中查找该应用所属的目标群组,第一群组信息包括群组内应用和内存水线的映射关系,将目标群组的内存水线确定为该应用的内存水线,可选的,第一群组信息还可以包括群组标识。
示例性地,第一群组信息如下表一所示:
表一
群组标识 群组内应用 内存水线
1 APP1、APP2、APP3 内存水线一
2 APP4、APP5 内存水线二
3 APP6、APP7、APP8、APP9 内存水线三
…… …… ……
例如,当前被启动应用为APP1,从表一所示的第一群组信息中查找到APP1所属的目标群组为群组1,将群组1的内存水线一作为APP1的内存水线。表一仅是示例,也可以不包括群组标识,只有群组内应用和内存水线的映射关系。
在第一种可实施的方式下,其中的第一群组信息可以是离线获取,即预先存储,也可以是在线获取的,若第一群组信息为预先存储的,第一群组信息可通过如下方式获取:
根据各个应用的历史使用内存数据获取第一群组信息,历史使用内存数据为应用启动时所需内存,或者,历史使用内存数据为应用启动时所需内存和使用预设时间段所需内存之和。
具体来说,历史使用内存数据为APP启动时所需内存时,统计各个应用启动时所需的内存,即启动运行时所占的内存,可以是在不同的终端设备上运行各个应用,并统计在不同终端设备上运行各个应用后所占的内存数据,然后根据所有的历史使用内存数据获取第一群组信息。
历史使用内存数据为启动时所需内存和使用预设时间段所需内存之和时,预设时间段例如可以是半天,一天,一个周,由于有的APP内存需求随使用时间往往呈递增趋势,以王者荣耀为例,每打一局游戏,匿名页规模都会明显增加,因此,在内存回收时考虑APP内存需求为启动时所需内存和预期使用阶段增长内存之和,可进一步提高内存回收的准确性。具体地,可以是在不同的终端设备上运行各个应用,并统计在不同终端设备上运行各个应用启动时所需内存和使用预设时间段所需内存,将一个应用启动时所需内存和使用预设时间段所需内存之和作为历史使用内存数据,得到各个应用的历史使用内存数据,然后根据所有的历史使用内存数据获取第一群组信息。
作为一种可实施的方式,可以是根据如下方式获取第一群组信息:
S101a、根据各个应用的历史使用内存数据分别预测各个应用的内存需求,内存需求为启动时所需内存;或者,内存需求为启动时所需内存和预期使用阶段增长内存之和。
若历史使用内存数据为启动时所需内存,则相应的,预测的各个应用的内存需求为启动时所需内存。若历史使用内存数据为启动时所需内存和使用预设时间段所需内存之和,则相应地,预测的各个应用的内存需求为启动时所需内存和预期使用阶段增长内存之和。
S101b、根据预测的各个应用的内存需求和多套内存水线确定各个应用对应的内存水线,与一套内存水线对应的所有应用为一个群组内的元素,一个群组内包括至少一个应用,得到群组内应用和内存水线的映射关系,即为第一群组信息。
示例性地,可以是根据多套内存水线对所有应用在进行群组划分时,例如可将内存需求在一个范围内的应用划分为一个群组,例如可将内存需求为0MB~50MB的应用划分为一个群组,将内存需求为50MB~100MB的应用划分为一个群组,将内存需求为1GB~2GB的应用划分为一个群组,等等。
可选的,群组划分完成后,可以为每个群组分别设置一个群组标识,得到群组标识、群组内应用和内存水线的映射关系,即为第一群组信息。
在将获得的第一群组信息存储后,进一步地,后续还可以根据配置文件指示的群组标识和群组内应用或者群组内应用的更新,更新第一群组信息。也就是说群组内的应用是可以变化的,例如某一应用版本升级后内存需求发生变化,对应所属的群组也发生变化,此时需要更新群组内应用。
作为第二种可实施的方式,从预存的多套内存水线中获取该应用的内存水线,可以为:
根据该应用的内存需求和预存的第二群组信息确定该应用所属的目标群组,第二群组信息包括群组内存需求范围和内存水线的映射关系,将目标群组的内存水线确定为该应用的内存水线。
其中,根据该应用的内存需求和预存的第二群组信息确定该应用所属的目标群组,具体可以是:若该应用的内存需求在一群组的内存需求范围内,则将该群组确定为目标群组。
可选的,第二群组信息还可以包括群组标识,示例性地,第二群组信息如下表二所示:
表二
群组标识 内存需求范围 内存水线
1 0MB~100MB 内存水线一
2 100MB~200MB 内存水线二
3 1GB~1.5GB 内存水线三
…… …… ……
例如,当前被启动应用为APP3,若APP3的内存需求为150MB,150MB在群组2的内存需求范围100MB~200MB内,将群组2确定为目标群组,并将群组2的内存水线二作为APP1的内存水线。
在第二种可实施的方式下,其中的第二群组信息可以是离线获取,即预先存储,也可以是在线获取的,若第二群组信息为预先存储的,第二群组信息可通过如下方式获取:在第二种可实施的方式下,进一步地,上述方法还可以包括:
根据各个应用的历史使用内存数据获取第二群组信息,历史使用内存数据为启动时所需内存,或者,历史使用内存数据为启动时所需内存和使用预设时间段所需内存之和。
具体来说,历史使用内存数据为APP启动时所需内存时,统计各个应用启动时所需的内存,即启动运行时所占的内存,可以是在不同的终端设备上运行各个应用,并统计在不同终端设备上运行各个应用后所占的内存数据,然后根据所有的历史使用内存数据获取第二群组信息。
历史使用内存数据为启动时所需内存和使用预设时间段所需内存之和时,预设时间段例如可以是半天,一天,一个周,由于有的APP内存需求随使用时间往往呈递增趋势,以王者荣耀为例,每打一局游戏,匿名页规模都会明显增加,因此,在内存回收时考虑APP内存需求为启动时所需内存和预期使用阶段增长内存之和,可进一步提高内存回收的准确性。具体地,可以是在不同的终端设备上运行各个应用,并统计在不同终端设备上运行各个应用启动时所需内存和使用预设时间段所需内存,将一个应用启动时所需内存和使用预设时间段所需内存之和作为历史使用内存数据,得到各个应用的历史使用内存数据,然后根据所有的历史使用内存数据获取第二群组信息。
作为一种可实施的方式,可以是根据如下方式获取第二群组信息:
S101a’、根据各个应用的历史使用内存数据分别预测各个应用的内存需求,内存需求为启动时所需内存;或者,内存需求为启动时所需内存和预期使用阶段增长内存之和。
若历史使用内存数据为启动时所需内存,则相应的,预测的各个应用的内存需求为启动时所需内存。若历史使用内存数据为启动时所需内存和使用预设时间段所需内存之和,则相应地,预测的各个应用的内存需求为启动时所需内存和预期使用阶段增长内存之和。
S101b’根据预测的各个应用的内存需求和多套内存水线将所有应用进行群组划分,得到多个群组,一套内存水线对应一个群组,一个内存需求范围内的应用属于同一个群组,得到内存需求范围和内存水线的映射关系,即为第二群组信息根据预测的各个应用的内存需求将所有应用进行群组划分,得到多个群组,一个内存需求范围内的应用属于同一个群组。
示例性地,可以是根据多套内存水线对所有应用在进行群组划分时,可将内存需求在一个范围内的应用划分为一个群组,例如可将内存需求为0MB~50MB的应用划分为一个群组,将内存需求为50MB~100MB的应用划分为一个群组,将内存需求为1GB~2GB的应用划分为一个群组,等等,可获得每个群组对应的内存需求范围,如三个群组对应的内存范围分别是0MB~50MB、50MB~100MB和1GB~2GB。
具体地,群组划分完成后,可以得到每个群组对应的内存需求范围,为每个群组分别设置一套内存水线和一个群组标识,得到群组标识、内存需求范围和内存水线的映射关系,即为第二群组信息。
在第一种可实施的方式和第二种可实施的方式下,若第一群组信息为在线获取的,在S101之前,本实施例的方法还可以包括:
S103、获取预设时间内各个应用运行后的历史使用内存数据。
其中,历史使用内存数据为应用启动时所占内存,或者,历史占用内存数据为应用启动时所占内存和使用预设时间段所占内存之和。
具体地,可以是用户拿到终端设备之后,运行终端设备上的各个应用,由系统获取各个应用运行后的历史使用内存数据,预设时间可以根据用户自己设定。
S104、根据各个应用的历史使用内存数据分别预测各个应用的内存需求,内存需求为启动时所需内存;或者,内存需求为启动时所需内存和预期使用阶段增长内存之和。
具体地,在预测内存需求时,可以是根据预设的规则预测,例如取每次应用运行后的使用内存的平均值,或者取最大值等。
S105、根据预测的各个应用的内存需求获取第一群组信息或第二群组信息。
具体地,根据预测的各个应用的内存需求获取第一群组信息,可以为:
根据预测的各个应用的内存需求和多套内存水线确定各个应用对应的内存水线,与一套内存水线对应的所有应用为一个群组内的元素,一个群组内包括至少一个应用,得到第一群组信息。
在将获得的第一群组信息存储后,进一步地,后续还可以根据配置文件指示的群组标识和群组内应用或者群组内应用的更新,更新第一群组信息。也就是说群组内的应用是可以变化的,例如某一应用版本升级后内存需求发生变化,对应所属的群组也发生变化,此时需要更新群组内应用。
根据预测的各个应用的内存需求获取第二群组信息,可以为:
根据预测的各个应用的内存需求和多套内存水线将所有应用进行群组划分,得到多个群组,一套内存水线对应一个群组,一个内存需求范围内的应用属于同一个群组,得到第二群组信息。
通过上述在线获取的方式获取第一群组信息或第二群组信息时,由于是根据用户的使用习惯来获取和更新群组内应用与内存水线的映射关系的,因此准确性更高。
S102、根据该应用的内存水线和系统内存占用信息判定满足内存回收条件时,从终端设备当前正在运行的应用中确定将被回收内存的应用,并将该应用的内存水线传入内核空间,用于内核根据该应用的内存水线执行内存回收。
具体地,例如,若系统内存剩余空间低于目标群组的内存水线中的低水位,则判定满足内存回收条件。
判定满足内存回收条件后,从终端设备当前正在运行的应用中确定将被回收内存的应用,例如可以是根据预先保存的被回收内存的应用的优先级顺序,来从当前正在运行的应用中确定将被回收内存的应用,还可以是根据现有的其它方式,本申请实施例对此不作限制。确定了将被回收内存的应用后,进行系统调用,可以是通过预留的函数接口将该应用的内存水线传入内核空间,由内核根据该应用的内存水线来确定回收终止的条件,并执行内存回收。
本实施例提供的内存回收方法,通过监控到有应用被启动或切换到前台界面时,从预存的多套内存水线中获取该应用的内存水线,根据该应用的内存水线和系统内存占用信息判定满足内存回收条件时,从终端设备当前正在运行的应用中确定将被回收内存的应用,并将该应用的内存水线传入内核空间,用于内核根据该应用的内存水线执行内存回收。从而,针对不同内存需求的应用,可根据不同的内存水线进行内存回收,因此可避免内存过度回收和回收不足的问题,还可提高应用的保活率。
下面采用三个具体的实施例,对图2所示方法实施例的技术方案进行详细说明。
图3为本申请提供的一种内存回收方法实施例的流程图,如图3所示,本实施例的方法可以包括:
S201、监控到有应用被启动或切换到前台界面时,从预存的第一群组信息中查找该应用所属的目标群组,第一群组信息包括群组标识、群组内应用和内存水线的映射关系,将目标群组的内存水线确定为该应用的内存水线。
例如,当前被启动应用为APP4,从表一所示的第一群组信息中查找到APP4所属的目标群组为群组2,将群组2的内存水线二作为APP2的内存水线。
具体地,可以是根据图2所示实施例中S101a~S101b的过程获取第一群组信息,并存储第一群组信息,详细过程可参见图2所示实施例中S101a~S101b的详细描述,此处不再赘述。
在将获得的第一群组信息存储后,进一步地,后续还可以根据配置文件指示的群组标识和群组内应用的更新,更新第一群组信息。也就是说群组内的应用是可以变化的。
S202、根据该应用的内存水线和系统内存占用信息判定是否满足内存回收条件,若是则执行S203,若否返回执行S201。
S203、从终端设备当前正在运行的应用中确定将被回收内存的应用,并通过预留的函数接口将该应用的内存水线传入内核空间,用于内核根据该应用的内存水线执行内存回收。
图4为本申请提供的一种内存回收方法实施例的流程图,如图4所示,本实施例的方法可以包括:
S301、监控到有应用被启动或切换到前台界面时,根据该应用的内存需求和预存的第 二群组信息确定该应用所属的目标群组,第二群组信息包括群组标识、内存需求范围和内存水线的映射关系,将目标群组的内存水线确定为该应用的内存水线。
其中,根据该应用的内存需求和预存的第二群组信息确定该应用所属的目标群组,具体可以是:若该应用的内存需求在一群组的内存需求范围内,则将该群组确定为目标群组。
例如,如表二所示的第二群组信息,当前被启动应用为APP6,若APP6的内存需求为1.2GB,1.2GB在群组3的内存需求范围1GB~1.5GB内,将群组3确定为目标群组,并将群组3的内存水线三作为APP6的内存水线。
具体地,可以是根据图2所示实施例中S101a’~S101b’的过程获取第二群组信息,并存储第二群组信息,详细过程可参见图2所示实施例中S101a’~S101b’的详细描述,此处不再赘述。
S302、根据该应用的内存水线和系统内存占用信息判定是否满足内存回收条件,若是则执行S303,若否返回执行S301。
S303、从终端设备当前正在运行的应用中确定将被回收内存的应用,并通过预留的函数接口将该应用的内存水线传入内核空间,用于内核根据该应用的内存水线执行内存回收。
图5为本申请提供的一种内存回收方法实施例的流程图,与图3和图4的区别在于,本实施例中第一群组信息是在线获取的,如图5所示,本实施例的方法可以包括:
S401、获取预设时间内各个应用运行后的历史使用内存数据。
其中,历史使用内存数据为应用启动时所占内存,或者,历史占用内存数据为应用启动时所占内存和使用预设时间段所占内存之和。
具体地,可以是用户拿到终端设备之后,运行终端设备上的各个应用,由系统获取各个应用运行后的历史使用内存数据,预设时间可以根据用户自己设定。
S402、根据各个应用的历史使用内存数据分别预测各个应用的内存需求。
其中,内存需求为启动时所需内存;或者,内存需求为启动时所需内存和预期使用阶段增长内存之和。
具体地,在预测内存需求时,可以是根据预设的规则预测,例如取每次应用运行后的使用内存的平均值,或者取最大值等。
S403、根据预测的各个应用的内存需求获取第一群组信息,第一群组信息包括群组标识、群组内应用和内存水线的映射关系。
具体地,根据预测的各个应用的内存需求获取第一群组信息,具体为:
根据预测的各个应用的内存需求和多套内存水线确定各个应用对应的内存水线,与一套内存水线对应的所有应用为一个群组内的元素,一个群组内包括至少一个应用,得到第一群组信息。
在将获得的第一群组信息存储后,进一步地,后续还可以根据配置文件指示的群组标识和群组内应用或者群组内应用的更新,更新第一群组信息。也就是说群组内的应用是可以变化的,例如某一应用版本升级后内存需求发生变化,对应所属的群组也发生变化,此时需要更新群组内应用。
S404、监控到有应用被启动或切换到前台界面时,从第一群组信息中查找该应用所 属的目标群组,将目标群组的内存水线确定为该应用的内存水线。
S405、根据该应用的内存水线和系统内存占用信息判定是否满足内存回收条件,若是则执行S403,若否返回执行S404。
S406、从终端设备当前正在运行的应用中确定将被回收内存的应用,并通过预留的函数接口将该应用的内存水线传入内核空间,用于内核根据该应用的内存水线执行内存回收。
图6为本申请提供的一种内存回收方法实施例的流程图,与图3和图4的区别在于,本实施例中第二群组信息是在线获取的,如图6所示,本实施例的方法可以包括:
S501、获取预设时间内各个应用运行后的历史使用内存数据。
其中,历史使用内存数据为应用启动时所占内存,或者,历史占用内存数据为应用启动时所占内存和使用预设时间段所占内存之和。
具体地,可以是用户拿到终端设备之后,运行终端设备上的各个应用,由系统获取各个应用运行后的历史使用内存数据,预设时间可以根据用户自己设定。
S502、根据各个应用的历史使用内存数据分别预测各个应用的内存需求。
其中,内存需求为启动时所需内存;或者,内存需求为启动时所需内存和预期使用阶段增长内存之和。
具体地,在预测内存需求时,可以是根据预设的规则预测,例如取每次应用运行后的使用内存的平均值,或者取最大值等。
S503、根据预测的各个应用的内存需求获取第二群组信息,第二群组信息包括群组标识、内存需求范围和内存水线的映射关系。
具体地,根据预测的各个应用的内存需求获取第二群组信息,具体为:
根据预测的各个应用的内存需求和多套内存水线将所有应用进行群组划分,得到多个群组,一套内存水线对应一个群组,一个内存需求范围内的应用属于同一个群组,得到第二群组信息。
S504、监控到有应用被启动或切换到前台界面时,根据该应用的内存需求和第二群组信息确定该应用所属的目标群组,将目标群组的内存水线确定为该应用的内存水线。
S505、根据该应用的内存水线和系统内存占用信息判定是否满足内存回收条件,若是则执行S503,若否返回执行S504。
S506、从终端设备当前正在运行的应用中确定将被回收内存的应用,并通过预留的函数接口将该应用的内存水线传入内核空间,用于内核根据该应用的内存水线执行内存回收。
图7为本申请提供的一种内存回收装置实施例的结构示意图,如图7所示,本实施例的装置可以包括:获取模块11和处理模块12,其中,获取模块11用于监控到有应用被启动或切换到前台界面时,从预存的多套内存水线中获取所述应用的内存水线;
处理模块12用于根据所述应用的内存水线和系统内存占用信息判定满足内存回收条件时,从终端设备当前正在运行的应用中确定将被回收内存的应用,并将所述应用的内存水线传入内核空间,用于内核根据所述应用的内存水线执行内存回收。
进一步地,所述获取模块11用于:
从第一群组信息中查找所述应用所属的目标群组,所述第一群组信息包括群组内应用 和内存水线的映射关系;
将所述目标群组的内存水线确定为所述应用的内存水线;或者,
根据所述应用的内存需求和第二群组信息确定所述应用所属的目标群组,所述第二群组信息包括群组内存需求范围和内存水线的映射关系;
将所述目标群组的内存水线确定为所述应用的内存水线。
可选的,所述第一群组信息和所述第二群组信息是预先存储的。
进一步地,所述获取模块11用于:
若所述应用的内存需求在一群组的内存需求范围内,则将所述群组确定为所述目标群组。
进一步地,所述获取模块11还用于:
获取预设时间内各个应用运行后的历史使用内存数据,所述历史使用内存数据为应用启动时所占内存,或者,所述历史占用内存数据为应用启动时所占内存和使用预设时间段所占内存之和;
根据各个应用的历史使用内存数据分别预测各个应用的内存需求,所述内存需求为启动时所需内存;或者,所述内存需求为启动时所需内存和预期使用阶段增长内存之和;
根据预测的各个应用的内存需求获取所述第一群组信息或所述第二群组信息。
进一步地,所述获取模块11用于:
根据预测的各个应用的内存需求和所述多套内存水线确定各个应用对应的内存水线,与一套内存水线对应的所有应用为一个群组内的元素,一个群组内包括至少一个应用,得到所述第一群组信息。
进一步地,所述获取模块11用于:
根据预测的各个应用的内存需求和所述多套内存水线将所有应用进行群组划分,得到多个群组,一套内存水线对应一个群组,一个内存需求范围内的应用属于同一个群组,得到所述第二群组信息。
进一步地,所述处理模块12还用于:
根据配置文件指示的群组内应用的更新,更新所述第一群组信息。
进一步地,所述处理模块12用于:
通过预留的函数接口将所述应用的内存水线传入内核空间。
本实施例的装置,可以用于执行图2所示方法实施例的技术方案,其实现原理类似,此处不再赘述。
本申请可以根据上述方法示例对内存回收装置进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请各实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
图8为本申请提供的一种终端设备结构示意图,该终端设备200包括:
存储器201和处理器202;
存储器201,用于存储计算机程序;
处理器202,用于执行存储器存储的计算机程序,以实现上述实施例中的内存回收方 法。具体可以参见前述方法实施例中的相关描述。
可选地,存储器201既可以是独立的,也可以跟处理器202集成在一起。
当存储器201是独立于处理器202之外的器件时,终端设备200还可以包括:
总线203,用于连接存储器201和处理器202。
可选地,本实施例还包括:通信接口204,该通信接口204可以通过总线203与处理器202连接。处理器202可以控制通信接口203来实现终端设备200的上述的接收和发送的功能。
该终端设备可以用于执行上述方法实施例中终端设备对应的各个步骤和/或流程。
本申请还提供一种可读存储介质,可读存储介质中存储有执行指令,当终端设备的至少一个处理器执行该执行指令时,终端设备执行上述方法实施例中的内存回收方法。
本申请还提供一种程序产品,该程序产品包括执行指令,该执行指令存储在可读存储介质中。终端设备的至少一个处理器可以从可读存储介质读取该执行指令,至少一个处理器执行该执行指令使得终端设备实施上述方法实施例中的内存回收方法。
本申请还提供一种芯片,所述芯片与存储器相连,或者所述芯片上集成有存储器,当所述存储器中存储的软件程序被执行时,实现上述方法实施例中的内存回收方法。
本领域普通技术人员可以理解:在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。

Claims (21)

  1. 一种内存回收方法,其特征在于,包括:
    监控到有应用被启动或切换到前台界面时,从预存的多套内存水线中获取所述应用的内存水线;
    根据所述应用的内存水线和系统内存占用信息判定满足内存回收条件时,从终端设备当前正在运行的应用中确定将被回收内存的应用,并将所述应用的内存水线传入内核空间,用于内核根据所述应用的内存水线执行内存回收。
  2. 根据权利要求1所述的方法,其特征在于,所述从预存的多套内存水线中获取所述应用的内存水线,包括:
    从第一群组信息中查找所述应用所属的目标群组,所述第一群组信息包括群组内应用和内存水线的映射关系;
    将所述目标群组的内存水线确定为所述应用的内存水线;或者,
    根据所述应用的内存需求和第二群组信息确定所述应用所属的目标群组,所述第二群组信息包括群组内存需求范围和内存水线的映射关系;
    将所述目标群组的内存水线确定为所述应用的内存水线。
  3. 根据权利要求2所述的方法,其特征在于,所述第一群组信息和所述第二群组信息是预先存储的。
  4. 根据权利要求2所述的方法,其特征在于,所述根据所述应用的内存需求和预存的第二群组信息确定所述应用所属的目标群组,包括:
    若所述应用的内存需求在一群组的内存需求范围内,则将所述群组确定为所述目标群组。
  5. 根据权利要求2所述的方法,其特征在于,所述方法还包括:
    获取预设时间内各个应用运行后的历史使用内存数据,所述历史使用内存数据为应用启动时所占内存,或者,所述历史占用内存数据为应用启动时所占内存和使用预设时间段所占内存之和;
    根据各个应用的历史使用内存数据分别预测各个应用的内存需求,所述内存需求为启动时所需内存;或者,所述内存需求为启动时所需内存和预期使用阶段增长内存之和;
    根据预测的各个应用的内存需求获取所述第一群组信息或所述第二群组信息。
  6. 根据权利要求5所述的方法,其特征在于,所述根据预测的各个应用的内存需求获取所述第一群组信息,包括:
    根据预测的各个应用的内存需求和所述多套内存水线确定各个应用对应的内存水线,与一套内存水线对应的所有应用为一个群组内的元素,一个群组内包括至少一个应用,得到所述第一群组信息。
  7. 根据权利要求5所述的方法,其特征在于,所述根据预测的各个应用的内存需求获取所述第二群组信息,包括:
    根据预测的各个应用的内存需求和所述多套内存水线将所有应用进行群组划分,得到多个群组,一套内存水线对应一个群组,一个内存需求范围内的应用属于同一个群组,得到所述第二群组信息。
  8. 根据权利要求2所述的方法,其特征在于,所述方法还包括:
    根据配置文件指示的群组内应用的更新,更新所述第一群组信息。
  9. 根据权利要求1所述的方法,其特征在于,所述将所述应用的内存水线传入内核空间,包括:
    通过预留的函数接口将所述应用的内存水线传入内核空间。
  10. 一种内存回收装置,其特征在于,包括:
    获取模块,用于监控到有应用被启动或切换到前台界面时,从预存的多套内存水线中获取所述应用的内存水线;
    处理模块,用于根据所述应用的内存水线和系统内存占用信息判定满足内存回收条件时,从终端设备当前正在运行的应用中确定将被回收内存的应用,并将所述应用的内存水线传入内核空间,用于内核根据所述应用的内存水线执行内存回收。
  11. 根据权利要求10所述的装置,其特征在于,所述获取模块用于:
    从第一群组信息中查找所述应用所属的目标群组,所述第一群组信息包括群组内应用和内存水线的映射关系;
    将所述目标群组的内存水线确定为所述应用的内存水线;或者,
    根据所述应用的内存需求和第二群组信息确定所述应用所属的目标群组,所述第二群组信息包括群组内存需求范围和内存水线的映射关系;
    将所述目标群组的内存水线确定为所述应用的内存水线。
  12. 根据权利要求11所述的装置,其特征在于,所述第一群组信息和所述第二群组信息是预先存储的。
  13. 根据权利要求11所述的装置,其特征在于,所述获取模块用于:
    若所述应用的内存需求在一群组的内存需求范围内,则将所述群组确定为所述目标群组。
  14. 根据权利要求11所述的装置,其特征在于,所述获取模块还用于:
    获取预设时间内各个应用运行后的历史使用内存数据,所述历史使用内存数据为应用启动时所占内存,或者,所述历史占用内存数据为应用启动时所占内存和使用预设时间段所占内存之和;
    根据各个应用的历史使用内存数据分别预测各个应用的内存需求,所述内存需求为启动时所需内存;或者,所述内存需求为启动时所需内存和预期使用阶段增长内存之和;
    根据预测的各个应用的内存需求获取所述第一群组信息或所述第二群组信息。
  15. 根据权利要求14所述的装置,其特征在于,所述获取模块用于:
    根据预测的各个应用的内存需求和所述多套内存水线确定各个应用对应的内存水线,与一套内存水线对应的所有应用为一个群组内的元素,一个群组内包括至少一个应用,得到所述第一群组信息。
  16. 根据权利要求14所述的装置,其特征在于,所述获取模块用于:
    根据预测的各个应用的内存需求和所述多套内存水线将所有应用进行群组划分,得到多个群组,一套内存水线对应一个群组,一个内存需求范围内的应用属于同一个群组,得到所述第二群组信息。
  17. 根据权利要求11所述的装置,其特征在于,所述处理模块还用于:
    根据配置文件指示的群组内应用的更新,更新所述第一群组信息。
  18. 根据权利要求10所述的装置,其特征在于,所述处理模块用于:
    通过预留的函数接口将所述应用的内存水线传入内核空间。
  19. 一种终端设备,其特征在于,包括:
    处理器;以及
    存储器,用于存储所述处理器的可执行指令;
    其中,所述处理器配置为经由执行所述可执行指令来执行权利要求1-9任一项所述的内存回收方法。
  20. 一种可读存储介质,所述可读存储介质中存储有执行指令,其特征在于,当终端设备的至少一个处理器执行所述执行指令时,所述终端设备执行权利要求1-9任一项所述的内存回收方法。
  21. 一种程序产品,其特征在于,所述程序产品包括计算机程序,所述计算机程序存储在可读存储介质中,通信装置的至少一个处理器可以从所述可读存储介质读取所述计算机程序,所述至少一个处理器执行所述计算机程序使得通信装置实施如权利要求1-9任意一项所述的方法。
PCT/CN2020/110827 2019-08-30 2020-08-24 内存回收方法及装置 WO2021036993A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910812574.1A CN112445606B (zh) 2019-08-30 2019-08-30 内存回收方法及装置
CN201910812574.1 2019-08-30

Publications (1)

Publication Number Publication Date
WO2021036993A1 true WO2021036993A1 (zh) 2021-03-04

Family

ID=74684164

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/110827 WO2021036993A1 (zh) 2019-08-30 2020-08-24 内存回收方法及装置

Country Status (2)

Country Link
CN (1) CN112445606B (zh)
WO (1) WO2021036993A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113961427B (zh) * 2021-12-20 2022-05-24 荣耀终端有限公司 系统内存分析的方法及电子设备
CN114518905A (zh) * 2022-01-21 2022-05-20 珠海全志科技股份有限公司 一种应用冷启动的方法、装置、计算机设备和存储介质
CN116700944B (zh) * 2022-11-03 2024-08-02 荣耀终端有限公司 一种内存回收方法、装置及电子设备

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110051525A1 (en) * 2007-10-04 2011-03-03 Macronix International Co., Ltd. Power saving method and circuit thereof for a semiconductor memory
CN102968335A (zh) * 2012-10-25 2013-03-13 东莞宇龙通信科技有限公司 终端和终端内存管理方法
CN103902359A (zh) * 2014-03-31 2014-07-02 深圳创维-Rgb电子有限公司 基于Android系统内存优化与应用调度方法及系统
CN105701025A (zh) * 2015-12-31 2016-06-22 华为技术有限公司 一种内存回收方法及装置
CN107220076A (zh) * 2016-09-27 2017-09-29 华为技术有限公司 一种内存回收方法及装置
CN108205474A (zh) * 2017-08-23 2018-06-26 珠海市魅族科技有限公司 内存管理方法、终端设备、计算机装置以及可读存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109669877B (zh) * 2018-12-11 2023-04-04 腾讯科技(深圳)有限公司 内存管理方法、装置、终端及存储介质
CN109656722B (zh) * 2019-01-04 2021-05-11 Oppo广东移动通信有限公司 内存优化方法、装置、移动终端及存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110051525A1 (en) * 2007-10-04 2011-03-03 Macronix International Co., Ltd. Power saving method and circuit thereof for a semiconductor memory
CN102968335A (zh) * 2012-10-25 2013-03-13 东莞宇龙通信科技有限公司 终端和终端内存管理方法
CN103902359A (zh) * 2014-03-31 2014-07-02 深圳创维-Rgb电子有限公司 基于Android系统内存优化与应用调度方法及系统
CN105701025A (zh) * 2015-12-31 2016-06-22 华为技术有限公司 一种内存回收方法及装置
CN107220076A (zh) * 2016-09-27 2017-09-29 华为技术有限公司 一种内存回收方法及装置
CN108205474A (zh) * 2017-08-23 2018-06-26 珠海市魅族科技有限公司 内存管理方法、终端设备、计算机装置以及可读存储介质

Also Published As

Publication number Publication date
CN112445606B (zh) 2024-06-18
CN112445606A (zh) 2021-03-05

Similar Documents

Publication Publication Date Title
WO2021036993A1 (zh) 内存回收方法及装置
US11531625B2 (en) Memory management method and apparatus
US10853329B2 (en) Distributed file system
US9678678B2 (en) Storage network data retrieval
US20130246825A1 (en) Method and system for dynamically power scaling a cache memory of a multi-core processing system
KR101387798B1 (ko) 무선 디바이스에 대해 프레즌스 정보 리프레시의 최적화
US9060009B2 (en) Network-extended data storage for mobile applications
TWI697239B (zh) 資源塊組的劃分方法和使用者終端
US20120149312A1 (en) Automatically Enabling Wireless Communication
US11868631B2 (en) System startup method and related device
CN110868339A (zh) 节点分配方法、装置、电子设备及可读存储介质
WO2024060682A1 (zh) 内存管理方法、装置、内存管理器、设备及存储介质
JP2019503119A (ja) ネットワーク利用率を向上させるためのネットワーク支援プロトコルの使用
WO2021147330A1 (zh) 内存交换的方法、装置
WO2014159252A2 (en) Methods and systems for providing resources for cloud storage
EP4246934A1 (en) Data transmission method, electronic device, and computer readable storage medium
US9210568B1 (en) Hardware-capability update method for a portable device with multiple SIM cards
CN107670276B (zh) 游戏应用控制方法及设备
CN110162395A (zh) 一种内存分配的方法及装置
US20140025630A1 (en) Data-store management apparatus, data providing system, and data providing method
CN105307130A (zh) 一种资源分配方法及系统
CN104750614A (zh) 用于管理存储器的方法和装置
CN111147556A (zh) 一种负载均衡方法、装置、设备及存储介质
CN106326326B (zh) 一种Android系统中的图片缓存优化方法
US20080294851A1 (en) Method, apparatus, computer program product, and system for management of shared memory

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20857279

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20857279

Country of ref document: EP

Kind code of ref document: A1