A memory optimization method, terminal and computer-readable storage medium
By compressing and sorting data according to the order of use of memory page list in smart terminal devices, only low-use data is stored on embedded multimedia cards, the problems of low-efficiency ZRAM and the impact of memory exchange are solved, and more efficient Memory utilization and extended lifespan of embedded multimedia cards.
Patent Information
- Application Number
- CN201811490217.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-12-06
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2038-12-06
AI Technical Summary
After the existing memory compression technology ZRAM has been used for a long time in the system, the data compressibility of the data is reduced, resulting in limited memory space saving, especially in low-end intelligent terminal devices, and memory switching affects system performance and embedded multimedia cards. service life.
By compressing and sorting data according to the order of use of the memory page list, only compressed data with low usage frequency is stored in embedded multimedia cards, using it as a secondary cache of memory compression technology to reduce system performance and embedded multimedia cards Effects of lifespan.
Improves memory compression efficiency, provides more available memory space, and avoids the negative impact of excessive memory switching on system performance and embedded multimedia card life.
Smart Images

Figure CN111290848B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic technology, and in particular to a memory optimization method, a terminal and a computer-readable storage medium. Background Art
[0002] As Android smart terminals become more and more popular, more and more applications and games are adapted to the Android smart system. However, increasingly powerful applications and games also put forward higher requirements for the hardware resources of Android smart terminals, such as faster central processing units (CPUs) and larger memory capacities. Memory capacity is one of the most critical hardware factors affecting the performance of smart terminals, which is more obvious in the mid- and low-end Android smart terminal groups. As applications and games have higher and higher requirements for system memory, the memory size configured in the terminal system and how the software system can more reasonably use its relatively scarce memory resources will directly affect the user experience of the terminal users.
[0003] Memory compression technology (ZRAM) is a technology currently widely used in Android smart systems. The Linux kernel divides the system's available memory into fixed-size (4096-byte) memory pages, and uses memory pages as the smallest unit to provide memory to applications in the system. Figure 1 As shown, the data of the memory pages that will not be used temporarily in the system but cannot be directly discarded are compressed and stored. When they are needed, they are first decompressed and then provided to the system for use; by using the CPU to perform compression and decompression, the purpose of saving memory space is achieved, so as to provide more available memory for the system. However, the problem with ZRAM is that its specific use efficiency depends on the compression rate of the data contained in the memory page, that is, the effective available memory space that the memory compression technology can provide is the difference between the data size before and after the compression of a specific memory page. After the system has been used for a long time, the compressibility of the data stored in the system memory will be relatively low, that is, the compression rate will be relatively low. In this case, the memory space that the memory compression technology can save for the system will be relatively limited, especially for low-end smartphones with less hardware physical memory configuration and low CPU processing power, the role and efficiency of the memory compression technology ZRAM will be relatively limited. Summary of the invention
[0004] To solve the existing technical problems, the embodiments of the present invention provide a memory optimization method, a terminal and a computer-readable storage medium, which can improve the efficiency of memory compression technology, provide more available memory space, and will not affect system performance due to excessive memory swapping.
[0005] To achieve the above object, the technical solution of the embodiment of the present invention is implemented as follows:
[0006] A memory optimization method, comprising:
[0007] According to the use order of the data stored in the used memory page list in the terminal system memory, the data stored in at least one first memory page in the used memory page list is taken out and compressed and stored in a second memory page;
[0008] Arranging the second memory pages storing the at least one compressed stored data in a usage order of the at least one compressed stored data to generate a compressed memory page list;
[0009] When the number of the second memory pages in the compressed memory page list is greater than a preset threshold, compressed data stored in at least one second memory page in the compressed memory page list is retrieved and stored in the embedded multimedia card.
[0010] A terminal, comprising:
[0011] A processing unit, configured to extract data stored in at least one first memory page in the used memory page list and compress and store the data in a second memory page according to the use order of the data stored in the used memory page list in the terminal system memory;
[0012] A generating unit, configured to generate a compressed memory page list by arranging the second memory pages storing the at least one compressed stored data in a usage order of the at least one compressed stored data;
[0013] The processing unit is further configured to retrieve compressed data stored in at least one second memory page in the compressed memory page list and store it in the embedded multimedia card when the number of second memory pages in the compressed memory page list is greater than a preset threshold.
[0014] A computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the above-mentioned memory optimization method.
[0015] The memory optimization method, terminal and computer-readable storage medium provided by the embodiments of the present invention can extract and compress the data stored in at least one first memory page in the used memory page list and store it in the second memory page according to the usage order of the data stored in the used memory page list in the terminal system memory; arrange the second memory pages storing the at least one compressed stored data according to the usage order of the at least one compressed stored data to generate a compressed memory page list; when the number of second memory pages in the compressed memory page list is greater than a preset threshold, extract and store the compressed data stored in at least one second memory page in the compressed memory page list in the embedded multimedia card. The memory optimization method, terminal and computer-readable storage medium provided by the embodiments of the present invention can use the embedded multimedia card, a permanent storage medium of the terminal system, as a secondary cache of the memory compression technology, and selectively store the data compressed by the memory compression technology in the embedded multimedia card, which can improve the efficiency of memory compression and provide more available memory space, and at the same time will not affect the system performance and the service life of the embedded multimedia card due to excessive memory exchange. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In the accompanying drawings (which are not necessarily drawn to scale), like reference numerals may describe similar components in different views. Like reference numerals with different letter suffixes may represent different examples of similar components. The accompanying drawings generally illustrate various embodiments discussed herein by way of example and not limitation.
[0017] Figure 1 A schematic diagram of the memory compression technology principle provided by an embodiment of the present invention;
[0018] Figure 2 A schematic diagram of the memory swap technology principle provided by an embodiment of the present invention;
[0019] Figure 3 A schematic diagram of a memory optimization method flow chart provided by an embodiment of the present invention;
[0020] Figure 4 An example diagram of data compression storage in memory provided by an embodiment of the present invention;
[0021] Figure 5 An example diagram of storing compressed data in a memory to an embedded multimedia card provided by an embodiment of the present invention;
[0022] Figure 6 An example diagram of reading decompressed data from an embedded multimedia card provided by an embodiment of the present invention;
[0023] Figure 7 Schematic diagram of the terminal structure provided by the embodiment of the present invention Figure 1 ;
[0024] Figure 8 Schematic diagram of the terminal structure provided by the embodiment of the present invention Figure 2 . DETAILED DESCRIPTION
[0025] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0026] It should be noted that the terms "first", "second" and the like in the specification, claims and drawings of the present invention are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0027] Memory swap technology is a technology widely used in Linux systems. Its principle is as follows Figure 2 As shown, the data of the memory page that is not used temporarily but cannot be directly discarded in the running system is exchanged and stored in the permanent storage medium of the system, such as the hard disk, so as to save the memory page for use by other applications of the system; when the system needs to use the memory data that has been exchanged and stored in the hard disk, the data will be read from the hard disk into the memory first, and then used. The disadvantages of memory exchange technology mainly include two aspects. On the one hand, the smartphone uses the embedded multimedia card (eMMC, Embedded Multi Media Card) as its permanent storage medium. The eMMC has a relatively short write life cycle compared to the hard disk. That is to say, if the memory exchange technology is directly used in the Android smartphone, it will seriously affect the service life of the mobile phone; on the other hand, compared with the hard disk of the computer, the read and write speed of the eMMC is relatively slow. The slow write speed means that the system needs to wait longer when exchanging memory pages, which will seriously affect the performance and user experience of the system. Due to the shortcomings of the memory exchange technology itself, it has not been used in smartphone mobile devices running the Android system in actual applications.
[0028] The memory optimization method provided by the embodiment of the present invention sorts the compressed data in the ZRAM in order of use, and only stores a certain proportion of data with relatively low use frequency in the eMMC; and the data stored in the eMMC is compressed, so compared with the traditional memory exchange technology, the read and write operations on the eMMC will be significantly reduced, thereby reducing the impact on system performance and eMMC life.
[0029] An embodiment of the present invention provides a memory optimization method, such as Figure 3 As shown, the method may include:
[0030] Step 101: According to the usage order of data stored in the used memory page list in the terminal system memory, data stored in at least one first memory page in the used memory page list is taken out and compressed and stored in a second memory page.
[0031] Among them, the used memory page list includes: at least one first memory page, and the at least one first memory page is arranged in the order of usage time of data stored in the at least one first memory page, and the first memory page of data storage with a later usage time is arranged before the first memory page of data storage with an earlier usage time.
[0032] The execution subject of the memory optimization method provided in the embodiment of the present invention is a terminal, that is, the terminal takes out the data stored in at least one first memory page in the used memory page list and compresses and stores it in the second memory page according to the usage order of the data stored in the used memory page list in the terminal system memory. The terminal is an intelligent terminal device that can run the Android system.
[0033] Specifically, the kernel of the terminal divides the available memory in the terminal system into memory pages of 4096 bytes, and provides the memory to the applications running in the terminal system in units of memory pages. Multiple applications may be running in the terminal system. When an application is placed in the background by the user, the data stored in its memory page can be compressed and stored, and the data in its memory page is temporarily released, and the memory page with temporarily released data can be provided to the foreground process.
[0034] Among them, the kernel is the most basic part of the terminal operating system. It is a part of the software that provides secure access to computer hardware for many applications. This access is limited, and the kernel determines when and how long a program can operate on a certain part of the hardware.
[0035] In an embodiment of the present invention, when a terminal system runs multiple applications, data of the running multiple applications are stored in at least one first memory page, and the arrangement order of the at least one first memory page is according to the arrangement order of the usage time of the data stored in the at least one first memory page, and the memory page storing data with a later usage time is arranged in front of the memory page storing data with an earlier usage time, that is, the frontmost memory page in the used memory page list is the data memory page of the application currently in use, and the data stored in at least one first memory page ranked last in the used memory page list is taken out and compressed and stored in the second memory page. The data stored in at least one first memory page ranked last in the used memory page list is the data of the application that will not be used by the user in the background temporarily. Since the background will not be used by the user temporarily, the data stored in its memory page can be compressed and stored in the second memory page.
[0036] Furthermore, the method also includes: the terminal concatenates and stores the plurality of compressed and stored data in a second memory page.
[0037] For example, Figure 4 As shown, the kernel of the terminal will select the temporarily unused memory page P1, compress it and store it using memory compression technology; the compressed data will be less than 4096 bytes. Considering the convenience of memory management, the kernel will splice multiple compressed memory page data and store them in a separate memory page, such as Figure 4 P1 and P4 are concatenated and stored in an independent memory page, and P3, P5, and P6 are concatenated and stored in an independent memory page.
[0038] It should be noted that the terminal kernel currently supports multiple compression algorithms, such as LZO (Lempel-Ziv-Oberhumer) compression algorithm, LZ4 compression algorithm, etc. Different compression algorithms have different requirements on the processing power of the terminal CPU, and the compression rate of the data will also be different. The terminal is configured with multiple compression algorithms, and the algorithm used by the memory compression technology can be selected. Different compression algorithms can be selected according to the CPU processing power of the terminal system and the size of the physical memory capacity to achieve a balance between compression time and compression rate.
[0039] Optionally, before extracting and compressing the data stored in at least one first memory page in the used memory page list and storing it in a second memory page, the method includes:
[0040] Obtaining a storage capacity value to be used by the running program, and when the available storage capacity value of the terminal system memory is less than the storage capacity value to be used by the running program, determining the difference between the storage capacity value to be used by the running program and the available storage capacity value of the terminal system memory as the storage capacity value to be compressed;
[0041] The difference between the storage capacity value occupied by the data stored in the at least one first memory page before compression and the storage capacity value occupied by the data stored in the at least one first memory page after compression is greater than or equal to the storage capacity value to be compressed.
[0042] Specifically, when running multiple programs on a terminal, the terminal may not have enough memory. In this case, memory compression technology is needed to compress and store the data of programs that are not temporarily used in the terminal background. The specific amount of memory space to be compressed needs to be determined based on the storage capacity value required by the current running program.
[0043] For example, if the storage capacity required by the currently running program is 100M, and the available storage capacity of the terminal system memory is 50M, it is necessary to compress the data of programs that are temporarily not used in the background and release at least 50M of memory space through data compression, that is, release at least 50M of memory pages.
[0044] Step 102: Arrange the second memory pages storing the at least one compressed stored data in the order of use of the at least one compressed stored data to generate a compressed memory page list.
[0045] Among them, the compressed memory page list includes: at least one second memory page, and the at least one second memory page is arranged in the order of usage time of the compressed data stored in the at least one second memory page, and the second memory page storing the compressed data with a later usage time is arranged before the second memory page storing the compressed data with an earlier usage time.
[0046] Specifically, after the terminal kernel compresses the memory page data that is temporarily not used by the background process, due to the user's operation and the system scheduling, after a certain period of time, the compressed data may be used again; at this time, the system will take out the compressed data, decompress it and provide it to the application; at the same time, the kernel will compress and store the memory data of the application scheduled to the background according to system requirements. As the terminal system runs, the terminal will compress and store the data according to the current operation of different programs, that is, there will be multiple compressed data and multiple second memory pages storing compressed data. The multiple second memory pages are arranged in the order of the use time of the compressed data stored in the at least one second memory page. That is, as the terminal system runs, a certain proportion of compressed data will be stored in the system, and the terminal kernel will sort and count the usage time of these data to generate a compressed memory page list, such as Figure 5 As shown in the left figure, there are several memory pages storing compressed data behind memory page Page N.
[0047] Step 103: When the number of second memory pages in the compressed memory page list is greater than a preset threshold, the compressed data stored in at least one second memory page in the compressed memory page list is retrieved and stored in an embedded multimedia card.
[0048] Specifically, when the number of second memory pages in the compressed memory page list is greater than a preset threshold, that is, when the compressed data stored in the terminal system reaches a certain amount, the compressed data stored in at least one second memory page at the end of the compressed memory page list is taken out and stored in the embedded multimedia card, that is, the system will store the data that has not been used for a long time or is used less frequently in the embedded multimedia card eMMC partition according to the order in which these compressed data are used, and the memory space used by these compressed data is saved and provided to the application programs running in the system, such as Figure 5 As shown, the compressed data stored in the last two memory pages are read out and written into the eMMC partition.
[0049] It should be noted that the amount of compressed data stored in the memory, the amount of compressed data stored in the eMMC, and the amount of compressed data stored in the eMMC partition can be adjusted according to factors such as the memory capacity of the terminal system and the system operating status to achieve optimal system performance.
[0050] Further, after the compressed data stored in at least one second memory page in the compressed memory page list is taken out and stored in the embedded multimedia card, the method further includes:
[0051] When the compressed data stored in the embedded multimedia card is used, the target compressed data is read from the embedded multimedia card and decompressed before use.
[0052] Specifically, when the terminal system needs to use the compressed data that has been stored in the eMMC during operation, the terminal kernel will first read the data from the eMMC and decompress it, and then provide it to the system for use, such as Figure 6 shown.
[0053] The memory optimization method provided in the embodiment of the present invention effectively solves the problems existing in the existing memory optimization technology. It uses the permanent storage medium eMMC of the terminal system as the secondary cache of the memory compression technology, and selectively stores the data compressed by the memory compression technology in the eMMC. This can improve the efficiency of memory compression and provide more available memory space. At the same time, it will not affect the system performance and the service life of the eMMC due to excessive memory swapping.
[0054] The embodiment of the present invention further provides a terminal 20, such as Figure 7 As shown, the terminal 20 includes:
[0055] The processing unit 201 is used to extract data stored in at least one first memory page in the used memory page list and compress and store the data in a second memory page according to the use order of the data stored in the used memory page list in the terminal system memory;
[0056] A generating unit 202, configured to arrange the second memory pages storing the at least one compressed stored data in accordance with the usage order of the at least one compressed stored data to generate a compressed memory page list;
[0057] The processing unit 201 is further configured to retrieve compressed data stored in at least one second memory page in the compressed memory page list and store it in the embedded multimedia card when the number of second memory pages in the compressed memory page list is greater than a preset threshold.
[0058] Optionally, the terminal further includes:
[0059] The determining unit 203 is used to obtain a storage capacity value to be used by the running program, and when the available storage capacity value of the terminal system memory is less than the storage capacity value to be used by the running program, determine the difference between the storage capacity value to be used by the running program and the available storage capacity value of the terminal system memory as the storage capacity value to be compressed;
[0060] The difference between the storage capacity value occupied by the data stored in the at least one first memory page before compression and the storage capacity value occupied by the data stored in the at least one first memory page after compression is greater than or equal to the storage capacity value to be compressed.
[0061] Optionally, the used memory page list includes: at least one first memory page, the at least one first memory page is arranged in the order of usage time of data stored in the at least one first memory page, and the first memory page of data stored with a later usage time is arranged before the first memory page of data stored with an earlier usage time;
[0062] The processing unit 201 is further configured to extract data stored in at least one first memory page that is last in the used memory page list and compress and store the data in a second memory page.
[0063] Optionally, the compressed memory page list includes: at least one second memory page, the at least one second memory page is arranged in the order of usage time of the compressed data stored in the at least one second memory page, and the second memory page storing the compressed data with a later usage time is arranged before the second memory page storing the compressed data with an earlier usage time;
[0064] The processing unit 201 is further configured to retrieve compressed data stored in at least one second memory page that is last in the compressed memory page list and store the compressed data in the embedded multimedia card.
[0065] Optionally, the processing unit 201 is further configured to read target compressed data from the embedded multimedia card and decompress the data for use when using compressed data stored in the embedded multimedia card.
[0066] Specifically, the understanding of the terminal provided by the embodiment of the present invention can refer to the description of the embodiment of the memory optimization method, and the embodiment of the present invention will not be repeated here.
[0067] The terminal provided by the embodiment of the present invention stores part of the compressed data generated by the ZRAM technology in the eMMC, thereby providing more available memory for the system; especially when the system is used for a long time and the system data compression ratio is relatively low, higher memory usage efficiency can be provided.
[0068] The embodiment of the present invention further provides a terminal 30, such as Figure 8 As shown, the terminal 30 includes a processor 301 and a memory 302; wherein,
[0069] The memory 302 is used to store a computer program that can be run on the processor;
[0070] The processor 301 is used to execute the steps of the above-mentioned memory optimization method when running the computer program.
[0071] It can be understood that the memory 302 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAM bus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 302 described in the embodiments of the present invention is intended to include, but is not limited to, these and any other suitable types of memories.
[0072] The method disclosed in the above embodiment of the present invention can be applied to the processor 301, or implemented by the processor 301. The processor 301 may be an integrated circuit chip with signal processing capability, more specifically, a built-in memory optimization algorithm, that is, it has memory optimization capability. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 301 or the instruction in the form of software. The above processor 301 can be a general processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 301 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiment of the present invention. The general processor can be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present invention, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the memory 302. The processor 301 reads the information in the memory 302 and completes the steps of the above method in combination with its hardware.
[0073] In an exemplary embodiment, the terminal may be implemented by one or more application specific integrated circuits (ASIC), DSP, programmable logic device (PLD), complex programmable logic device (CPLD), field programmable gate array (FPGA), general processor, controller, microcontroller (MCU), microprocessor, or other electronic components to execute the aforementioned method.
[0074] In an exemplary embodiment, the embodiment of the present invention further provides a storage medium, which can be a computer-readable storage medium, such as a memory including a computer program, and the computer program can be executed by a processor of a terminal to complete the steps of the aforementioned method. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, FlashMemory, magnetic surface storage, optical disk, or CD-ROM.
[0075] An embodiment of the present invention also provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the steps of the memory optimization method as described in any of the above items.
[0076] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0077] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0078] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0079] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0080] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention.
Claims
1. A memory optimization method, characterized in that: include: Obtaining a storage capacity value to be used by the running program, and when the available storage capacity value of the terminal system memory is less than the storage capacity value to be used by the running program, determining the difference between the storage capacity value to be used by the running program and the available storage capacity value of the terminal system memory as the storage capacity value to be compressed; According to the use order of the data stored in the used memory page list in the terminal system memory, the data stored in at least one first memory page in the used memory page list is taken out and compressed and stored in a second memory page; Arranging the second memory pages storing the at least one compressed stored data in a usage order of the at least one compressed stored data to generate a compressed memory page list; When the number of the second memory pages in the compressed memory page list is greater than a preset threshold, taking out the compressed data stored in at least one second memory page in the compressed memory page list and storing it in the embedded multimedia card; The difference between the storage capacity value occupied by the data stored in the at least one first memory page before compression and the storage capacity value occupied by the data stored in the at least one first memory page after compression is greater than or equal to the storage capacity value to be compressed.
2. The method according to claim 1, characterized in that The used memory page list includes: at least one first memory page, the at least one first memory page is arranged in the order of the use time of the data stored in the at least one first memory page, and the first memory page of the data stored with a later use time is arranged before the first memory page of the data stored with an earlier use time; The method of extracting and compressing the data stored in at least one first memory page in the used memory page list and storing it in a second memory page comprises: The data stored in at least one first memory page which is at the end of the used memory page list is taken out, compressed and stored in a second memory page.
3. The method according to claim 1, characterized in that The compressed memory page list includes: at least one second memory page, the at least one second memory page is arranged in the order of usage time of the compressed data stored in the at least one second memory page, and the second memory page storing the compressed data with a later usage time is arranged before the second memory page storing the compressed data with an earlier usage time; The method of taking out the compressed data stored in at least one second memory page in the compressed memory page list and storing it in the embedded multimedia card comprises: The compressed data stored in at least one second memory page which is at the end of the compressed memory page list is taken out and stored in the embedded multimedia card.
4. The method according to any one of claims 1 to 3, characterized in that: After the compressed data stored in at least one second memory page in the compressed memory page list is taken out and stored in the embedded multimedia card, the method further includes: When the compressed data stored in the embedded multimedia card is used, the target compressed data is read from the embedded multimedia card and decompressed before use.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Multiple compressed and stored data are concatenated and stored in a second memory page.
6. A memory optimization terminal, characterized in that: include: a determination unit, configured to obtain a storage capacity value to be used by the running program, and when the available storage capacity value of the terminal system memory is less than the storage capacity value to be used by the running program, determine the difference between the storage capacity value to be used by the running program and the available storage capacity value of the terminal system memory as the storage capacity value to be compressed; A processing unit, configured to extract data stored in at least one first memory page in the used memory page list and compress and store the data in a second memory page according to the use order of the data stored in the used memory page list in the terminal system memory; A generating unit, configured to generate a compressed memory page list by arranging the second memory pages storing the at least one compressed stored data in a usage order of the at least one compressed stored data; The processing unit is further configured to, when the number of second memory pages in the compressed memory page list is greater than a preset threshold, retrieve compressed data stored in at least one second memory page in the compressed memory page list and store it in the embedded multimedia card; The difference between the storage capacity value occupied by the data stored in the at least one first memory page before compression and the storage capacity value occupied by the data stored in the at least one first memory page after compression is greater than or equal to the storage capacity value to be compressed.
7. The terminal according to claim 6, characterized in that: The processing unit is further used to read target compressed data from the embedded multimedia card and decompress the data before using it when using the compressed data stored in the embedded multimedia card.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the memory optimization method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Virtual machine thermal migration memory processing method, device and system
CN103353850A
Memory allocation method and apparatus, and terminal device
CN107704321A