Memory management and control method and device, equipment and storage medium

By detecting the status of the memory group of the smart terminal, determining the memory control strategy based on the file page identification information, and dynamically managing memory resources, the system lag and application slow operation problems caused by insufficient memory of the smart terminal are solved, and the system performance and user experience are improved.

CN119105870APending Publication Date: 2024-12-10SHENZHEN TCL DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411214767.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

The system stuttering or slow application running speed due to insufficient memory is mainly due to frequent memory swaps and expiration operations.

Method used

By detecting the status of the target memory group, obtaining file page identification information, determining memory control policies based on page type identification and page marking information, performing memory control operations, including key page protection, general page protection and memory recycling policies, and dynamically managing memory resources to Avoid frequent swaps in and out.

Benefits of technology

It effectively improves the system performance of smart terminals in low memory reload scenarios, reduces the number of times of swapping in and out of memory file pages, improves the startup speed and background residency rate of the corresponding applications of key file pages, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119105870A_ABST
    Figure CN119105870A_ABST
Patent Text Reader

Abstract

The invention provides a memory management and control method and device, equipment and a storage medium, and the memory management and control method in the application comprises the following steps: if it is detected that a target memory group is in an insufficient memory state, obtaining file page identification information of a target file page in the target memory group; determining a memory management and control strategy of the target file page according to a page type identifier and page mark information in the file page identifier information; and performing memory management and control operation on the target file page based on the memory management and control strategy to obtain a memory management and control result. According to the method, memory retention protection is carried out on the key file page in a low-memory heavy load scene, the conditions of system jamming, slow application loading and the like caused by repeated loading due to frequent swap-in and swap-out are avoided, the starting speed of the hotspot application corresponding to the key file page and the background residence rate of the application can be effectively increased, and the application experience is improved. And the use experience of the intelligent terminal and the application of the user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a memory management method, apparatus, device and storage medium. Background Art

[0002] At present, as smart terminals such as smart TVs become increasingly intelligent, more and more smart terminals such as smart TVs can install a variety of applications. However, the general memory capacity of existing smart terminals such as smart TVs is relatively small. After loading multiple applications, smart terminals such as smart TVs will enter a reloaded state due to insufficient memory. In the reloaded state, the user's interactive operations on the applications in smart terminals such as smart TVs may cause the system of smart terminals such as smart TVs to perform a large number of memory swap operations due to insufficient memory, causing the terminal to experience system freezes or slow application startup and response speeds, affecting the user's experience. Summary of the invention

[0003] The embodiments of the present application provide a memory management method, apparatus, device and storage medium, which aim to solve the technical problem in the prior art that when the memory of a smart terminal is insufficient, the system freezes or the application runs slowly due to frequent large-scale memory swapping in and out.

[0004] In one aspect, an embodiment of the present application provides a memory management method, the memory management method comprising the following steps:

[0005] If it is detected that the target memory group is in an insufficient memory state, obtaining file page identification information of a target file page in the target memory group;

[0006] Determine the memory management and control strategy of the target file page according to the page type identifier and the page mark information in the file page identification information;

[0007] A memory control operation is performed on the target file page based on the memory control policy to obtain a memory control result.

[0008] In a possible implementation of the present application, determining the memory management and control strategy of the target file page according to the page type identifier and the page mark information in the file page identification information includes:

[0009] Obtaining page type identification and page mark information in the file page identification information;

[0010] If the page type identifier is a critical page type identifier, a preset critical page protection policy is determined as a memory management and control policy for the target file page;

[0011] If the page type identifier is a regular page type identifier and the page marking information is the first marking information, a preset regular page protection policy is determined as the memory management and control policy of the target file page;

[0012] If the page type identifier is a regular page type identifier and the page marking information is the second marking information, a preset memory reclaiming strategy is determined as the memory management and control strategy of the target file page.

[0013] In a possible implementation of the present application, performing a memory control operation on the target file page based on the memory control policy to obtain a memory control result includes:

[0014] Determining that the memory management and control policy is the key page protection policy;

[0015] Switching the page type identifier of the target file page to a regular page type identifier and setting the page mark information of the target file page to first mark information to obtain a first retained file page;

[0016] Based on the key page protection strategy, the first retained file page is stored in the linked list header area of ​​the second memory linked list, and the memory management result of the target file page corresponding to the key page type identifier is output.

[0017] In a possible implementation of the present application, performing a memory control operation on the target file page based on the memory control policy to obtain a memory control result includes:

[0018] Determining that the memory management and control policy is a conventional page protection policy;

[0019] Switching the page marking information of the target file page to second marking information to obtain a second retained file page;

[0020] Based on the conventional page protection strategy, the second retained file page is moved to the list header area of ​​the second memory list, and the memory management result of the target file page corresponding to the first marking information is output.

[0021] In a possible implementation of the present application, if the page type identifier is a regular page type identifier and the page marking information is the second marking information, determining the preset memory control policy as the memory control policy of the target file page includes:

[0022] Determine that the memory management and control strategy is a memory recycling strategy, and obtain a memory recycling ratio in the memory recycling strategy;

[0023] According to the memory recovery ratio, the target file page whose page mark information in the tail area of ​​the preset second memory linked list is the second mark information is set as a recovered file page;

[0024] Perform memory recovery processing on the recovered file page according to the memory recovery strategy, and output the memory management and control result of the recovered file page.

[0025] In a possible implementation of the present application, if it is detected that the target memory group is in an insufficient memory state, obtaining file page identification information of a target file page in the target memory group includes:

[0026] Accessing a target memory group, traversing memory file pages in the target memory group, and obtaining the number of file pages of the memory file pages in the target memory group;

[0027] If the number of file pages is greater than or equal to the target memory capacity of the target memory group, determining that the memory group state of the target memory group is an insufficient memory state;

