Memory management method and device, electronic equipment and storage medium
By determining the memory recovery ratio, error rate and efficiency indicators in electronic devices, calculating the evaluation value and processing the memory swap strategy, the problem of fixed memory management strategies in the existing technology is solved, and more accurate performance evaluation and optimization is achieved, improving memory management effect and overall performance.
Patent Information
- Application Number
- CN202311135637.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2025-03-04
AI Technical Summary
Existing electronic devices adopt a fixed memory switching strategy in memory management, and lack performance evaluation, resulting in poor memory management results.
By determining the memory recovery ratio, memory recovery error rate and memory recovery efficiency waiting for evaluation indicators, the corresponding evaluation value is calculated, and the target memory swap strategy is processed based on the evaluation value to evaluate and optimize the performance of the memory swap strategy.
Through more comprehensive and accurate performance evaluation, optimize memory switching strategies and improve the memory management effect and overall performance of electronic devices.
Smart Images

Figure CN119557080A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of memory management technology, and more specifically, to a memory management method, device, electronic device and storage medium. Background Art
[0002] With the development of science and technology, electronic devices are used more and more widely and have more and more functions. They have become one of the necessities in people's daily life. Among them, electronic devices generally perform memory management. At present, the memory exchange strategy used by electronic devices for memory management is fixed and lacks performance evaluation, resulting in poor memory management effect. Summary of the invention
[0003] In view of the above problems, the present application proposes a memory management method, device, electronic device and storage medium to solve the above problems.
[0004] In a first aspect, an embodiment of the present application provides a memory management method applied to an electronic device, the method comprising: when memory management of the electronic device is performed through a target memory exchange strategy, determining an indicator to be evaluated that is used to reflect the performance of the target memory exchange strategy, wherein the indicator to be evaluated includes one or a combination of several of a memory recovery ratio, a memory recovery error rate, and a memory recovery efficiency; calculating an evaluation value corresponding to the indicator to be evaluated; and processing the target memory exchange strategy based on the evaluation value.
[0005] In a second aspect, an embodiment of the present application provides a memory management device, which is applied to an electronic device, and the device includes: a module for determining an indicator to be evaluated, which is used to determine an indicator to be evaluated that is used to reflect the performance of the target memory exchange strategy when the electronic device is managed by the target memory exchange strategy, wherein the indicator to be evaluated includes one or a combination of several of the following: a memory recovery ratio, a memory recovery error rate, and a memory recovery efficiency; an evaluation value calculation module, which is used to calculate an evaluation value corresponding to the indicator to be evaluated; and a memory management module, which is used to process the target memory exchange strategy based on the evaluation value.
[0006] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory is coupled to the processor, the memory stores instructions, and when the instructions are executed by the processor, the processor executes the above method.
[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a program code is stored, and the program code can be called by a processor to execute the above method.
[0008] The memory management method, device, electronic device and storage medium provided in the embodiments of the present application, when the memory of the electronic device is managed through a target memory exchange strategy, determine an indicator to be evaluated that is used to reflect the performance of the target memory exchange strategy, wherein the indicator to be evaluated includes one or a combination of memory recovery ratio, memory recovery error rate and memory recovery efficiency, calculates an evaluation value corresponding to the indicator to be evaluated, and processes the target memory exchange strategy based on the evaluation value, so as to perform performance evaluation of the memory exchange strategy through the memory recovery ratio, memory recovery error rate and / or memory recovery efficiency, so that the evaluation result can be more comprehensive and accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] 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 application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0010] Figure 1 A schematic diagram of a memory management method according to an embodiment of the present application is shown;
[0011] Figure 2 A schematic diagram of a memory management method according to an embodiment of the present application is shown;
[0012] Figure 3 A schematic diagram of a memory management method according to an embodiment of the present application is shown;
[0013] Figure 4 A schematic diagram of a memory management method according to an embodiment of the present application is shown;
[0014] Figure 5 A schematic diagram of a memory management method according to an embodiment of the present application is shown;
[0015] Figure 6 A schematic diagram of a memory management method according to an embodiment of the present application is shown;
[0016] Figure 7 A schematic diagram of a memory management method according to an embodiment of the present application is shown;
[0017] Figure 8 A schematic diagram of a memory management method according to an embodiment of the present application is shown;
[0018] Fig. 9 A module block diagram of a memory management device provided by an embodiment of the present application is shown;
[0019] Fig.10A block diagram of an electronic device according to an embodiment of the present application for executing a memory management method according to an embodiment of the present application is shown;
[0020] Fig.11 A storage unit for storing or carrying program codes for implementing a memory management method according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0022] At present, the evaluation of virtual memory page management strategy (memory swap strategy) is usually based on the following key indicators:
[0023] First, the Page Fault Rate: This is the most direct indicator. When a page fault occurs, the operating system of the electronic device must read the page from the hard disk into the memory, which is a costly operation. The lower the page fault rate, the better the performance of the memory swap strategy is usually.
[0024] Second, hit rate: This refers to the probability that the required page is already in memory when a page is referenced. The higher the hit rate, the better the performance of the memory swap strategy is generally.
[0025] Third, memory utilization: A high memory utilization rate means that the operating system of the electronic device effectively utilizes the available memory. If the memory utilization rate is low, memory resources may be wasted.
[0026] Fourth, execution time: For some specific workloads, the total execution time to complete the work can be measured to evaluate the performance of the memory swap strategy.
[0027] Fifth, fairness: In some cases, you may want to ensure that all processes have fair access to memory resources. For example, if a process often causes page faults due to its memory swap strategy, while another process can remain in memory, it may cause unfairness.
[0028] The way to evaluate these indicators is usually to run them through simulation or real system, and then measure and count the above indicators.
[0029] However, the inventors have found through research that the traditional page fault rate as an evaluation criterion may not truly reflect the system performance, especially when page faults mainly occur in I / O intensive background tasks. The hit rate may be misleading. For example, some policies may cause certain pages to reside in memory for a long time, which improves the hit rate, but in fact the usage rate of these pages is not high, which may lead to a waste of memory resources. High memory utilization is not always a good thing, especially when it leads to a higher page fault rate. In addition, excessive memory utilization may cause the system to be slow to respond to new memory requirements. Although fairness is an important indicator, it is difficult to quantify and may be interpreted differently in different environments. For example, some environments may focus more on overall performance rather than fairness.
[0030] In view of the above problems, the inventors have discovered after long-term research and proposed the memory management method, device, electronic device and storage medium provided in the embodiments of the present application. The performance evaluation of the memory exchange strategy is performed by memory recovery ratio, memory recovery error rate and / or memory recovery efficiency, which can make the evaluation results more comprehensive and accurate. Among them, the specific memory management method is described in detail in the subsequent embodiments.
[0031] See also Figure 1 , Figure 1 The flowchart of the memory management method provided by an embodiment of the present application is shown. The method is used to evaluate the performance of the memory exchange strategy by using the memory recovery ratio, memory recovery error rate and / or memory recovery efficiency, which can make the evaluation result more comprehensive and accurate. In a specific embodiment, the memory management method is applied to Fig. 9 The memory management device 200 and the electronic device 100 ( Fig.10 ). The following will take an electronic device as an example to illustrate the specific process of this embodiment. Of course, it can be understood that the electronic device used in this embodiment may include a smart phone, a tablet computer, a wearable electronic device, etc., which is not limited here. Figure 1 The process shown is described in detail, and the memory management method may specifically include the following steps:
[0032] Step S110: When the memory of the electronic device is managed by a target memory swap strategy, determine an indicator to be evaluated that reflects the performance of the target memory swap strategy, wherein the indicator to be evaluated includes one or a combination of memory recovery ratio, memory recovery error rate, and memory recovery efficiency.
[0033] Optionally, the electronic device may pre-set and store multiple memory exchange strategies, wherein the multiple memory exchange strategies can all be used to perform memory management on the electronic device, wherein the memory exchange strategy may include Swap. As a method, the multiple memory exchange strategies each correspond to different strategies, for example, the strategy corresponding to one of the multiple memory exchange strategies is "triggering memory page replacement according to the running state of the application running on the electronic device", and the strategy corresponding to one of the multiple memory exchange strategies is "triggering memory page replacement according to the running parameters of the electronic device", etc., which are not limited here.
[0034] In this embodiment, the electronic device can select a target memory exchange strategy from multiple memory exchange strategies, and perform memory management on the electronic device through the target memory exchange strategy. Based on this, when the electronic device is managed through the target memory exchange strategy, an evaluation indicator to be used to reflect the performance of the target memory exchange strategy can be determined. Optionally, the target memory exchange strategy can be any one of the multiple memory exchange strategies.
[0035] In some embodiments, the electronic device may randomly select a memory exchange strategy from multiple memory exchange strategies as a target memory exchange strategy; the electronic device may select a memory exchange strategy from multiple memory exchange strategies in ascending order as a target memory exchange strategy; the electronic device may select a memory exchange strategy from multiple memory exchange strategies in descending order as a target memory exchange strategy; the electronic device may select a memory exchange strategy from multiple memory exchange strategies as a target memory exchange strategy according to an input selection instruction, etc., which are not limited here.
[0036] In some embodiments, the electronic device may be pre-set with an indicator to be evaluated that is used to reflect the performance of the target memory exchange policy. Therefore, when the electronic device is memory managed by the target memory exchange policy, the indicator to be evaluated that is used to reflect the performance of the target memory exchange policy may be obtained from the local of the electronic device. Optionally, in addition to being used to reflect the performance of the target memory exchange policy, the indicator to be evaluated may also be used to reflect other memory exchange policies other than the target memory exchange policy among multiple memory exchange policies, which is not limited here.
[0037] As an implementable manner, the electronic device may be pre-set with only the indicator to be evaluated, and when the memory of the electronic device is managed by the target memory exchange strategy, the indicator to be evaluated may be directly obtained from the local of the electronic device. As another implementable manner, the electronic device may be pre-set with multiple evaluation indicators including the indicator to be evaluated, and when the memory of the electronic device is managed by the target memory exchange strategy, the indicator to be evaluated may be screened out from the multiple evaluation indicators.
[0038] In some implementations, the indicator to be evaluated may include one or a combination of a memory recycling ratio, a memory recycling error rate, and a memory recycling efficiency. The memory recycling ratio may be used to evaluate the overall recycling capability of the target memory swap strategy, the memory recycling error rate may be used to evaluate the error rate of the target memory swap strategy, and the memory recycling efficiency may be used to measure the recycling efficiency of the target memory swap strategy.
[0039] Optionally, the higher the evaluation value corresponding to the memory recovery ratio under the target memory swap policy, the better the effect of the memory swap policy, and the lower the evaluation value corresponding to the memory recovery ratio under the target memory swap policy, the worse the effect of the memory swap policy; the higher the evaluation value corresponding to the memory recovery efficiency under the target memory swap policy, the better the effect of the memory swap policy, and the lower the evaluation value corresponding to the memory recovery efficiency under the target memory swap policy, the worse the effect of the memory swap policy; the higher the evaluation value corresponding to the memory recovery error rate under the target memory swap policy, the worse the effect of the memory swap policy, and the lower the evaluation value corresponding to the memory recovery error rate under the target memory swap policy, the better the effect of the memory swap policy.
[0040] Step S120: Calculate the evaluation value corresponding to the indicator to be evaluated.
[0041] In this embodiment, when the indicator to be evaluated is determined, the evaluation value corresponding to the indicator to be evaluated can be calculated.
[0042] As a method, the electronic device may be pre-set and store a target evaluation value calculation algorithm. When the indicator to be evaluated is determined, the evaluation value corresponding to the indicator to be evaluated may be calculated by the target evaluation value calculation algorithm.
[0043] As another way, the electronic device may be pre-set and store multiple evaluation value calculation algorithms. When determining the indicator to be evaluated, the target evaluation value calculation algorithm may be determined from the multiple evaluation value calculation algorithms based on the indicator to be evaluated, and the evaluation value corresponding to the indicator to be evaluated may be calculated by the target evaluation value calculation algorithm. Optionally, determining the target evaluation value calculation algorithm from the multiple evaluation value calculation algorithms based on the indicator to be evaluated may include: determining the target evaluation value calculation algorithm from the multiple evaluation value calculation algorithms based on the type of the indicator to be evaluated; determining the target evaluation value calculation algorithm from the multiple evaluation value calculation algorithms based on the number of indicators to be evaluated, etc., which is not limited here.
[0044] In some implementations, if the number of indicators to be evaluated is one (such as a memory recovery ratio), the evaluation value corresponding to the one indicator to be evaluated can be calculated, and the evaluation value corresponding to the one indicator to be evaluated can be determined as the evaluation value corresponding to the indicator to be evaluated. If the number of indicators to be evaluated is multiple (such as including a memory recovery ratio, a memory recovery error rate, and a memory recovery efficiency), the evaluation values corresponding to each of the multiple indicators to be evaluated can be calculated respectively, and the evaluation value corresponding to the indicator to be evaluated can be determined based on the evaluation values corresponding to each of the multiple indicators to be evaluated.
[0045] As an implementable method, determining the evaluation value corresponding to the indicator to be evaluated based on the evaluation values corresponding to each of the multiple indicators to be evaluated may include: summing the evaluation values corresponding to each of the multiple indicators to be evaluated to obtain the evaluation value corresponding to the indicator to be evaluated; taking a weighted sum of the evaluation values corresponding to each of the multiple indicators to be evaluated to obtain the evaluation value corresponding to the indicator to be evaluated; averaging the evaluation values corresponding to each of the multiple indicators to be evaluated to obtain the evaluation value corresponding to the indicator to be evaluated, etc., without limitation herein.
[0046] Step S130: Based on the evaluation value, the target memory swap policy is processed.
[0047] In this embodiment, when the evaluation value corresponding to the indicator to be evaluated is obtained, the target memory swap policy can be processed based on the evaluation value.
[0048] In some embodiments, processing the target memory swap strategy based on the evaluation value may include: based on the evaluation value, increasing the probability that the target memory swap strategy is selected; based on the evaluation value, decreasing the probability that the target memory swap strategy is selected; based on the evaluation value, increasing the score of the target memory swap strategy; based on the evaluation value, decreasing the score of the target memory swap strategy; based on the evaluation value, maintaining the use of the target memory swap strategy; based on the evaluation value, stopping the use of the target memory swap strategy, etc., without limitation herein.
[0049] A memory management method provided in an embodiment of the present application determines an indicator to be evaluated that is used to reflect the performance of a target memory exchange strategy when memory management is performed on an electronic device through a target memory exchange strategy, wherein the indicator to be evaluated includes one or a combination of memory recovery ratio, memory recovery error rate, and memory recovery efficiency, calculates an evaluation value corresponding to the indicator to be evaluated, and processes the target memory exchange strategy based on the evaluation value, thereby performing a performance evaluation of the memory exchange strategy through the memory recovery ratio, memory recovery error rate, and / or memory recovery efficiency, which can make the evaluation result more comprehensive and accurate.
[0050] See also Figure 2 , Figure 2The flowchart of the memory management method provided by an embodiment of the present application is shown in FIG. Figure 2 The process shown is described in detail, and the method may specifically include the following steps:
[0051] Step S210: When the memory of the electronic device is managed by a target memory swap strategy, determine an indicator to be evaluated that reflects the performance of the target memory swap strategy, wherein the indicator to be evaluated includes one or a combination of several of a memory recovery ratio, a memory recovery error rate, and a memory recovery efficiency.
[0052] Step S220: Calculate the evaluation value corresponding to the indicator to be evaluated.
[0053] For the detailed description of step S210 to step S220, please refer to step S110 to step S120, which will not be repeated here.
[0054] Step S230: If the evaluation value is equal to or higher than the evaluation threshold, the memory management of the electronic device is continued through the target memory swap strategy.
[0055] In some embodiments, the electronic device may be pre-set and stored with an evaluation threshold, wherein the evaluation threshold is used as a basis for judging the evaluation value corresponding to the indicator to be evaluated. Therefore, in this embodiment, when the evaluation value corresponding to the indicator to be evaluated is obtained, the evaluation value may be compared with the evaluation threshold to determine the size relationship between the evaluation value and the evaluation threshold. Optionally, the evaluation value may be lower than the evaluation threshold, may be equal to the evaluation threshold, or may be higher than the evaluation threshold. Among them, if the evaluation value is equal to or higher than the evaluation threshold, it can be determined that the indicator to be evaluated corresponding to the memory management of the electronic device through the target memory exchange strategy is higher, indicating that the effect of memory management of the electronic device through the target memory exchange strategy is better; if the evaluation value is lower than the evaluation threshold, it can be determined that the evaluation value corresponding to the memory management of the electronic device through the target memory exchange strategy is lower, indicating that the effect of memory management of the electronic device through the target memory exchange strategy is poor.
[0056] As an implementable manner, if the evaluation value is equal to or higher than the evaluation threshold, the memory management of the electronic device can be maintained through the target memory exchange strategy, so that better memory management of the electronic device can be achieved. Optionally, if the evaluation value is equal to or higher than the evaluation threshold, the probability of the target memory exchange strategy being selected can also be increased, for example, the priority of the target memory exchange strategy can be increased, the target memory exchange strategy can be marked, etc., which are not limited here.
[0057] Step S240: If the evaluation value is lower than the evaluation threshold, an alternative memory exchange strategy is selected from multiple memory exchange strategies, and memory management of the electronic device is performed using the alternative memory exchange strategy, wherein the evaluation value corresponding to the alternative memory exchange strategy is greater than the evaluation value corresponding to the target memory exchange strategy.
[0058] As an implementable method, if the evaluation value is lower than the evaluation threshold, a memory exchange strategy with a corresponding evaluation value greater than the evaluation value corresponding to the target memory exchange strategy can be selected from multiple memory exchange strategies as an alternative memory exchange strategy, and the memory of the electronic device is managed through the alternative memory exchange strategy, that is, the memory management of the electronic device is switched from the target memory exchange strategy to the alternative memory exchange strategy. Based on this, the memory management of the electronic device by replacing the memory exchange strategy with a higher evaluation value can effectively improve the memory management effect of the electronic device.
[0059] Optionally, if there is only one memory exchange policy among multiple memory exchange policies whose corresponding evaluation value is greater than the evaluation value corresponding to the target memory exchange policy, then the one memory exchange policy can be determined as the replacement memory exchange policy; if there are multiple memory exchange policies whose corresponding evaluation values are greater than the evaluation value corresponding to the target memory exchange policy, then the memory exchange policy with the highest corresponding evaluation value can be determined from the multiple memory exchange policies as the replacement memory exchange policy; if there are multiple memory exchange policies whose corresponding evaluation values are greater than the evaluation value corresponding to the target memory exchange policy, then the memory exchange policy with the highest priority can be determined from the multiple memory exchange policies as the replacement memory exchange policy.
[0060] Step S250: If the evaluation value is lower than the evaluation threshold, the memory exchange parameters of the target memory exchange policy are changed to obtain a changed memory exchange policy, and memory management of the electronic device is performed through the changed memory exchange policy.
[0061] As an implementable method, if the evaluation value is lower than the evaluation threshold, the memory exchange parameters of the target memory exchange strategy can be changed to obtain the changed memory exchange strategy, and the memory of the electronic device is managed by the changed memory exchange strategy. Based on this, by changing the memory exchange parameters of the memory exchange strategy, an attempt can be made to improve the memory management effect of the electronic device.
[0062] Optionally, changing the memory swap parameters of the target memory swap policy may include: changing the triggering condition of the memory swap policy; changing the memory swap size corresponding to the memory swap policy; changing the memory swap time corresponding to the memory swap policy, etc., which are not limited here.
[0063] Compared with the memory management method provided in one embodiment of the present application, Figure 1 The memory management method shown in this embodiment also maintains memory management of the electronic device through the target memory exchange strategy when the evaluation value is equal to or higher than the evaluation threshold, or, when the evaluation value is lower than the evaluation threshold, selects an alternative memory exchange strategy with a higher evaluation value from multiple memory exchange strategies, and manages the memory of the electronic device through the alternative memory exchange strategy, or, when the evaluation value is lower than the evaluation threshold, changes the memory exchange parameters of the target memory exchange strategy to obtain a changed memory exchange strategy, and manages the memory of the electronic device through the changed memory exchange strategy, so that different processing methods for the target memory exchange strategy can be determined according to different sizes of the evaluation value, which can improve the memory utilization efficiency and overall performance of the electronic device.
[0064] See also Figure 3 , Figure 3 The flowchart of the memory management method provided by an embodiment of the present application is shown in FIG. Figure 3 The process shown is described in detail, and the memory management method may specifically include the following steps:
[0065] Step S310: when the memory of the electronic device is managed by a target memory swap strategy, determining an indicator to be evaluated that reflects the performance of the target memory swap strategy, wherein the indicator to be evaluated includes a memory recovery ratio.
[0066] The specific description of step S310 can be found in step S110 , which will not be repeated here.
[0067] Step S320: Determine a first number of memory pages that are swapped from the memory of the electronic device to the hard disk of the electronic device during the management period indicated by the target memory swap policy.
[0068] In this embodiment, the indicator to be evaluated includes a memory recovery ratio. Optionally, the memory recovery ratio can be used to evaluate the overall recovery capability of the memory swap strategy, which can be calculated by dividing the number of recovered pages by the number of all pages in the memory. In practice, the number of all pages in the memory is an instantaneous value, which can be taken as the value at the end of a round of operations.
[0069] In some embodiments, the memory exchange policy may be provided with a management period (i.e., a round of operation), wherein the management period may set the duration of application program operation, the number of times the application program is run, the number of times the application program is clicked, etc., which are not limited here. Based on this, when the memory of the electronic device is managed by the target memory exchange policy, the number of memory pages replaced from the memory of the electronic device to the hard disk of the electronic device during the management period indicated by the target memory exchange policy may be determined as the first number.
[0070] Step S330: Determine a second number of memory pages corresponding to the remaining memory pages in the memory of the electronic device at the end of the management period indicated by the target memory swap policy.
[0071] In some embodiments, when memory management is performed on an electronic device through a target memory exchange policy, the number of memory pages remaining in the memory of the electronic device at the end of the management period indicated by the target memory exchange policy (the end of a round of operations) can be determined as the second number.
[0072] Step S340: Calculate the evaluation value corresponding to the memory recovery ratio based on the first number and the second number.
[0073] In some implementations, when the first number and the second number are obtained, the evaluation value corresponding to the memory recovery ratio can be calculated based on the first number and the second number. Optionally, the evaluation value corresponding to the memory recovery ratio can be calculated by dividing the first number by the second number.
[0074] Step S350: Based on the evaluation value, the target memory swap policy is processed.
[0075] For the detailed description of step S350, please refer to step S130, which will not be repeated here.
[0076] Compared with the memory management method provided in one embodiment of the present application, Figure 1 The memory management method shown in this embodiment also determines a first number corresponding to memory pages replaced from the memory of the electronic device to the hard disk of the electronic device during the management period indicated by the target memory exchange policy, determines a second number corresponding to memory pages remaining in the memory of the electronic device at the end of the management period indicated by the target memory exchange policy, and calculates an evaluation value corresponding to the memory recovery ratio based on the first number and the second number, thereby improving the accuracy of the evaluation of the memory management policy.
[0077] See also Figure 4 , Figure 4 The flowchart of the memory management method provided by an embodiment of the present application is shown in FIG. Figure 4The process shown is described in detail, and the memory management method may specifically include the following steps:
[0078] Step S410: when the memory of the electronic device is managed by a target memory swap strategy, determining an indicator to be evaluated that reflects the performance of the target memory swap strategy, wherein the indicator to be evaluated includes a memory recovery error rate.
[0079] For the detailed description of step S410, please refer to step S110, which will not be repeated here.
[0080] Step S420: Determine a third quantity corresponding to error pages generated by the electronic device during the management period indicated by the target memory swap policy.
[0081] In this embodiment, the indicator to be evaluated includes a memory recovery error rate. Optionally, the memory recovery error rate can be used to evaluate the error rate of the memory swap strategy, which can be calculated by dividing the cumulative error page increment by the number of all pages in the memory. In practice, the cumulative error page refers to the error page that has accumulated since the start of the test, and the number of all pages in the memory is an instantaneous value, which can be taken as the value at the end of a round of operations.
[0082] In some embodiments, the memory swap policy may be provided with a management period (i.e., a round of operation). Based on this, when the memory of the electronic device is managed by the target memory swap policy, the number of error pages generated by the electronic device during the management period indicated by the target memory swap policy may be determined as the third number.
[0083] Step S430: Determine a fourth number corresponding to the memory pages remaining in the memory of the electronic device at the end of the management period indicated by the target memory swap policy.
[0084] In some embodiments, when memory management is performed on an electronic device through a target memory exchange policy, the number of memory pages remaining in the memory of the electronic device at the end of the management period indicated by the target memory exchange policy (the end of a round of operations) can be determined as a fourth number.
[0085] Step S440: Calculate an evaluation value corresponding to the memory recovery error rate based on the third number and the fourth number.
[0086] In some implementations, when the third number and the fourth number are obtained, the evaluation value corresponding to the memory recovery error rate can be calculated based on the third number and the fourth number. Optionally, the evaluation value corresponding to the memory recovery error rate can be calculated by dividing the third number by the fourth number.
[0087] Step S450: Based on the evaluation value, the target memory swap policy is processed.
[0088] For the detailed description of step S450, please refer to step S130, which will not be repeated here.
[0089] Compared with the memory management method provided in one embodiment of the present application, Figure 1 The memory management method shown in this embodiment also determines a third number corresponding to error pages generated by the electronic device during the management period indicated by the target memory exchange policy, determines a fourth number corresponding to memory pages remaining in the memory of the electronic device at the end of the management period indicated by the target memory exchange policy, and calculates an evaluation value corresponding to the memory recovery error rate based on the third number and the fourth number, thereby improving the accuracy of the evaluation of the memory management policy.
[0090] See also Figure 5 , Figure 5 The flowchart of the memory management method provided by an embodiment of the present application is shown in FIG. Figure 5 The process shown is described in detail, and the memory management method may specifically include the following steps:
[0091] Step S510: when the memory of the electronic device is managed by a target memory swap strategy, determining an indicator to be evaluated that reflects the performance of the target memory swap strategy, wherein the indicator to be evaluated includes memory recycling efficiency.
[0092] For the detailed description of step S510, please refer to step S110, which will not be repeated here.
[0093] Step S520: Determine a fifth number corresponding to memory pages that are replaced from the memory of the electronic device to the hard disk of the electronic device during the management period indicated by the target memory swap policy.
[0094] In this embodiment, the indicator to be evaluated includes memory recycling efficiency. Optionally, the memory recycling efficiency can be used to evaluate the memory recycling of the memory swap strategy. The higher the memory recycling efficiency, the more benefits can be obtained from replacing pages with the minimum error page cost, which can be calculated by dividing the number of recycled pages by the cumulative error page increment.
[0095] In some embodiments, the memory swap policy may be provided with a management period (i.e., a round of operation). Based on this, when the memory of the electronic device is managed by the target memory swap policy, the number of memory pages swapped from the memory of the electronic device to the hard disk of the electronic device during the management period indicated by the target memory swap policy may be determined as the fifth number.
[0096] Step S530: Determine a sixth quantity corresponding to error pages generated by the electronic device during the management period indicated by the target memory swap policy.
[0097] In some implementations, when memory management is performed on an electronic device using a target memory swap policy, the number of error pages generated by the electronic device during a management period indicated by the target memory swap policy may be determined as a sixth number.
[0098] Step S540: Calculate the evaluation value corresponding to the memory recycling efficiency based on the fifth number and the sixth number.
[0099] In some implementations, when the fifth number and the sixth number are obtained, the evaluation value corresponding to the memory recycling efficiency can be calculated based on the fifth number and the sixth number. Optionally, the evaluation value corresponding to the memory recycling efficiency can be calculated by dividing the fifth number by the sixth number.
[0100] Step S550: Based on the evaluation value, the target memory swap policy is processed.
[0101] For the detailed description of step S550, please refer to step S130, which will not be repeated here.
[0102] Compared with the memory management method provided in one embodiment of the present application, Figure 1 The memory management method shown in this embodiment also determines a fifth number corresponding to memory pages replaced from the memory of the electronic device to the hard disk of the electronic device during the management period indicated by the target memory exchange policy, and determines a sixth number corresponding to error pages generated by the electronic device during the management period indicated by the target memory exchange policy, and calculates an evaluation value corresponding to the memory recovery efficiency based on the fifth number and the sixth number, thereby improving the accuracy of the evaluation of the memory management policy.
[0103] See also Figure 6 , Figure 6 The flowchart of the memory management method provided by an embodiment of the present application is shown. The method is applied to the above-mentioned electronic device. In this embodiment, the memory of the electronic device includes multiple memory groups, and the target memory exchange strategy is used to manage the memory of the multiple memory groups respectively. Figure 6 The process shown is described in detail, and the memory management method may specifically include the following steps:
[0104] Step S610: When the memory of the electronic device is managed by a target memory swap strategy, determine an indicator to be evaluated that reflects the performance of the target memory swap strategy, wherein the indicator to be evaluated includes one or a combination of memory recovery ratio, memory recovery error rate, and memory recovery efficiency.
[0105] Step S620: Calculate the evaluation value corresponding to the indicator to be evaluated.
[0106] For the detailed description of step S610 to step S620, please refer to step S110 to step S120, which will not be repeated here.
[0107] Step S630: obtaining an evaluation value corresponding to each memory group of the plurality of memory groups of the indicator to be evaluated.
[0108] In this embodiment, the memory of the electronic device includes multiple memory groups (such as the memcg memory group in Linux, where the LRU linked list is managed in units of memory groups, that is, the smallest unit for the memory swap policy to take effect), wherein each of the multiple memory groups may include one or more processes.
[0109] In some implementations, the multiple memory groups may be divided according to the process names included therein, may be divided according to the types of processes included therein, may be divided according to the number of processes included therein, etc., which are not limited here.
[0110] In this embodiment, the target memory exchange strategy is used to perform memory management on multiple memory groups respectively. Based on this, the indicators to be evaluated (one or a combination of memory recovery ratio, memory recovery error rate and memory recovery efficiency) can be set for the multiple memory groups respectively. When the target memory exchange strategy is used to perform memory management on the multiple memory groups respectively, the evaluation value corresponding to each memory group in the multiple memory groups can be obtained.
[0111] Step S640: Based on the evaluation value corresponding to each memory group, determine the overall evaluation value corresponding to the indicator to be evaluated.
[0112] In this embodiment, when the evaluation value corresponding to each memory group is obtained, the overall evaluation value corresponding to the indicator to be evaluated can be determined based on the evaluation value corresponding to each memory group. Optionally, when the evaluation value corresponding to each memory group is obtained, the evaluation value corresponding to each memory group can be summed to obtain the overall evaluation value corresponding to the indicator to be evaluated; or, when the evaluation value corresponding to each memory group is obtained, the evaluation value corresponding to each memory group can be weighted and summed to obtain the overall evaluation value corresponding to the indicator to be evaluated.
[0113] Step S650: Based on the overall evaluation value, the target memory swap strategy is processed.
[0114] In this embodiment, when the overall evaluation value corresponding to the indicator to be evaluated is obtained, the target memory swap strategy can be processed based on the overall evaluation value.
[0115] Compared with the memory management method provided in one embodiment of the present application, Figure 1 The memory management method shown in this embodiment sets the memory of the electronic device to include multiple memory groups, and the target memory exchange strategy is used to perform memory management on the multiple memory groups respectively, and obtain the evaluation value corresponding to the indicator to be evaluated in each memory group, based on the evaluation value corresponding to each memory group, determine the overall evaluation value corresponding to the indicator to be evaluated, and based on the overall evaluation value, process the target memory exchange strategy, so that the overall performance of memory management can be improved by refining the memory management.
[0116] See also Figure 7 , Figure 7 The flowchart of the memory management method provided by an embodiment of the present application is shown in FIG. Figure 7 The process shown is described in detail, and the memory management method may specifically include the following steps:
[0117] Step S710: When the memory of the electronic device is managed by a target memory swap strategy, determine an indicator to be evaluated that reflects the performance of the target memory swap strategy, wherein the indicator to be evaluated includes one or a combination of several of a memory recovery ratio, a memory recovery error rate, and a memory recovery efficiency.
[0118] Step S720: Calculate the evaluation value corresponding to the indicator to be evaluated.
[0119] For the detailed description of step S710 to step S720, please refer to step S110 to step S120, which will not be repeated here.
[0120] Step S730: Determine the application program running on the electronic device.
[0121] In this embodiment, the application programs running on the electronic device may be determined, wherein the application programs running on the electronic device may include application programs running in the foreground of the electronic device and / or application programs running in the background of the electronic device.
[0122] Step S740: Processing the target memory swap policy based on the application and the evaluation value.
[0123] In this embodiment, when the application program running on the electronic device and the evaluation value corresponding to the indicator to be evaluated are determined, the target memory swap strategy can be processed based on the application program and the evaluation value.
[0124] In some embodiments, when determining an application running on an electronic device, the running memory requirement of the application can be determined, and the target memory exchange strategy can be processed based on the running memory requirement and the evaluation value. For example, if the running memory requirement of the application is large, and the evaluation value corresponding to the memory exchange efficiency under the target memory exchange strategy is low, it can be switched to perform memory management on the electronic device through an alternative memory exchange strategy; if the running memory requirement of the application is low, and the evaluation value corresponding to the memory exchange efficiency under the target memory exchange strategy is low, it can continue to perform memory management on the electronic device through the target memory exchange strategy.
[0125] Compared with the memory management method provided in one embodiment of the present application, Figure 1 The memory management method shown in this embodiment also determines the application running on the electronic device, and processes the target memory exchange strategy based on the application and the evaluation value, so that the processing can be adapted to the running application and the running effect of the application can be improved.
[0126] See also Figure 8 , Figure 8 The flowchart of the memory management method provided by an embodiment of the present application is shown in FIG. Figure 8 The process shown is described in detail, and the memory management method may specifically include the following steps:
[0127] Step S810: When the memory of the electronic device is managed by a target memory swap strategy, determine an indicator to be evaluated that reflects the performance of the target memory swap strategy, wherein the indicator to be evaluated includes one or a combination of several of a memory recovery ratio, a memory recovery error rate, and a memory recovery efficiency.
[0128] Step S820: Calculate the evaluation value corresponding to the indicator to be evaluated.
[0129] For the detailed description of step S810 to step S820, please refer to step S110 to step S120, which will not be repeated here.
[0130] Step S830: Determine the operating parameters of the electronic device.
[0131] In this embodiment, the operating parameters of the electronic device may be determined, wherein the operating parameters of the electronic device may include: the remaining power of the electronic device, the memory occupancy rate of the electronic device, the processor occupancy rate of the electronic device, the running smoothness of the electronic device, the number of freezes of the electronic device, and the freeze rate of the electronic device, or a combination of the above.
[0132] Step S840: Based on the operating parameters and the evaluation value, the target memory swap policy is processed.
[0133] In this embodiment, when the operating parameters of the electronic device and the evaluation values corresponding to the indicators to be evaluated are determined, the target memory swap strategy can be processed based on the operating parameters and the evaluation values.
[0134] For example, if the operating parameters indicate that the remaining power of the electronic device is insufficient, and the evaluation value corresponding to the memory exchange efficiency under the target memory exchange strategy is low, then the memory management of the electronic device can be continued through the target memory exchange strategy to extend the usage time of the electronic device; if the operating parameters indicate that the remaining power of the electronic device is sufficient, and the evaluation value corresponding to the memory exchange efficiency under the target memory exchange strategy is low, then it can be switched to memory management of the electronic device through an alternative memory exchange strategy to improve the memory management effect of the electronic device.
[0135] Compared with the memory management method provided in one embodiment of the present application, Figure 1 The memory management method shown in this embodiment also determines the operating parameters of the electronic device, and processes the target memory exchange strategy based on the operating parameters and the evaluation value, so that the processing can adapt to the operating parameters of the electronic device, which can improve the operating effect of the electronic device.
[0136] It can be understood that the memory management method provided in this embodiment can provide operating system kernel developers with more accurate memory swap strategy evaluation; can provide optimization references for developers of virtual memory managers, thereby improving memory management efficiency; can be applied to load balancing research and optimization to improve the system's concurrent processing capabilities; can be applied to computer system performance evaluation to provide more accurate memory management performance indicators for evaluation.
[0137] See also Fig. 9 , Fig. 9 The module block diagram of the memory management device provided by an embodiment of the present application is shown. The memory management device 200 is applied to the above electronic device. Fig. 9 The block diagram shown in the figure is used to illustrate that the memory management device 200 includes: a module for determining an indicator to be evaluated 210, an evaluation value calculation module 220 and a memory management module 230, wherein:
[0138] The module 210 for determining the indicator to be evaluated is used to determine the indicator to be evaluated that is used to reflect the performance of the target memory exchange strategy when the electronic device is managed by the target memory exchange strategy, wherein the indicator to be evaluated includes one or a combination of several of the memory recovery ratio, the memory recovery error rate and the memory recovery efficiency.
[0139] The evaluation value calculation module 220 is used to calculate the evaluation value corresponding to the indicator to be evaluated.
[0140] Further, when the indicator to be evaluated includes the memory recovery ratio, the evaluation value calculation module 220 includes: a first quantity determination submodule, a second quantity determination submodule and a first evaluation value calculation submodule, wherein:
[0141] The first quantity determination submodule is used to determine a first quantity corresponding to memory pages replaced from the memory of the electronic device to the hard disk of the electronic device within the management period indicated by the target memory exchange policy.
[0142] The second quantity determination submodule is used to determine a second quantity corresponding to the remaining memory pages in the memory of the electronic device at the end of the management period indicated by the target memory exchange policy.
[0143] The first evaluation value calculation submodule is used to calculate the evaluation value corresponding to the memory recovery ratio based on the first number and the second number.
[0144] Further, when the indicator to be evaluated includes the memory recovery error rate, the evaluation value calculation module 220 includes: a third quantity determination submodule, a fourth quantity determination submodule and a second evaluation value calculation submodule, wherein:
[0145] The third quantity determination submodule is used to determine a third quantity corresponding to the error pages generated by the electronic device during the management period indicated by the target memory exchange policy.
[0146] The fourth quantity determination submodule is used to determine a fourth quantity corresponding to the memory pages remaining in the memory of the electronic device at the end of the management period indicated by the target memory exchange policy.
[0147] The second evaluation value calculation submodule is used to calculate the evaluation value corresponding to the memory recovery error rate based on the third number and the fourth number.
[0148] Further, when the indicator to be evaluated includes the memory recycling efficiency, the evaluation value calculation module 220 includes: a fifth quantity determination submodule, a sixth quantity determination submodule and a third evaluation value calculation submodule, wherein:
[0149] The fifth quantity determination submodule is used to determine a fifth quantity corresponding to the memory pages replaced from the memory of the electronic device to the hard disk of the electronic device within the management period indicated by the target memory exchange policy.
[0150] The sixth quantity determination submodule is used to determine a sixth quantity corresponding to the error pages generated by the electronic device during the management period indicated by the target memory exchange policy.
[0151] The third evaluation value calculation submodule is used to calculate the evaluation value corresponding to the memory recycling efficiency based on the fifth number and the sixth number.
[0152] The memory management module 230 is used to process the target memory swap policy based on the evaluation value.
[0153] Furthermore, the memory management module 230 includes: a first memory management submodule, a second memory management submodule and a third memory management submodule, wherein:
[0154] The first memory management submodule is used to keep managing the memory of the electronic device through the target memory exchange strategy if the evaluation value is equal to or higher than the evaluation threshold.
[0155] The second memory management submodule is used to select an alternative memory exchange strategy from multiple memory exchange strategies if the evaluation value is lower than the evaluation threshold, and perform memory management on the electronic device through the alternative memory exchange strategy, wherein the evaluation value corresponding to the alternative memory exchange strategy is greater than the evaluation value corresponding to the target memory exchange strategy.
[0156] Furthermore, the second memory management submodule includes: a memory management strategy determination unit and a memory management unit, wherein:
[0157] A memory management strategy determining unit is configured to determine, if the evaluation value is lower than the evaluation threshold, a memory exchange strategy with the highest corresponding evaluation value from the multiple memory exchange strategies as the replacement memory exchange strategy.
[0158] A memory management unit is used to manage the memory of the electronic device through the alternative memory exchange strategy.
[0159] The third memory management submodule is used to change the memory exchange parameters of the target memory exchange strategy to obtain a changed memory exchange strategy if the evaluation value is lower than the evaluation threshold, and perform memory management on the electronic device through the changed memory exchange strategy.
[0160] Further, the memory of the electronic device includes a plurality of memory groups, the target memory exchange strategy is used to perform memory management on the plurality of memory groups respectively, and the memory management module 230 includes: an evaluation value acquisition submodule, an overall evaluation value determination submodule and a fourth memory management submodule, wherein:
[0161] The evaluation value acquisition submodule is used to obtain the evaluation value corresponding to each memory group in the multiple memory groups of the indicator to be evaluated.
[0162] The overall evaluation value determination submodule is used to determine the overall evaluation value corresponding to the indicator to be evaluated based on the evaluation value corresponding to each memory group.
[0163] The fourth memory management submodule is used to process the target memory swap strategy based on the overall evaluation value.
[0164] Furthermore, the memory management module 230 includes: an application determination submodule and a fifth memory management submodule, wherein:
[0165] The application determination submodule is used to determine the application running on the electronic device.
[0166] The fifth memory management submodule is used to process the target memory swap policy based on the application and the evaluation value.
[0167] Furthermore, the memory management module 230 includes: an operation parameter determination submodule and a sixth memory management submodule, wherein:
[0168] The operating parameter determination submodule is used to determine the operating parameters of the electronic device.
[0169] The sixth memory management submodule is used to process the target memory swap strategy based on the operating parameters and the evaluation value.
[0170] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0171] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical or other forms of coupling.
[0172] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0173] See also Fig.10 , which shows a structural block diagram of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may be an electronic device capable of running applications, such as a smart phone, a tablet computer, an e-book, etc. The electronic device 100 in the present application may include one or more of the following components: a processor 110, a memory 120, and one or more applications, wherein the one or more applications may be stored in the memory 120 and configured to be executed by one or more processors 110, and the one or more programs are configured to execute the method described in the aforementioned method embodiment.
[0174] Among them, the processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120. Optionally, the processor 110 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 110 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented separately through a communication chip.
[0175] The memory 120 may include a random access memory (RAM) or a read-only memory (ROM). The memory 120 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing functions (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the electronic device 100 during use.
[0176] See also Fig.11 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 300 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.
[0177] The computer readable storage medium 300 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 300 includes a non-transitory computer-readable storage medium. The computer readable storage medium 300 has storage space for program code 310 that performs any method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code 310 can be compressed, for example, in an appropriate form.
[0178] In summary, the memory management method, device, electronic device and storage medium provided in the embodiments of the present application, when the memory of the electronic device is managed through a target memory exchange strategy, determine the indicators to be evaluated that are used to reflect the performance of the target memory exchange strategy, wherein the indicators to be evaluated include one or a combination of memory recovery ratio, memory recovery error rate and memory recovery efficiency, calculate the evaluation value corresponding to the indicator to be evaluated, and process the target memory exchange strategy based on the evaluation value, so as to perform performance evaluation of the memory exchange strategy through the memory recovery ratio, memory recovery error rate and / or memory recovery efficiency, so that the evaluation result can be more comprehensive and accurate.
[0179] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A memory management method, characterized in that: Applied to electronic equipment, the method comprises: In the case where the electronic device is managed by a target memory swap strategy, determining an indicator to be evaluated that reflects the performance of the target memory swap strategy, wherein the indicator to be evaluated includes one or a combination of memory recycling ratio, memory recycling error rate, and memory recycling efficiency; Calculating the evaluation value corresponding to the indicator to be evaluated; Based on the evaluation value, the target memory swap policy is processed.
2. The method according to claim 1, characterized in that The processing of the target memory swap strategy based on the evaluation value includes: If the evaluation value is equal to or higher than the evaluation threshold, then continue to perform memory management on the electronic device through the target memory swap strategy; or If the evaluation value is lower than the evaluation threshold, selecting an alternative memory exchange strategy from a plurality of memory exchange strategies, and performing memory management on the electronic device by using the alternative memory exchange strategy, wherein the evaluation value corresponding to the alternative memory exchange strategy is greater than the evaluation value corresponding to the target memory exchange strategy; or If the evaluation value is lower than the evaluation threshold, the memory exchange parameter of the target memory exchange policy is changed to obtain a changed memory exchange policy, and the memory of the electronic device is managed by the changed memory exchange policy.
3. The method according to claim 2, characterized in that If the evaluation value is lower than the evaluation threshold, selecting an alternative memory exchange strategy from a plurality of memory exchange strategies, and performing memory management on the electronic device by using the alternative memory exchange strategy, including: If the evaluation value is lower than the evaluation threshold, determining a memory exchange strategy with the highest corresponding evaluation value from the multiple memory exchange strategies as the replacement memory exchange strategy; Memory management is performed on the electronic device through the alternative memory swap strategy.
4. The method according to claim 1, characterized in that When the indicator to be evaluated includes the memory recovery ratio, calculating the evaluation value corresponding to the indicator to be evaluated includes: Determine a first number of memory pages that are swapped from the memory of the electronic device to the hard disk of the electronic device during the management period indicated by the target memory swap policy; determining a second number of memory pages corresponding to remaining memory pages in the memory of the electronic device at the end of the management period indicated by the target memory swap policy; Based on the first number and the second number, an evaluation value corresponding to the memory recovery ratio is calculated.
5. The method according to claim 1, characterized in that When the indicator to be evaluated includes the memory recovery error rate, calculating the evaluation value corresponding to the indicator to be evaluated includes: Determining a third number corresponding to error pages generated by the electronic device during a management period indicated by the target memory swap policy; determining a fourth number of memory pages corresponding to remaining memory pages in the memory of the electronic device at the end of the management period indicated by the target memory swap policy; Based on the third number and the fourth number, an evaluation value corresponding to the memory recovery error rate is calculated.
6. The method according to claim 1, characterized in that When the indicator to be evaluated includes the memory recycling efficiency, calculating the evaluation value corresponding to the indicator to be evaluated includes: determining a fifth number corresponding to memory pages swapped from the memory of the electronic device to the hard disk of the electronic device during the management period indicated by the target memory swap policy; determining a sixth number corresponding to error pages generated by the electronic device during a management period indicated by the target memory swap policy; Based on the fifth number and the sixth number, an evaluation value corresponding to the memory recycling efficiency is calculated.
7. The method according to any one of claims 1 to 6, characterized in that: The memory of the electronic device includes a plurality of memory groups, the target memory exchange strategy is used to perform memory management on the plurality of memory groups respectively, and the processing of the target memory exchange strategy based on the evaluation value includes: Obtaining an evaluation value corresponding to each memory group of the indicator to be evaluated in the multiple memory groups; Based on the evaluation value corresponding to each memory group, determining the overall evaluation value corresponding to the indicator to be evaluated; Based on the overall evaluation value, the target memory swap strategy is processed.
8. The method according to any one of claims 1 to 6, characterized in that: The processing of the target memory swap strategy based on the evaluation value includes: Determining an application program running on the electronic device; The target memory swap policy is processed based on the application and the evaluation value.
9. The method according to any one of claims 1 to 6, characterized in that: The processing of the target memory swap strategy based on the evaluation value includes: determining operating parameters of the electronic device; The target memory swap policy is processed based on the operating parameter and the evaluation value.
10. A memory management device, characterized in that: Applied to electronic equipment, the device comprises: A module for determining an indicator to be evaluated, used to determine an indicator to be evaluated that reflects the performance of the target memory exchange strategy when the electronic device is managed by the target memory exchange strategy, wherein the indicator to be evaluated includes one or a combination of memory recovery ratio, memory recovery error rate and memory recovery efficiency; An evaluation value calculation module, used to calculate the evaluation value corresponding to the indicator to be evaluated; A memory management module is used to process the target memory swap strategy based on the evaluation value.
11. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory is coupled to the processor, the memory stores instructions, and when the instructions are executed by the processor, the processor executes the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 9.
Citation Information
Cited By
Operating system-oriented memory recovery method, device and equipment and storage medium
CN120743798A