[0028] The memory file page in the tail area of ​​the linked list of the first memory linked list in the target memory group is set as the target file page to be controlled, and the file page identification information of the target file page is obtained.

[0029] In a possible implementation of the present application, before determining the memory control strategy of the target file page according to the page type identifier and the page mark information in the file page identification information, the method further includes:

[0030] Obtaining a target application corresponding to the target file page and a historical startup frequency corresponding to the target application;

[0031] If the historical startup frequency is greater than a preset startup frequency threshold, obtaining a key file page corresponding to the target application;

[0032] The page type identifier of the target file page corresponding to the key file page is set as the key page type identifier.

[0033] On the other hand, the present application provides a memory management and control device, the memory management and control device comprising:

[0034] A memory acquisition module is configured to acquire file page identification information of a target file page in the target memory group if it is detected that the target memory group is in an insufficient memory state;

[0035] A policy acquisition module is configured to determine a memory management and control policy of the target file page according to the page type identifier and the page mark information in the file page identification information;

[0036] The memory control module is configured to perform memory control operations on the target file page based on the memory control policy to obtain a memory control result.

[0037] On the other hand, the present application also provides a memory management device, the memory management device comprising:

[0038] one or more processors;

[0039] Memory; and

[0040] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the steps of the memory management method.

[0041] On the other hand, the present application also provides a computer-readable storage medium on which a computer program is stored, and the computer program is loaded by a processor to execute the steps in the memory management method.

[0042] In the present application, by responding to a memory control request, the target file page of the first memory linked list in the target memory group is read; the memory control strategy of the target file page is determined according to the page type identifier and page tag information in the file page identification information; the memory control operation is performed on the target file page based on the memory control strategy to obtain a memory control result. The terminal obtains the target file page in the inactive first memory linked list in the protected target memory group when it is in a low memory overload state, and identifies the page type identifier and page tag information of the target file page, so as to determine whether the target file page is a key file page of a popular application, and then dynamically controls different target file pages according to the page type identifier and page tag information of the target file page, so as to realize memory retention protection of key file pages in low memory overload scenarios, avoid system freezes caused by repeated loading due to frequent swapping in and out, slow application loading, etc., and can effectively improve the startup speed of hot applications corresponding to key file pages and the application background residence rate, thereby improving the user's experience of smart terminals and applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0044] Figure 1 A schematic diagram of a scenario of a memory control method according to an embodiment of the present application;

[0045] Figure 2 This is a flowchart of an embodiment of the memory management and control method in the embodiment of the present application;

[0046] Figure 3A flowchart of an embodiment of obtaining file identification information of a target file page in a target memory group in a memory control method provided in an embodiment of the present application;

[0047] Figure 4 A flowchart of an embodiment of determining a key file page in a memory management and control method provided in an embodiment of the present application;

[0048] Figure 5 A schematic diagram of the structure of an embodiment of a memory management and control device provided in an embodiment of the present application;

[0049] Figure 6 A schematic diagram of the structure of an embodiment of a memory management and control device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0051] In the description of the present invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0052] In this application, the word "exemplary" is used to mean "serving as an example, illustration, or illustration." Any embodiment described in this application as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. The following description is given to enable any person skilled in the art to implement and use the invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the invention can be implemented without using these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in this application.

[0053] At present, as smart terminals such as smart TVs become increasingly intelligent, more and more smart terminals such as smart TVs can install a variety of applications. However, the general memory capacity of existing smart terminals such as smart TVs is relatively small. After loading multiple applications, smart terminals such as smart TVs will enter a reloaded state due to insufficient memory. In the reloaded state, the user's interactive operations on the applications in smart terminals such as smart TVs may cause the system of smart terminals such as smart TVs to perform a large number of memory swap operations due to insufficient memory, causing the terminal to experience system freezes or slow application startup and response speeds, affecting the user's experience.

[0054] Based on this, the present application proposes a memory management method, device, equipment and computer-readable storage medium to solve the technical problem in the prior art that when the smart terminal is short of memory, frequent large-scale memory swapping in and out causes system freezes or slow application running speeds.

[0055] The memory management method in the embodiment of the present invention is applied to a memory management device, which is arranged in a memory management device. The memory management device is provided with one or more processors, memories, and one or more applications, wherein the one or more applications are stored in the memories and are configured to be executed by the processor to implement the memory management method; wherein the memory management device can be an intelligent terminal, such as a mobile phone, a tablet computer, a network device, and a smart computer; optionally, the memory management device can also be a server, or a service cluster composed of multiple servers.

[0056] like Figure 1 As shown, Figure 1 This is a scenario diagram of the memory control method in an embodiment of the present application. The memory control scenario in the embodiment of the present invention includes a memory control device 100 (a memory control apparatus is integrated in the memory control device 100), and a computer-readable storage medium corresponding to the memory control method runs in the memory control device 100 to execute the steps of the memory control method.

[0057] Understandably, Figure 1 The memory control device in the memory control method scenario shown, or the devices included in the memory control device, does not constitute a limitation on the embodiments of the present invention, that is, the number of devices and types of devices of the memory control device included in the memory control method scenario, or the number of devices and types of devices included in each device, do not affect the overall implementation of the technical solution in the embodiments of the present invention, and can all be regarded as equivalent replacements or derivatives of the technical solution claimed to be protected by the embodiments of the present invention.

[0058] The memory management device 100 in the embodiment of the present invention is mainly used for: if it is detected that the target memory group is in an insufficient memory state, obtaining the file page identification information of the target file page in the target memory group; determining the memory management policy of the target file page according to the page type identification and page mark information in the file page identification information; performing memory management operations on the target file page based on the memory management policy to obtain a memory management result.

[0059] The memory management device 100 in the embodiment of the present invention can be an independent memory management device, such as a smart terminal such as a mobile phone, a tablet computer, a network device, a smart TV, a server, and a smart computer, or it can be a memory management network or a memory management cluster composed of multiple memory management devices.

[0060] The embodiments of the present application provide a memory management method, apparatus, device, and computer-readable storage medium, which are described in detail below.

[0061] It can be understood by those skilled in the art that Figure 1 The application environment shown in is only one of the application scenarios related to the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 1 More or fewer memory management devices, or memory management network connection relationships shown, such as Figure 1 Only one memory management device is shown. It can be understood that the scenario of the memory management method can also include one or more memory management devices, which are not specifically limited here. The memory management device 100 can also include a memory for storing memory file pages and other data.

[0062] It should be noted that Figure 1 The scenario diagram of the memory control method shown is only an example. The scenario of the memory control method described in the embodiment of the present invention is to more clearly illustrate the technical solution of the embodiment of the present invention, and does not constitute a limitation on the technical solution provided by the embodiment of the present invention.

[0063] Based on the scenario of the above memory control method, various embodiments of the memory control method disclosed in the present invention are proposed.

[0064] like Figure 2 As shown, Figure 2 This is a flow chart of an embodiment of a memory control method in an embodiment of the present application. The memory control method includes the following steps 201 to 203:

[0065] 201. If it is detected that the target memory group is in an insufficient memory state, obtain file page identification information of a target file page in the target memory group;

[0066] The memory management method in this embodiment is applied to a memory management device, and the type and quantity of the memory management device are not specifically limited. That is, the memory management device can be one or more smart terminals or servers. In a specific embodiment, the memory management device is a smart TV.

[0067] Specifically, due to the common problem of small memory in smart terminals such as smart TVs, for example, the current running memory of smart TVs is generally 4G memory or less, especially the running memory of 2G, 3G smart TVs account for a large proportion. In this case, smart terminals such as smart TVs will enter a state of insufficient memory after loading multiple applications, resulting in abnormal states such as system freezes, application unresponsiveness, slow application startup, and termination of application operation in the background. In order to avoid the abnormal operation of the target application due to the incorrect memory recovery of the key file pages corresponding to the target application when the terminal is in a state of insufficient memory, the memory management device pre-sets a protected target memory group in the memory kernel, and detects the memory group state of the target memory group in real time during operation. Among them, the target memory group is a memory control group (Memcg, Memory Control Group) that contains a preset memory protection mark and is used to control and manage processes and blocked memory resources. In a specific embodiment, the target memory group includes a first memory linked list and a first active linked list. Among them, the first memory linked list is an inactive file page linked list (inactive linked list) in the target memory group.

[0068] Specifically, the memory control device responds to a memory control request during operation, wherein the memory control request is an operation event that drives the memory control device to perform dynamic memory control on the memory file page specified by the terminal. The triggering method of the memory control request is not specifically limited here, that is, the memory control request can be actively triggered by the user, for example, the user actively triggers the memory control request by clicking a key memory control button in the memory control device (the key memory control button can be a virtual button or other physical button in the setting interface). In addition, the memory control request can also be automatically triggered by the terminal, for example, a memory control process is set in the terminal, and when it is detected that the target memory group meets the preset conditions, the memory control request is actively triggered.

[0069] Specifically, after obtaining the memory control request, the memory control device detects the target memory group in real time, and when the system memory is in a low memory state (for example, the system memory is lower than a preset system memory threshold or the system memory is lower than a preset memory water level), further detects the memory state of the target memory group. When it is detected that the target memory group is in an insufficient memory state, the memory control device triggers the preset memory control process to perform dynamic memory control operations, that is, the memory control device obtains the target file page in the target memory group, and the file page identification information corresponding to the target file page, and in the subsequent memory control process, adaptively controls the target file page based on the file page identification information. Among them, the target file page is a reclaimable memory file page at the end of the first memory linked list in the target memory group. The file page identification information of the target file page is attribute identification information that characterizes the file page type of the target file page and the protection type of the target file page. In a specific embodiment, the preset memory water level may be a low memory water level, that is, the system memory may include a minimum memory water level, a low memory water level and a high memory water level, wherein the minimum memory water level may be 0.4% of the total memory, and the low memory water level may be 2.5 times of the minimum memory water level, that is, the low memory water level is 1% of the total system memory, and when the system memory is lower than the low memory water level, it is determined that the system memory is in a low memory state.

[0070] Specifically, after detecting that the target memory group is in an insufficient memory state, the memory management device obtains the first memory linked list in the target memory group, and obtains the memory file page that appears in the tail area of ​​the first memory linked list due to file page aging according to a preset memory recovery ratio, sets the memory file page as the target file page to be managed, and parses the target file page to obtain the file page identification information of the target file page.

[0071] Specifically, after acquiring the target file page, the memory management and control device reads the attribute information of the target file page, and determines the file page identification information of the target file page according to the attribute value corresponding to the file page identification information in the attribute information.

[0072] Among them, the file page identification information includes a page type identification and page marking information. The page type identification is identification information that indicates whether the target file page is a key file page corresponding to the target application. The page marking information is identification information that indicates the activity level of the target file page and whether it is a protected memory file page. Optionally, the page type identification includes a key page type identification and a regular page type identification. The page marking information includes first marking information and second marking information. In a specific embodiment, the first identification information is identification information that indicates that the target file page has been accessed within a preset time period and has a high level of activity. The second identification information is identification information that indicates that the target file page has not been accessed within a preset time period and has a low level of activity.

[0073] For example, in a specific embodiment, the memory management device reads the attribute value corresponding to the page type identifier in the attribute information of the target file page. If the attribute value corresponding to the page type identifier is 0, the page type identifier representing the target file page is a regular page type identifier. If the attribute value corresponding to the page type identifier is 1, the page type identifier representing the target file page is a key page type identifier.

[0074] For example, in another specific embodiment, the memory management device reads the attribute value corresponding to the page mark information in the attribute information of the target file page, and if the attribute value corresponding to the page mark information is 0, the page mark information representing the target file page is the second mark information. If the attribute value corresponding to the page mark information is 1, the page mark information representing the target file page is the first mark information.

[0075] Optionally, if the page type identifier of any target file page is a critical page type identifier, it indicates that the target file page is a critical file page required for the target application to start or run. If the page type identifier of any target file page is a regular page type identifier, it indicates that the target file page is a regular memory file page. The target application is a hot application with a high startup frequency in the terminal.

[0076] Optionally, if the page marking information of any target file page is the first marking information, it indicates that the target file page is a memory file page that needs to be retained and protected. If the page marking information of the target file page of any non-critical file page is the second marking information, it indicates that the target file page is a memory file page that does not need to be retained and protected and can be recycled.

[0077] 202. Determine a memory management and control strategy for the target file page according to the page type identifier and the page mark information in the file page identifier information;

[0078] Specifically, after acquiring the file page identification information of the target file page, the memory management and control device further determines the memory management and control policy of the target file page according to the page type identification and page mark information in the file page identification information.

[0079] Specifically, in order to achieve memory retention protection for key file pages associated with the target application, the memory management and control device uses the page type identifier of the target file page to perform retention management on the target file page, so that the key file page can survive longer in the terminal memory. However, in order to avoid excessive occupation of system memory due to the key file page being resident in the memory, the memory management and control device also uses the page marking information of the target memory page to determine whether it is necessary to perform secondary retention management on the target memory page, so as to retain the specified key file page in the system memory as much as possible but not to be resident in the memory, and can also effectively reduce the number of times memory file pages are swapped in and out.

[0080] Specifically, in order to perform memory control processing on target file pages carrying different file page identification information, the memory control device pre-sets different memory control strategies, and the different memory control strategies correspond to different file page identification information. Among them, the memory control strategy is an operation strategy for performing memory control on the target file page corresponding to the specified file page identification information. Optionally, in a specific embodiment, the memory control strategy includes a critical page protection strategy, a regular page protection strategy, and a memory recovery strategy.

[0081] The critical page protection strategy is a memory management and control strategy that represents memory retention control of critical file pages of a target application.

[0082] The conventional page protection strategy is a memory management and control strategy that represents a secondary memory retention control of a target file page carrying the first marking information.

[0083] The memory reclaiming strategy is a memory management and control strategy for reclaiming memory pages of regular file pages whose page marking information is the second marking information.

[0084] Specifically, after the memory management and control device obtains the file page identification information of each target file page, it also selects a memory management and control policy corresponding to the target file page according to the page type identification and page mark information in the file page identification information.

[0085] Optionally, if the memory management device determines that the page type identifier of the target file page is a critical page type identifier, the memory management device determines that the target file page is the critical file page corresponding to the target application, and determines that memory protection needs to be performed on the critical file page, and then determines the critical page protection policy as the memory management policy of the target file page.

[0086] Optionally, if the memory management device determines that the page type identifier of the target file page is a regular type identifier, and the page mark information of the target file page is the first mark information, the memory management device determines that the target file page is a regular memory file page that needs to be retained and sets the regular page protection policy as the memory management policy of the target file page.

[0087] Optionally, if the memory management device determines that the page type identifier of the target file page is a regular page type identifier and the page mark information of the target file page is the second mark information, the memory management device determines that the target file page is a memory file page that can perform a memory recovery operation, and determines the memory management policy of the target file page based on the memory recovery policy.

[0088] 203. Perform a memory control operation on the target file page based on the memory control policy to obtain a memory control result.

[0089] Specifically, after obtaining the memory control policy of each target file page, the memory control device also uses the memory control policy to perform adaptive memory control operations on each target file page, thereby retaining the specified key file page in the system memory as much as possible and avoiding the key file page from being resident in the memory, and can also effectively reduce the number of times the memory file page is swapped in and out.

[0090] Specifically, after matching the memory control policy for each target file page, and when the target memory group is in an insufficient memory state, the memory control device uses the memory control policy to perform corresponding memory control operations on the target file page, thereby obtaining a memory control result.

[0091] Optionally, in a specific embodiment, the memory management device determines that the memory management policy corresponding to the target memory page whose page type identifier is the key page type identifier is a key page protection policy, and uses the key page protection policy to perform memory management on the target memory page to obtain a memory management result. Among them, the memory management rule of the key page protection policy is to extract the target memory page in the first memory linked list, remove the key page type identifier of the target memory page, add the first tag information to the target memory page, and then add the target memory page to the linked list header area of ​​the second memory linked list in the system memory kernel.

[0092] That is, when the target memory group is short of memory, the memory control device uses the key page protection strategy to perform memory protection processing on the target memory page whose page type identifier is the key page type identifier. That is, when the target memory group is short of memory, the memory control device uses the preset memory control thread to take out the target memory page whose page type identifier is the key page type identifier from the first memory linked list of the target memory group, remove the key page type identifier of the target memory page, and add the first marking information to the target memory page. That is, the memory control device drives the memory control thread to switch the page type identifier in the extracted target memory page to a regular page type identifier according to the key page protection strategy, and sets the page marking information of the target file page to the first marking information, and obtains the first left-behind file page, thereby avoiding the key file page corresponding to the target application from being resident in the system memory and causing excessive occupation of the system memory without affecting the operation of the target application. Among them, the memory control thread is the kswapd thread.

[0093] Specifically, the memory control device adjusts the file page identification information of the target file page according to the key page protection strategy, and after obtaining the first retained file page, it also drives the memory control thread to store the first retained file page in the linked list header area of ​​the second memory linked list in the system memory kernel based on the key page protection strategy, and outputs the memory control result of the target file page corresponding to the key page type identifier. File page protection processing is implemented for key file pages to prevent key file pages from being erroneously recycled.

[0094] Optionally, in another specific embodiment, the memory management device determines that the memory management policy corresponding to the target memory page whose page type identifier is a regular page type identifier and whose page tag information is the first tag information is a regular page protection policy, and uses the regular page protection policy to perform memory retention processing on the target memory page to obtain a memory management result, wherein the regular page protection policy is a protection policy for performing memory retention processing on the target memory page carrying the first tag information.

[0095] That is, when the target memory group is short of memory, the memory management device uses the conventional page protection strategy to perform memory retention processing on the target memory page whose page type identifier is the conventional page identifier type and whose page marking information is the first marking information, that is, when the target memory group is short of memory, the memory management device uses the preset memory management thread to retrieve the target memory page whose page type identifier is the conventional page type identifier and whose page marking information is the first marking information from the first memory linked list of the target memory group or the second memory linked list in the system memory kernel, removes the first marking information, and switches the page marking information of the target file page to the second marking information to obtain the second retained file page. After acquiring the second retained file, the memory management device also drives the memory management thread to move the second retained file page to the linked list header area of ​​the second memory linked list based on the conventional page protection strategy, and outputs the memory management result of the target file page corresponding to the first marking information, wherein the memory management result is the memory optimization result of performing memory retention processing on the second retained file page.

[0096] Optionally, the memory management device determines that the memory management policy corresponding to the target memory page whose page type identifier is a regular page type identifier and whose page marking information is the second marking information is a memory recovery policy, and uses the memory recovery policy to perform memory recovery processing on the target memory page to obtain a memory management result. Among them, the memory recovery policy is a memory management policy for performing memory recovery on the recovery file pages in the specified inactive memory linked list.

[0097] Specifically, when the target memory group is short of memory or the system is short of memory, the memory management and control device uses the memory recovery strategy to perform memory recovery processing on the recovered memory pages whose page type is identified as the regular page identification type and whose page marking information is the second marking information. That is, the memory management and control device obtains the memory recovery ratio in the memory recovery strategy, and sets the target file page whose page type is identified as the regular page identification type and whose page marking information is the second marking information in the tail area of ​​the linked list of the second memory linked list as the recovered file page according to the memory recovery ratio, and drives the memory management and control thread to release the recovered file page according to the memory recovery strategy, and obtains the memory management and control result corresponding to the recovered file page. Among them, the memory management and control result is the memory optimization result of memory recovery for the recovered file page. Among them, the memory recovery method corresponding to the memory recovery strategy is the LRU (Least Recently Used) algorithm.

[0098] Specifically, as each memory file page in the memory management and control device gradually ages, each memory file page will gradually move to the tail area of ​​the linked list in the first memory linked list or the second memory linked list, and when the target memory group is insufficient in memory, each memory file page will be identified and recognized, and memory management will be performed based on the identified file page identification information to obtain a new memory management result, thereby achieving multiple memory retention protection for key file pages in low memory overload scenarios, avoiding system freezes and slow application loading caused by repeated loading due to frequent swapping in and out.

[0099] In this embodiment, the memory control device reads the target file page of the first memory linked list in the target memory group by responding to the memory control request; determines the memory control strategy of the target file page according to the page type identifier and page tag information in the file page identification information; performs memory control operations on the target file page based on the memory control strategy to obtain a memory control result. The terminal obtains the target file page in the inactive first memory linked list in the protected target memory group in a low memory overload state, and identifies the page type identifier and page tag information of the target file page, thereby determining whether the target file page is a key file page of a popular application, thereby dynamically controlling different target file pages according to the page type identifier and page tag information of the target file page, thereby realizing memory retention protection for key file pages in low memory overload scenarios, avoiding repeated loading due to frequent swapping in and out, causing system freezes, slow application loading, etc., and can effectively improve the startup speed of hot applications corresponding to key file pages and the application background residence rate, thereby improving the user's experience of smart terminals and applications.

[0100] like Figure 3 As shown, Figure 3 This is a flow chart of an embodiment of obtaining file identification information of a target file page in a target memory group in a memory control method provided in an embodiment of the present application. Specifically, in this embodiment, the memory control method further includes steps 301 to 303:

[0101] 301. Access a target memory group, traverse memory file pages in the target memory group, and obtain the number of file pages of the memory file pages in the target memory group;

[0102] 302. If the number of file pages is greater than or equal to the target memory capacity of the target memory group, determine that the memory group state of the target memory group is an insufficient memory state;

[0103] 303. Set the memory file page in the tail area of ​​the linked list of the first memory linked list in the target memory group as the target file page to be controlled, and obtain the file page identification information of the target file page.

[0104] Based on the above embodiments, in this embodiment, the memory management device also detects the target memory group in real time during operation, and when it is detected that the target memory group is in an insufficient memory state, reads the target file in the target memory group and the file page identification information of the target file page.

[0105] Specifically, the memory management and control device accesses the target memory group, traverses the memory file pages in the target memory group, and counts the number of the memory file pages to obtain the number of file pages of the memory file pages in the target memory group.

[0106] Specifically, the memory management and control device sets a target memory capacity for the protected target memory group in advance, and determines the memory group status of the target memory group by the target memory capacity and the number of file pages of the target memory group, wherein the target memory capacity represents the number of memory file pages that the target memory group can accommodate.

[0107] Optionally, if the number of file pages of the target memory group is less than the target memory capacity of the target memory group, the memory management device determines that the memory group state of the target memory group is a sufficient memory state, and there is no need to optimize and manage the memory file pages in the target memory group.

[0108] Optionally, if the number of file pages of the target memory group is greater than the target memory capacity of the target memory group, the memory management device determines that the memory group state of the target memory group is an insufficient memory state, and the memory management device determines that the memory file pages in the target memory group need to be optimized and managed.

[0109] Specifically, due to the different aging degrees of each memory file page and the first-in-first-out linked list management strategy, inactive memory file pages will gradually move to the tail area of ​​the memory linked list. Therefore, the memory management device obtains the first memory linked list of the target memory group, and sets the memory file page in the tail area of ​​the linked list of the first memory linked list in the target memory group as the target file page to be controlled according to the preset recovery ratio, and parses the target file page to obtain the file page identification information of the target file page.

[0110] Specifically, after acquiring the target file page, the memory management and control device reads the attribute information of the target file page, and determines the file page identification information of the target file page according to the attribute value corresponding to the file page identification information in the attribute information.

[0111] Among them, the file page identification information includes a page type identification and page marking information. The page type identification is identification information that indicates whether the target file page is a key file page corresponding to the target application. The page marking information is identification information that indicates the activity level of the target file page and whether it is a protected memory file page. Optionally, the page type identification includes a key page type identification and a regular page type identification. The page marking information includes first marking information and second marking information. In a specific embodiment, the first identification information is identification information that indicates that the target file page has been accessed within a preset time period and has a high level of activity. The second identification information is identification information that indicates that the target file page has not been accessed within a preset time period and has a low level of activity.

[0112] In this embodiment, the memory management device accesses the target memory group, traverses the memory file pages in the target memory group, and obtains the number of file pages of the memory file pages in the target memory group; if the number of file pages is greater than or equal to the target memory capacity of the target memory group, the memory group state of the target memory group is determined to be an insufficient memory state; the memory file page in the tail area of ​​the linked list of the first memory linked list in the target memory group is set as the target file page to be managed, and the file page identification information of the target file page is obtained. The memory group state of the protected target memory group is detected in real time to determine the memory management timing of the target memory group and reduce the number of memory swaps in and out.

[0113] like Figure 4 As shown, Figure 4 This is a flow chart of an embodiment of determining a key file page in a memory control method provided in an embodiment of the present application. Specifically, in this embodiment, the memory control method further includes steps 401 to 403:

[0114] 401. Obtain a target application corresponding to the target file page and a historical startup frequency corresponding to the target application;

[0115] 402. If the historical startup frequency is greater than a preset startup frequency threshold, obtain a key file page corresponding to the target application;

[0116] 403. Set the page type identifier of the target file page corresponding to the key file page as the key page type identifier.

[0117] Based on the above embodiments, in this embodiment, before performing memory control on each target file page, the memory management device also sets the page type identification and page marking information of each target file page accordingly, and in the subsequent memory management process, determines the corresponding memory management strategy through the page type identification and page marking information, and performs memory control on the target file page according to the memory management strategy.

[0118] Specifically, during operation, the memory management and control device also obtains the target application corresponding to each target file page and the historical startup frequency corresponding to the target application, wherein the historical startup frequency is a parameter representing the startup frequency or user usage frequency of the target application in a preset historical time period. Optionally, in a specific embodiment, the preset historical time period can be the day before the memory management and control.

[0119] Specifically, the memory management and control device also pre-sets a startup frequency threshold for evaluating whether the target application is an important application, and compares the startup frequency threshold with the historical startup frequency corresponding to the target application to determine whether the target application is an important application.

[0120] Optionally, if the historical startup frequency is greater than the preset startup frequency threshold, the memory management and control device determines that the target application is frequently started by the user and sets the target application as an important application.

[0121] Specifically, after obtaining the important application in the terminal, the memory management device also obtains the key file page corresponding to the important application according to the application file directory of the important application, wherein the key file page is the application file page corresponding to the file required when the important application is started or run.

[0122] Specifically, after obtaining the critical file page, the memory management device sets the page type identifier of the target file page corresponding to the critical file page corresponding to the target application as the critical page type identifier, and protects the critical file page carrying the critical page type identifier during subsequent memory management.

[0123] Optionally, in other embodiments, the memory management and control device further obtains the historical access count of each target file page, and sets the page marking information of the target file page according to the historical access count, thereby obtaining the page identification information of the target file page. The historical access count is the number of times the target file page has been accessed within a preset historical time period.

[0124] Optionally, if the historical access count of the target file page is greater than or equal to a preset access count threshold, the memory management device sets the page identification information of the target file page to the first identification information. Optionally, in a specific embodiment, the access count threshold is 1. That is, the terminal determines whether the target file page has been accessed based on the access count threshold and the historical access count.

[0125] Optionally, if the historical access count of the target file page is less than a preset access count threshold, the memory management and control device sets the page identification information of the target file page to the second identification information.

[0126] Specifically, after determining the page type identification and page mark information of each target file page, the memory management device also determines the memory management policy of the target file page based on the page type information and page identification information of the target file page, and performs memory management operations on the target file page according to the memory management policy when memory is insufficient.

[0127] In this embodiment, the memory management device obtains the target application corresponding to the target file page and the historical startup frequency corresponding to the target application; if the historical startup frequency is greater than the preset startup frequency threshold, the key file page corresponding to the target application is obtained; and the page type identifier of the target file page corresponding to the key file page is set as the key page type identifier. The important application is determined according to the application startup frequency, and the page type identifier of the target file page is set according to the key file page corresponding to the important application, which provides a matching basis for subsequent memory management and improves the accuracy of memory management.

[0128] In order to better implement the memory control method in the embodiment of the present application, based on the memory control method, a memory control device is also provided in the embodiment of the present application, such as Figure 5 As shown, Figure 5 The schematic diagram of the structure of the memory management and control device provided in the embodiment of the present application is as follows. Specifically, the memory management and control device 500 includes:

[0129] The memory acquisition module 501 is configured to acquire the file page identification information of the target file page in the target memory group if it is detected that the target memory group is in an insufficient memory state;

[0130] A policy acquisition module 502 is configured to determine a memory management and control policy of the target file page according to the page type identifier and the page mark information in the file page identifier information;

[0131] The memory control module 503 is configured to perform a memory control operation on the target file page based on the memory control policy to obtain a memory control result.

[0132] In a possible implementation of this embodiment, the memory management and control device determines the memory management and control strategy of the target file page according to the page type identifier and the page mark information in the file page identification information, including:

[0133] Obtaining page type identification and page mark information in the file page identification information;

[0134] If the page type identifier is a critical page type identifier, a preset critical page protection policy is determined as a memory management and control policy for the target file page;

[0135] If the page type identifier is a regular page type identifier and the page marking information is the first marking information, a preset regular page protection policy is determined as the memory management and control policy of the target file page;

[0136] If the page type identifier is a regular page type identifier and the page marking information is the second marking information, a preset memory reclaiming strategy is determined as the memory management and control strategy of the target file page.

[0137] In a possible implementation of this embodiment, the memory management and control device performs a memory management and control operation on the target file page based on the memory management and control policy to obtain a memory management and control result, including:

[0138] Determining that the memory management and control policy is the key page protection policy;

[0139] Switching the page type identifier of the target file page to a regular page type identifier and setting the page mark information of the target file page to first mark information to obtain a first retained file page;

[0140] Based on the key page protection strategy, the first retained file page is stored in the linked list header area of ​​the second memory linked list, and the memory management result of the target file page corresponding to the key page type identifier is output.

[0141] In a possible implementation of this embodiment, the memory management and control device performs a memory management and control operation on the target file page based on the memory management and control policy to obtain a memory management and control result, including:

[0142] Determining that the memory management and control policy is a conventional page protection policy;

[0143] Switching the page marking information of the target file page to second marking information to obtain a second retained file page;

[0144] Based on the conventional page protection strategy, the second retained file page is moved to the list header area of ​​the second memory list, and the memory management result of the target file page corresponding to the first marking information is output.

[0145] In a possible implementation of this embodiment, if the page type identifier is a regular page type identifier and the page marking information is the second marking information, the memory management and control device determines a preset memory management and control policy as the memory management and control policy of the target file page, including:

[0146] Determine that the memory management and control strategy is a memory recycling strategy, and obtain a memory recycling ratio in the memory recycling strategy;

[0147] According to the memory recovery ratio, the target file page whose page mark information in the tail area of ​​the preset second memory linked list is the second mark information is set as a recovered file page;

[0148] Perform memory recovery processing on the recovered file page according to the memory recovery strategy, and output the memory management and control result of the recovered file page.

[0149] In a possible implementation of this embodiment, if the memory management and control device detects that the target memory group is in an insufficient memory state, the file page identification information of the target file page in the target memory group is obtained, including:

[0150] Accessing a target memory group, traversing memory file pages in the target memory group, and obtaining the number of file pages of the memory file pages in the target memory group;

[0151] If the number of file pages is greater than or equal to the target memory capacity of the target memory group, determining that the memory group state of the target memory group is an insufficient memory state;

[0152] The memory file page in the tail area of ​​the linked list of the first memory linked list in the target memory group is set as the target file page to be controlled, and the file page identification information of the target file page is obtained.

[0153] In a possible implementation of this embodiment, before the memory management and control device determines the memory management and control strategy of the target file page according to the page type identifier and the page mark information in the file page identification information, it also includes:

[0154] Obtaining a target application corresponding to the target file page and a historical startup frequency corresponding to the target application;

[0155] If the historical startup frequency is greater than a preset startup frequency threshold, obtaining a key file page corresponding to the target application;

[0156] The page type identifier of the target file page corresponding to the key file page is set as the key page type identifier.

[0157] In this embodiment, the memory control device reads the target file page of the first memory linked list in the target memory group by responding to the memory control request; determines the memory control strategy of the target file page according to the page type identifier and page tag information in the file page identification information; performs memory control operations on the target file page based on the memory control strategy to obtain a memory control result. The terminal obtains the target file page in the inactive first memory linked list in the protected target memory group in a low memory overload state, and identifies the page type identifier and page tag information of the target file page, thereby determining whether the target file page is a key file page of a popular application, thereby dynamically controlling different target file pages according to the page type identifier and page tag information of the target file page, thereby realizing memory retention protection for key file pages in low memory overload scenarios, avoiding repeated loading due to frequent swapping in and out, causing system freezes, slow application loading, etc., and can effectively improve the startup speed of hot applications corresponding to key file pages and the application background residence rate, thereby improving the user's experience of smart terminals and applications.

[0158] The embodiment of the present invention also provides a memory management device, such as Figure 6 As shown, Figure 6 A schematic diagram of the structure of an embodiment of the memory management and control device provided in the embodiments of the present application.

[0159] The memory management and control device integrates any one of the memory management and control devices provided in the embodiments of the present invention, and the memory management and control device includes:

[0160] one or more processors;

[0161] Memory; and

[0162] One or more applications, wherein the one or more applications are stored in the memory and configured so that the processor executes the steps of the memory management method described in any of the above-mentioned memory management method embodiments.

[0163] Specifically, the memory management device may include one or more processors 601 of processing cores, one or more computer-readable storage media memories 602, a power supply 603, an input unit 604 and other components. Those skilled in the art will understand that Figure 6 The memory control device structure shown in the figure does not constitute a limitation on the memory control device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0164] The processor 601 is the control center of the memory management and control device. It uses various interfaces and lines to connect various parts of the entire memory management and control device. By running or executing software programs and / or modules stored in the memory 602, and calling data stored in the memory 602, it executes various functions of the memory management and control device and processes data, thereby monitoring the memory management and control device as a whole. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 601.

[0165] The memory 602 can be used to store software programs and modules, and the processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the memory management device, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.

[0166] The memory management and control device also includes a power supply 603 for supplying power to each component. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 603 may also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0167] The memory management device may also include an input unit 604, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0168] Although not shown, the memory management device may also include a display unit, etc., which will not be described in detail here. Specifically in this embodiment, the processor 601 in the memory management device will load the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 will run the application stored in the memory 602, thereby realizing various functions, as follows:

[0169] If it is detected that the target memory group is in an insufficient memory state, obtaining file page identification information of a target file page in the target memory group;

[0170] Determine the memory management and control strategy of the target file page according to the page type identifier and the page mark information in the file page identification information;

[0171] A memory control operation is performed on the target file page based on the memory control policy to obtain a memory control result.

[0172] To this end, an embodiment of the present invention provides a computer-readable storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any memory management method provided in an embodiment of the present invention. For example, the computer program can be loaded by a processor to execute the following steps:

[0173] If it is detected that the target memory group is in an insufficient memory state, obtaining file page identification information of a target file page in the target memory group;

[0174] Determine the memory management and control strategy of the target file page according to the page type identifier and the page mark information in the file page identification information;

[0175] A memory control operation is performed on the target file page based on the memory control policy to obtain a memory control result.

[0176] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the detailed description of other embodiments above, and will not be repeated here.

[0177] In specific implementation, the above units or structures can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units or structures can refer to the previous method embodiments, which will not be repeated here.

[0178] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0179] The above is a detailed introduction to a memory control method provided in an embodiment of the present application. Specific embodiments are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A memory management method, characterized in that: The memory management method includes: If it is detected that the target memory group is in an insufficient memory state, obtaining file page identification information of a target file page in the target memory group; Determine the memory management and control strategy of the target file page according to the page type identifier and the page mark information in the file page identification information; A memory control operation is performed on the target file page based on the memory control policy to obtain a memory control result.

2. The memory management method according to claim 1, characterized in that: The determining of the memory management and control strategy of the target file page according to the page type identifier and the page mark information in the file page identification information includes: Obtaining page type identification and page mark information in the file page identification information; If the page type identifier is a critical page type identifier, a preset critical page protection policy is determined as a memory management and control policy for the target file page; If the page type identifier is a regular page type identifier and the page marking information is the first marking information, a preset regular page protection policy is determined as the memory management and control policy of the target file page; If the page type identifier is a regular page type identifier and the page marking information is the second marking information, a preset memory reclaiming strategy is determined as the memory management and control strategy of the target file page.

3. The memory management method according to claim 2, characterized in that: The performing a memory control operation on the target file page based on the memory control policy to obtain a memory control result includes: Determining that the memory management and control policy is the key page protection policy; Switching the page type identifier of the target file page to a regular page type identifier and setting the page mark information of the target file page to first mark information to obtain a first retained file page; Based on the key page protection strategy, the first retained file page is stored in the linked list header area of ​​the second memory linked list, and the memory management result of the target file page corresponding to the key page type identifier is output.

4. The memory management and control method according to claim 2, characterized in that: The performing a memory control operation on the target file page based on the memory control policy to obtain a memory control result includes: Determining that the memory management and control policy is a conventional page protection policy; Switching the page marking information of the target file page to second marking information to obtain a second retained file page; Based on the conventional page protection strategy, the second retained file page is moved to the list header area of ​​the second memory list, and the memory management result of the target file page corresponding to the first marking information is output.

5. The memory management method according to claim 2, characterized in that: If the page type identifier is a regular page type identifier and the page marking information is the second marking information, determining a preset memory recovery strategy as the memory management and control strategy of the target file page includes: Determine that the memory management and control strategy is a memory recycling strategy, and obtain a memory recycling ratio in the memory recycling strategy; According to the memory recovery ratio, the target file page whose page mark information in the tail area of ​​the preset second memory linked list is the second mark information is set as a recovered file page; Perform memory recovery processing on the recovered file page according to the memory recovery strategy, and output the memory management and control result of the recovered file page.

6. The memory management and control method according to any one of claims 1 to 5, characterized in that: If it is detected that the target memory group is in an insufficient memory state, obtaining file page identification information of a target file page in the target memory group includes: Accessing a target memory group, traversing memory file pages in the target memory group, and obtaining the number of file pages of the memory file pages in the target memory group; If the number of file pages is greater than or equal to the target memory capacity of the target memory group, determining that the memory group state of the target memory group is an insufficient memory state; The memory file page in the tail area of ​​the linked list of the first memory linked list in the target memory group is set as the target file page to be controlled, and the file page identification information of the target file page is obtained.

7. The memory management and control method according to claim 1, characterized in that: Before determining the memory control strategy of the target file page according to the page type identifier and the page mark information in the file page identification information, the method further includes: Obtaining a target application corresponding to the target file page and a historical startup frequency corresponding to the target application; If the historical startup frequency is greater than a preset startup frequency threshold, obtaining a key file page corresponding to the target application; The page type identifier of the target file page corresponding to the key file page is set as the key page type identifier.

8. A memory control device, characterized in that: The memory control device comprises: A memory acquisition module is configured to acquire file page identification information of a target file page in the target memory group if it is detected that the target memory group is in an insufficient memory state; A policy acquisition module is configured to determine a memory management and control policy of the target file page according to the page type identifier and the page mark information in the file page identification information; The memory control module is configured to perform memory control operations on the target file page based on the memory control policy to obtain a memory control result.

9. A memory management and control device, characterized in that: The memory control device includes: one or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the steps of the memory management method described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps of the memory management method according to any one of claims 1 to 7.