WO2021057665A1 - 数据存储方法、装置、移动终端及存储介质 - Google Patents

数据存储方法、装置、移动终端及存储介质 Download PDF

Info

Publication number
WO2021057665A1
WO2021057665A1 PCT/CN2020/116555 CN2020116555W WO2021057665A1 WO 2021057665 A1 WO2021057665 A1 WO 2021057665A1 CN 2020116555 W CN2020116555 W CN 2020116555W WO 2021057665 A1 WO2021057665 A1 WO 2021057665A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory page
memory
historical
compression
compressed
Prior art date
Application number
PCT/CN2020/116555
Other languages
English (en)
French (fr)
Inventor
周华材
张诗明
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2021057665A1 publication Critical patent/WO2021057665A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1737Details of further file system functions for reducing power consumption or coping with limited storage space, e.g. in mobile devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse files

Definitions

  • This application relates to the field of mobile terminal technology, and more specifically, to a data storage method, device, mobile terminal, and storage medium.
  • DRAM Dynamic Random Access Memory
  • this application proposes a data storage method, device, mobile terminal, and storage medium.
  • an embodiment of the present application provides a data storage method.
  • the method includes: obtaining a memory page that is currently compressed in a memory; obtaining historical usage data of the memory page; and obtaining historical usage data based on the historical usage data.
  • the memory page that meets the historical use condition among the memory pages is used as the target memory page; the target memory page is compressed and stored again.
  • an embodiment of the present application provides a data storage device.
  • the device includes: a first memory page acquisition module, a usage data acquisition module, a second memory page acquisition module, and a memory page compression module.
  • a memory page acquisition module is used to acquire the currently compressed memory page in the memory;
  • the usage data acquisition module is used to acquire historical usage data of the memory page;
  • the second memory page acquisition module is used to acquire the memory page according to the history Using the data, a memory page that satisfies the historical use condition in the memory page is obtained as a target memory page; the memory page compression module is used to compress and store the target memory page again.
  • an embodiment of the present application provides a mobile terminal, including: one or more processors; a memory; one or more application programs, wherein the one or more application programs are stored in the memory and It is configured to be executed by the one or more processors, and the one or more programs are configured to execute the data storage method provided in the above-mentioned first aspect.
  • an embodiment of the present application provides a computer-readable storage medium.
  • the computer-readable storage medium stores program code, and the program code can be called by a processor to execute the data provided in the first aspect. Storage method.
  • Fig. 1 shows a flow chart of a data storage method according to an embodiment of the present application.
  • Fig. 2 shows a flowchart of a data storage method according to another embodiment of the present application.
  • Fig. 3 shows a flowchart of a data storage method according to another embodiment of the present application.
  • Fig. 4 shows a flowchart of a data storage method according to still another embodiment of the present application.
  • Fig. 5 shows a block diagram of a data storage device according to an embodiment of the present application.
  • Fig. 6 shows a block diagram of a second memory page acquiring module in a data storage device according to an embodiment of the present application.
  • Fig. 7 shows another block diagram of a data storage device according to an embodiment of the present application.
  • Fig. 8 shows a block diagram of a memory page compression module in a data storage device according to an embodiment of the present application.
  • FIG. 9 is a block diagram of a mobile terminal for executing the data storage method according to the embodiment of the present application according to an embodiment of the present application.
  • Fig. 10 is a storage unit for storing or carrying program code for implementing the data storage method according to the embodiment of the present application according to an embodiment of the present application.
  • the memory is one of the important components, and the memory is the bridge to communicate with the CPU. All programs in the mobile terminal are run in the memory, so the performance of the memory has a greater impact on the mobile terminal.
  • the memory is generally composed of DRAM (Dynamic Random Access Memory). Due to the low integration of DRAM, the capacity is limited.
  • the inventors proposed the data storage method, device, mobile terminal, and storage medium provided by the embodiments of the present application, which can recompress the memory pages that meet the historical usage conditions among the currently compressed memory pages in the memory. Thereby saving memory space and improving memory utilization.
  • the specific data storage method will be described in detail in the subsequent embodiments.
  • FIG. 1 shows a schematic flowchart of a data storage method provided by an embodiment of the present application.
  • the data storage method is used for re-compressing memory pages that meet historical usage conditions among memory pages that are currently compressed in memory, thereby saving memory space and improving memory utilization.
  • the data storage method is applied to the data storage device 400 shown in FIG. 5 and the mobile terminal 100 equipped with the data storage device 400 (FIG. 9 ).
  • the following will take a mobile terminal as an example to illustrate the specific process of this embodiment.
  • the mobile terminal applied in this embodiment can be a smart phone, a tablet computer, an e-book, a smart watch, etc., which are not limited here. .
  • the process shown in FIG. 1 will be described in detail below, and the data storage method may specifically include the following steps:
  • Step S110 Obtain the currently compressed memory page in the memory.
  • the currently compressed memory page refers to the memory page that has been compressed and stored in the memory.
  • Memory also known as random access memory, RAM
  • RAM random access memory
  • the memory page is a unit for the operating system to manage the memory.
  • the size of the unit memory occupied by the memory page may not be a limitation, and the size of the unit memory occupied by the memory page set by different mobile terminals may be different.
  • Memory pages can include anonymous pages, file pages, etc., which are not limited here.
  • anonymous pages refer to pages without file backgrounds, such as heap, stack, data segment, etc.
  • file pages refer to pages with file backgrounds, which are cached in memory after the program reads the file.
  • File pages are also called file caches.
  • the system kernel of a mobile terminal compresses some memory pages and stores them in the memory to save memory usage. Therefore, there are usually compressed memory pages in the memory. For example, the least recently used anonymous pages are compressed and stored in memory.
  • the mobile terminal may record the operation of the memory page being compressed, thereby recording the compressed memory page, and the mobile terminal can obtain the currently compressed memory page according to the compression record of the memory page .
  • the mobile terminal may add a mark to the compressed memory page, for example, mark the name of the memory page, etc., which is not limited herein.
  • the mobile terminal obtains the memory page existing in the memory, and then according to the mark, can obtain the currently compressed memory page in the memory.
  • the manner in which the mobile terminal obtains the currently compressed memory page in the memory may not be a limitation.
  • the mobile terminal may set a time interval every interval to obtain the currently compressed memory pages in the memory, to determine from these memory pages the memory pages that can be compressed again in the future, and to compress the determined memory pages again That is to say, the data storage method provided in the embodiment of the present application is executed once every set interval.
  • the mobile terminal may also receive the trigger instruction input by the user, and execute the acquisition of the currently compressed memory pages in the memory according to the trigger instruction input by the user, so as to determine the memory pages that can be compressed again in the future.
  • the memory page compresses the determined memory page again, that is, the data storage method provided in the embodiment of the present application is executed according to the user's trigger instruction.
  • step S110 may not be limited in the embodiment of the present application.
  • Step S120 Obtain historical usage data of the memory page.
  • the mobile terminal can record the historical usage data of the memory page, so that the memory page can be managed according to the record.
  • the mobile terminal may record the usage time, the number of usage, the usage duration, etc. of the memory page, so as to record the historical usage data of the memory page.
  • the mobile terminal can determine the use time, the number of uses, and the length of use of the memory page according to the access to the address of the memory page, and thus the time, number, and duration of the access.
  • the specific historical usage data may not be limited in the embodiment of the present application.
  • the historical use time may be the time each time the memory page is used
  • the historical use times may be the total number of times the memory page is used
  • the historical use time may be the total time the memory page is used.
  • Step S130 According to the historical usage data, obtain a memory page that meets the historical usage condition among the memory pages, and use it as a target memory page.
  • the mobile terminal After the mobile terminal obtains the historical usage data of the currently compressed memory pages, it can determine the memory pages that meet the historical usage conditions among these memory pages according to the historical usage data of these memory pages, so as to determine the memory pages that meet the historical usage conditions.
  • the page is compressed again.
  • the mobile terminal can determine one or more of the historical use time, the number of historical use, and the historical use duration of the memory page according to the historical use data of each memory page in the currently compressed memory page. Whether it meets the historical use conditions.
  • the mobile terminal can set historical use conditions for historical use time, historical use conditions for historical use times, and historical use conditions for historical use time.
  • the historical use condition for the historical use time may be whether the interval between the historical use time of two adjacent use memory pages is greater than the first preset interval. For example, for the memory page A, two adjacent memory pages are used. The historical use time interval of memory page A for the second use is 60 hours, and the preset time interval is 50 hours, then the historical use time of the memory page A meets the historical use conditions; the historical use conditions for the historical use time can also be the most recent Whether the interval between the time of one use and the current time is greater than the second preset interval, for example, the interval between the last used historical use time of memory page B and the current time is 30 hours, and the second preset interval is 20 hours, then the memory page The historical use time of B meets the historical use conditions.
  • the historical use condition corresponding to the specific historical use time may not be a limitation.
  • the historical use condition for the historical use count may be whether the historical use count of the memory page is less than the preset count. For example, the historical use count of the memory page A is less than 3 times, then the historical use count of the memory page A Satisfy the historical use conditions; the historical use conditions for the historical use times can also be that the historical use times of the memory page is the smallest. Correspondingly, the historical use times of each memory page of the memory page are obtained according to the historical use data.
  • the size of the historical usage count of each memory page is compared to obtain a comparison result, and the memory page with the smallest historical usage count in the comparison result is obtained as the target memory page, for example, it is currently compressed Among the memory pages, the historical use times of memory page B is the smallest, then the historical use times of memory page B meets the historical use conditions, and memory page B is used as the target memory page.
  • the historical usage condition for the historical usage duration may be whether the historical usage duration of the memory page is less than a preset duration. For example, if the historical usage duration of the memory page A is less than 10 minutes, then the historical usage duration of the memory page A Satisfy the historical use condition; the historical use condition for the historical use time can also be that the historical use time of the memory page is the smallest.
  • the historical use time of each memory page of the memory page is obtained according to the historical use data, and compared For the size of the historical usage duration of each memory page, the memory page with the smallest historical usage duration is used as the target memory page, for example, among the currently compressed memory pages, the historical usage duration of memory page B If it is the smallest, the historical use time of memory page B meets the historical use condition, and memory page B is used as the target memory page.
  • the mobile terminal determines the memory pages that meet the historical use conditions among the currently compressed memory pages, and can determine that one or more of the historical use time, historical use times, and historical use duration meets the historical use conditions, for example, The historical use time and historical use times of the memory page A satisfy the historical use conditions at the same time, it means that the memory page A meets the historical use conditions, which is not limited here.
  • the specific historical use conditions may not be used as limitations.
  • the historical use conditions can be used to obtain memory pages that are currently compressed, which are less used or will not be used for a longer period of time. Memory pages.
  • the mobile terminal After the mobile terminal determines the memory page that meets the historical use condition from the currently compressed memory page, it can use the memory page that meets the historical use condition as the target memory page, and the target memory page is the memory that can be recompressed later. page.
  • Step S140 Compress and store the target memory page again.
  • the target memory pages can be compressed again to reduce the memory occupied by the target memory pages.
  • multi-level (multiple) compression of the memory page can be realized, and the specific compression level and the size of each compression can be set according to actual needs.
  • the data storage method provided by the embodiment of the present application obtains the historical usage data of the memory page by obtaining the currently compressed memory page in the memory, and according to the historical usage data, obtains the memory page that meets the historical use condition in the memory page as the target memory Page, the target memory page is compressed and stored again, so as to achieve deep compression of the memory page, which can save memory space and improve memory utilization.
  • FIG. 2 shows a schematic flowchart of a data storage method provided by another embodiment of the present application. This method is applied to the above-mentioned mobile terminal. The process shown in FIG. 2 will be described in detail below.
  • the data storage method may specifically include the following steps:
  • Step S210 Obtain the currently compressed memory page in the memory.
  • Step S220 Obtain historical usage data of the memory page.
  • step S210 and step S220 can refer to the content of the foregoing embodiment, and will not be repeated here.
  • the acquired historical usage data of the currently compressed memory page may include at least the historical usage time.
  • Step S230 Acquire the time when each memory page of the memory page was last used according to the historical use time.
  • the mobile terminal can determine whether the historical use time of these memory pages meets the historical use conditions according to the historical use time of the currently compressed memory pages, so as to obtain memory that meets the historical use conditions from these memory pages. page.
  • the mobile terminal may obtain the most recently used time of each memory page in the currently compressed memory page according to the historical usage time of the currently compressed memory page.
  • the currently compressed memory page includes memory page C
  • the historical usage time of the acquired memory page C includes 16:45 on September 10, 2019, 10:30 on September 15, 2019, and September, 2019 At 17:12 on the 18th
  • the current time when the mobile terminal executes the data storage method is 19:20 on September 18, 2019, and the last time memory page C was used is 17:00 on September 18, 2019 12 points.
  • Step S240 Sort the last used time of each memory page in chronological order to obtain a sorting result.
  • the mobile terminal after the mobile terminal obtains the last used time of each memory page in the currently compressed memory page, it can sort the last used time in chronological order.
  • the currently compressed memory pages include memory page A, memory page B, and memory page C.
  • the last used time of memory page A was 9:08 on September 17, 2019, and the last time of memory page B
  • the used time is 16:24 on September 16, 2019, and the last time memory page C was used was 19:00 on September 18, 2019.
  • the memory page A is used once. Sort the last used time, the last used time of memory page B, and the last used time of memory page C.
  • the sorting result is September 16, 2019 16:24, September 17, 2019 9:08, 19:00 on September 18, 2019.
  • Step S250 Obtain the memory page corresponding to the first position in the sorting result and use it as the target memory page.
  • the mobile terminal after the mobile terminal sorts the last used time corresponding to each memory page in the currently compressed memory page in chronological order, it can determine that the historical use is satisfied according to the sorting result.
  • Conditional memory page Specifically, the mobile terminal may obtain the most recently used time ranked first from the sorting result, and determine the memory page corresponding to the first position as the memory page that meets the historical use conditions, and use the memory page corresponding to the first position as the memory page
  • the target memory page that is, the memory page that can be compressed again later. It is understandable that the last used time of the target memory page is the longest from the current time, indicating that the memory page has not been used for a long time and may not be used in the future. Therefore, the memory page can be used as a target that can be compressed again. Memory pages.
  • Step S260 Compress and store the target memory page again.
  • the mobile terminal can also determine whether the target memory page satisfies the condition that the target memory page can be compressed again, for example, whether the compression rate of the target memory page reaches a set threshold, that is, the target Whether the memory page has been compressed to a minimum and can no longer be compressed. If it is determined that the target memory page satisfies the condition to be compressed again, the target memory page can be compressed again to achieve multi-level compression of the memory page.
  • the data storage method provided by the embodiment of the present application obtains the historical usage data of the memory page by obtaining the currently compressed memory page in the memory, and obtains the last used time of each compressed memory page in the historical usage data , Sort the last used time of each memory page in these memory pages in chronological order to obtain the sorting result, and use the first corresponding memory page in the sorting result as the target memory page, and then perform the target memory page again Compress and store, so as to achieve deep compression of memory pages that have not been used for a long time, which can save memory space and improve memory utilization.
  • FIG. 3 shows a schematic flowchart of a data storage method provided by another embodiment of the present application. This method is applied to the above-mentioned mobile terminal. The process shown in FIG. 3 will be described in detail below.
  • the data storage method may specifically include the following steps:
  • Step S310 Obtain the currently compressed memory page in the memory.
  • Step S320 Obtain historical usage data of the memory page.
  • step S310 and step S320 can refer to the content of the foregoing embodiment, and will not be repeated here.
  • Step S330 According to the historical usage data, obtain a memory page that meets the historical usage condition among the memory pages, and use it as a target memory page.
  • the historical use conditions may include: the number of historical use times within a preset time period is less than the first set number of times, the historical use time within the preset time period is less than the set time period, and the The number of historical use times within the preset time period is the smallest, or the historical use time within the preset time period is the smallest.
  • the preset time period may be a time period within a preset time period before the current time, that is, a time period within the most recent preset time period.
  • the preset time period may be 24 hours or 36 hours, etc. Not limited. It is understandable that within the preset time period, if there is a memory page with a historical usage less than the first set number in the currently compressed memory page, it means that after the memory page is compressed, it has not been frequently used in the recent period of time. Therefore, the memory page can be compressed again, and the memory page can be used as the target memory page.
  • the preset time period if there is a memory page that has been compressed and has a historical usage duration less than the set duration, it means that the memory page has been used for a short period of time after being compressed, that is, the memory page is not It is often used, so the memory page can be compressed again, and the memory page is used as the target memory page.
  • the historical usage times corresponding to the target memory page are the least, which can also indicate that the memory page is not frequently used, so the memory page can be compressed again, and the memory page is used as the target memory page.
  • the historical usage time corresponding to the target memory page is the least, which can also indicate that the memory page is not frequently used, so the memory page can be compressed again, and the memory page is used as the target memory page.
  • the specific first set times and set duration may not be limited.
  • the first set times may be 1, or 2
  • the set duration may be 0.1 minutes or 2 minutes.
  • the historical use condition may also be a combination of the above historical use conditions.
  • the historical use condition may be the minimum historical duration and the historical use duration is less than the set duration, and the historical use condition may also be the minimum historical times and duration.
  • the historical use times are less than the first set times, and the specific historical use conditions may not be limited.
  • Step S340 Obtain the number of times the target memory page has been compressed.
  • the mobile terminal after the mobile terminal determines the target memory page that meets the historical usage conditions from the currently compressed memory page, before compressing the target memory page again, it can also obtain that the target memory page has been compressed.
  • the number of compressions to determine whether the target memory page can be compressed again according to the number of times it has been compressed.
  • the number of times the target memory page is compressed refers to the number of times the target memory page is compressed in a relatively uncompressed state.
  • the original size before compression is 150 megabytes (MB)
  • the memory page is used after decompression, restored to a size of 150MB, and compressed to 50MB at 11:12 on September 13, 2019, and memory page A has not been compressed and decompressed before the current time, then the memory page corresponds to the compression
  • the number of times is 1.
  • the original size before compression is 300MB, and it was compressed to 100MB at 11:00 on September 12, 2019, and again at 11:20 on September 14, 2019.
  • Compression is compressed from 100MB to 30MB, and memory page B has not been compressed and decompressed before the current time, then the compression times corresponding to the memory page is 2.
  • the mobile terminal may obtain the number of times the target memory page has been compressed according to the recorded compression record of the memory page. It is understandable that every time the mobile terminal compresses a memory page, it can be recorded in the compression record, so that the mobile terminal can obtain the number of times the target memory page has been compressed according to the compression record.
  • Step S350 Determine whether the number of times of compression is less than a second set number of times.
  • the mobile terminal after acquiring the number of compressed compression times, can determine whether the number of times the target memory page is compressed is less than the second set number of times.
  • the second set number of times can be the preset number of times that the memory page can be compressed, that is, the level of compression that can be set.
  • the specific number of compressions can be set according to actual needs, for example, it can be set to 3 or Set to 4 times.
  • the number of compressions reaches the second set number of times (equal to or greater than the second set number of times), it means that the level of compression of the current memory page has reached the set level and can no longer be compressed; if the number of compressions does not reach the first Two set times (less than the second set times), it means that the level of the current memory page being compressed has not reached the set level, that is, it can be compressed again.
  • Step S360 If the number of times of compression is less than the second set number of times, perform the compression and storage of the target memory page again.
  • the target memory page may be compressed again and stored in the memory.
  • compressing and storing the target memory page again may include:
  • the compression ratio corresponding to the number of compression times is acquired; according to the compression ratio, the target memory page is compressed again and stored.
  • the compression ratio refers to the ratio of the size of a file after compression to the size before compression.
  • the compression rate when the memory page is compressed at the first level, the compression rate can be 0.33, when the memory page is compressed at the second level, the compression rate can be 0.44, and when the third level is compressed, the compression rate can be 0.5
  • the above compression rate is only an example, and does not represent a limitation on the specific compression rate in the embodiment of the present application.
  • the mobile terminal may obtain the compression ratio corresponding to the compression times of the target memory page according to the corresponding relationship between the compression times and the compression ratio, and then compress and store the target memory page again according to the obtained compression ratio.
  • the data storage method may further include: if the number of times of compression of the currently compressed memory page is equal to or greater than the second set number of times, the target memory page may not be compressed.
  • the data storage method may further include: if the number of times of compression is equal to or greater than the second set number of times, and the number of compressions is less than a third set number of times, determining the remaining memory of the memory Whether it is less than the memory threshold, the third set number of times is greater than the second set number of times; if the remaining memory is less than the memory threshold, the target memory page is compressed and stored again; if the number of compressions is equal to Or it is greater than the second set number of times, and the compression number is not less than the third set number of times, and the target memory page is not compressed again.
  • the target memory page can still be compressed A certain size, but the difficulty of compression is relatively large. Therefore, compression will not be performed under normal circumstances.
  • the target memory page can be compressed to reduce the memory cost. Occupy, increase the remaining memory of the system.
  • the mobile terminal determines that the number of times the target memory page is compressed is equal to or greater than the second set number of times, the current remaining memory of the mobile terminal can be obtained to determine whether the remaining memory is less than the memory threshold.
  • the mobile terminal can obtain the remaining memory of the mobile terminal by detecting the usage of the memory. For example, when the operating system of the mobile terminal is the Android system, the current memory of the mobile terminal can be obtained through the ActivityManager.getMemoryInfo(ActivityManager.MemoryInfo) method. The amount of available memory is to obtain the remaining memory of the mobile terminal.
  • the mobile terminal After the mobile terminal obtains the remaining memory, it can determine whether the remaining memory is less than the memory threshold.
  • the size of the memory threshold may not be a limitation. For example, it can be set to the value when the number of times the target memory page is compressed reaches the second set number of times. Compression, the size that will not affect the operation of the mobile terminal. If the remaining memory of the mobile terminal is less than the memory threshold, it means that the current remaining memory of the mobile terminal is less, so the target memory page can be compressed again, thereby reducing the memory usage and increasing the available memory of the mobile terminal. If the remaining memory of the mobile terminal is equal to or greater than the memory threshold, it means that the mobile terminal has more remaining memory. Therefore, the target memory page can no longer be compressed to avoid the difficulty of compression when the number of compressions reaches the second set number of times , Increase the burden on the system.
  • the data storage method may further include: after a preset period of time, the step of obtaining the currently compressed memory page in the memory is executed again, until the target memory page is compressed again And storing until the compression ratio of the target memory page is less than the set compression ratio. It is understandable that the mobile terminal can execute the data storage method provided in the embodiment of the present application once every preset time interval, so that multi-level compression of memory pages can be realized, the effect of deep compression of memory pages can be achieved, and the memory utilization rate can be improved. .
  • the data storage method provided by the embodiment of the application obtains the current compressed memory page in the memory, obtains the historical usage data of each memory page in the currently compressed memory page, and obtains the currently compressed memory page according to the historical usage data.
  • the memory page that meets the historical usage conditions in the memory page is used as the target memory page, and then the number of compression times that the target memory page has been compressed is obtained, and then it is judged whether the number of compression times is less than the second set number, if the number of compression times of the target memory page is less than the second Set the number of times, execute the compression and storage of the target memory page again, so as to realize the deep compression of the compressed memory page that meets the historical usage conditions, which can save memory space and improve memory utilization.
  • FIG. 4 shows a schematic flowchart of a data storage method provided by another embodiment of the present application. This method is applied to the above-mentioned mobile terminal. The process shown in FIG. 4 will be described in detail below.
  • the data storage method may specifically include the following steps:
  • Step S410 Obtain the currently compressed memory page in the memory.
  • Step S420 Obtain historical usage data of the memory page.
  • Step S430 According to the historical usage data, obtain a memory page that meets the historical usage condition among the memory pages, and use it as a target memory page.
  • steps S410 to S430 can refer to the memory of the foregoing embodiment, which will not be repeated here.
  • Step S440 Determine a compression rate corresponding to the historical use data according to the historical use data.
  • the mobile terminal after the mobile terminal determines the target memory page that meets the historical usage conditions from the currently compressed memory page, when re-compressing the target memory page, it can determine and The compression ratio corresponding to the historical usage data, so that the compression ratio this time corresponds to the historical usage data of the target memory page.
  • the mobile terminal may determine the compression rate corresponding to the historical use data according to the historical use time, the number of historical use, the historical use duration, etc. in the historical use data.
  • the more historical uses of the target memory page the higher the possibility of the target memory page being used, so the more historical uses, the higher the compression rate this time to avoid the target memory page It is difficult to decompress when it is used again, which increases the system burden of the mobile terminal.
  • the higher the rate the greater the difficulty in decompressing the target memory page when it is reused, which increases the system burden on the mobile terminal.
  • the longer the historical usage time of the target memory page the higher the possibility of the target memory page being used. Therefore, the longer the historical usage time, the higher the compression rate this time to avoid the target memory. It is difficult to decompress the page when it is used again, which increases the system burden of the mobile terminal.
  • the specific method for determining the compression rate based on historical usage data is not limited. For example, it is also possible to determine the compression rate of the target memory page this time based on historical use time, historical use times, and historical use time at the same time. Comprehensively evaluate the possibility of the target memory page being used.
  • Step S450 According to the compression ratio, compress and store the target memory page again.
  • the data storage method provided by the embodiment of the application obtains the current compressed memory page in the memory, obtains the historical usage data of each memory page in the currently compressed memory page, and obtains the currently compressed memory page according to the historical usage data.
  • the memory page that meets the historical usage conditions in the memory page is used as the target memory page, and then according to the historical usage data, the compression rate corresponding to the historical usage data is determined, and finally the target memory page is compressed according to the compression rate, making the target memory page this time
  • the compression ratio of compression corresponds to the historical usage data of the target memory page, so as to achieve deep compression of the compressed memory pages that meet the historical usage conditions, which can save memory space, improve memory utilization, and avoid the target memory page. It is difficult to decompress when it is used again, which increases the system burden of the mobile terminal.
  • FIG. 5 shows a structural block diagram of a data storage device 400 provided by an embodiment of the present application.
  • the data storage device 400 applies the aforementioned mobile terminal.
  • the data storage device 400 includes: a first memory page acquisition module 410, a usage data acquisition module 420, a second memory page acquisition module 430, and a memory page compression module 440.
  • the first memory page obtaining module 410 is used to obtain a currently compressed memory page in the memory; the usage data obtaining module 420 is used to obtain historical usage data of the memory page; the second memory page is obtained.
  • the module 430 is configured to obtain, according to the historical usage data, a memory page that meets the historical usage conditions among the memory pages as a target memory page; the memory page compression module 440 is configured to compress and store the target memory page again .
  • the historical usage data may include historical usage time.
  • the second memory page acquiring module 430 may include a time acquiring unit 431, a time sorting unit 432, and a memory page determining unit 433.
  • the time obtaining unit 431 is configured to obtain the time when each memory page of the memory page was most recently used according to the historical usage time;
  • the time sorting unit 432 is configured to calculate the time when each memory page was most recently used according to the The sorting is performed in chronological order to obtain the sorting result;
  • the memory page determining unit 433 is configured to obtain the first corresponding memory page in the sorting result as the target memory page.
  • the historical usage conditions may include: the number of historical usage in a preset time period is less than the first set number of times, the historical usage time in the preset time period is less than the set time period, The number of historical use times within the preset time period is the smallest, or the historical use time within the preset time period is the smallest.
  • the data storage device 400 may further include: a compression frequency acquisition module 450 and a compression frequency judgment module 460.
  • the compression times obtaining module 450 is configured to obtain the compression times that the target memory page has been compressed before the memory page compression module 440 compresses and stores the target memory page again;
  • the compression times judgment module 460 is used to judge the compression times Whether it is less than the second set number of times; if the number of compression times is less than the second set number of times, the memory page compression module 440 compresses and stores the target memory page again.
  • the memory page compression module 440 may be specifically configured to: if the number of times of compression is less than a second set number of times, obtain the compression ratio corresponding to the number of compression times; according to the compression ratio, compress the target memory page again And store.
  • the data storage device 400 may further include a memory judgment module.
  • the memory judgment module is configured to judge whether the remaining memory of the memory is less than a memory threshold if the number of compression times is equal to or greater than the second set number of times, and the number of compressions is less than the third set number of times, the third setting The predetermined number of times is greater than the second set number of times; the memory page compression module 440 may also be configured to compress and store the target memory page again if the remaining memory is less than the memory threshold.
  • the memory page compression module 440 may include: a compression ratio obtaining unit 441 and a compression execution unit 442.
  • the compression rate acquiring unit 441 is configured to determine a compression rate corresponding to the historical usage data according to the historical usage data; the compression execution unit 442 is configured to compress and store the target memory page again according to the compression rate.
  • the data storage device 400 may further include a re-execution module.
  • the re-execution module is used to perform the step of obtaining the currently compressed memory page in the memory again after the preset time period, to the step of compressing and storing the target memory page again, until the target memory
  • the compression ratio of the page is less than the set compression ratio.
  • the coupling between the modules may be electrical, mechanical or other forms of coupling.
  • each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software function modules.
  • the solution provided by this application obtains the historical usage data of the memory page by obtaining the currently compressed memory page in the memory, and according to the historical usage data, obtains the memory page that meets the historical usage conditions in the memory page as the target The memory page, compresses and stores the target memory page again, so as to achieve deep compression of the memory page, which can save memory space and improve memory utilization.
  • the mobile terminal 100 may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, an e-book, or a smart wearable device.
  • the mobile terminal 100 in this application may include one or more of the following components: a processor 110, a memory 120, and one or more application programs, where one or more application programs may be stored in the memory 120 and configured to be configured by One or more processors 110 execute, and one or more programs are configured to execute the methods described in the foregoing method embodiments.
  • 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 mobile terminal 100, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and calling data stored in the memory 120.
  • Various functions and processing data of the mobile terminal 100 may adopt at least one 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).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA Programmable Logic Array
  • the processor 110 may be integrated with one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like.
  • the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing of display content; the modem is used for processing wireless communication. It is understandable that the above-mentioned modem may not be integrated into the processor 110, but may be implemented by a communication chip alone.
  • the memory 120 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • 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, where the program storage area may store instructions for implementing the operating system and instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.) , Instructions used to implement the following various method embodiments, etc.
  • the data storage area can also store data (such as phone book, audio and video data, chat record data) created by the terminal 100 during use.
  • FIG. 10 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer-readable medium 800 stores program code, and the program code can be invoked by a processor to execute the method described in the foregoing method embodiment.
  • the computer-readable storage medium 800 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 800 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 800 has storage space for the program code 810 for executing any method steps in the above-mentioned methods. These program codes can be read from or written into one or more computer program products.
  • the program code 810 may be compressed in a suitable form, for example.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Memory System (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Telephone Function (AREA)

Abstract

本申请公开了一种数据存储方法、装置、移动终端及存储介质,所述方法包括:获取内存中当前已被压缩的内存页;获取所述内存页的历史使用数据;根据所述历史使用数据,获取所述内存页中满足历史使用条件的内存页,作为目标内存页;对所述目标内存页再次进行压缩并存储。本方法可以节省内存空间,提升内存利用率。

Description

数据存储方法、装置、移动终端及存储介质
相关申请的交叉引用
本申请要求于2019年9月27日提交的申请号为201910927308.3的中国申请的优先权,其在此出于所有目的通过引用将其全部内容并入本文。
技术领域
本申请涉及移动终端技术领域,更具体地,涉及一种数据存储方法、装置、移动终端及存储介质。
背景技术
移动终端,例如手机、平板电脑等,已经成为人们日常生活中最常用的消费型电子产品之一。在移动终端中,内存一般由DRAM(Dynamic Random Access Memory,动态随机访问存储器)构成,由于DRAM集成度低,容量有限。随着用户需求的增加,移动终端中的应用程序越来越多,因此其内存空间的利用成为了研究问题。
发明内容
鉴于上述问题,本申请提出了一种数据存储方法、装置、移动终端及存储介质。
第一方面,本申请实施例提供了一种数据存储方法,所述方法包括:获取内存中当前已被压缩的内存页;获取所述内存页的历史使用数据;根据所述历史使用数据,获取所述内存页中满足历史使用条件的内存页,作为目标内存页;对所述目标内存页再次进行压缩并存储。
第二方面,本申请实施例提供了一种数据存储装置,所述装置包括:第一内存页获取模块、使用数据获取模块、第二内存页获取模块以及内存页压缩模块,其中,所述第一内存页获取模块用于获取内存中当前已被压缩的内存页;所述使用数据获取模块用于获取所述内存页的历史使用数据;所述第二内存页获取模块用于根据所述历史使用数据,获取所述内存页中满足历史使用条件的内存页,作为目标内存页;所述内存页压缩模块用于对所述目标内存页再次进行压缩并存储。
第三方面,本申请实施例提供了一种移动终端,包括:一个或多个处理器;存储器;一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行上述第一方面提供的数据存储方法。
第四方面,本申请实施例提供了一种计算机可读取存储介质,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行上述第一方面提供的数据存储方法。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1示出了根据本申请一个实施例的数据存储方法流程图。
图2示出了根据本申请另一个实施例的数据存储方法流程图。
图3示出了根据本申请又一个实施例的数据存储方法流程图。
图4示出了根据本申请再一个实施例的数据存储方法流程图。
图5示出了根据本申请一个实施例的数据存储装置的一种框图。
图6示出了根据本申请一个实施例的数据存储装置中第二内存页获取模块的框图。
图7示出了根据本申请一个实施例的数据存储装置的另一种框图。
图8示出了根据本申请一个实施例的数据存储装置中内存页压缩模块的框图。
图9是本申请实施例的用于执行根据本申请实施例的数据存储方法的移动终端的框图。
图10是本申请实施例的用于保存或者携带实现根据本申请实施例的数据存储方法的程序代码的存储单元。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
移动终端中,内存是重要的部件之一,内存是与CPU进行沟通的桥梁。移动终端中所有程序的运行都是在内存中进行的,因此内存的性能对移动终端的影响较大。内存一般由DRAM(Dynamic Random Access Memory,动态随机访问存储器)构成,由于DRAM集成度低,容量有限。
随着科技水平的发展,以及人们的需求不断增多,移动终端上安装的应用程序(Application,APP)越来越丰富。然而,各种应用程序的缓存以及无用进程的后台运行,会使移动终端的可用内存变得越来越少,出现内存不足的问题。传统的对内存进行管理的方式是,移动终端的内核会将一些内存页进行压缩后存放在内存,从而节省内存占用。
发明人经过长时间的研究发现,传统方式中虽然对一些内存页进行了压缩,但是这依然占据较大的内存空间。
针对上述问题,发明人提出了本申请实施例提供的数据存储方法、装置、移动终端以及存储介质,可以对内存中当前已被压缩的内存页中满足历史使用条件的内存页,进行再次压缩,从而节省内存空间,提升内存利用率。其中,具体的数据存储方法在后续的实施例中进行详细的说明。
请参阅图1,图1示出了本申请一个实施例提供的数据存储方法的流程示意图。所述数据存储方法用于对内存中当前已被压缩的内存页中满足历史使用条件的内存页,进行再次压缩,从而节省内存空间,提升内存利用率。在具体的实施例中,所述数据存储方法应用于如图5所示的数据存储装置400以及配置有所述数据存储装置400的移动终端100(图9)。下面将以移动终端为例,说明本实施例的具体流程,当然,可以理解的,本实施例所应用的移动终端可以为智能手机、平板电脑、电子书、智能手表等,在此不做限定。下面将针对图1所示的流程进行详细的阐述,所述数据存储方法具体可以包括以下步骤:
步骤S110:获取内存中当前已被压缩的内存页。
在本申请实施例中,当前已被压缩的内存页表示此前已经被压缩后保存于内存中的内存页。内存(又称随机存取存储器,random access memory,RAM)表示运行程序时使用的内存(即运行内存),只能临时存储数据,用于与处理器交换高速缓存数据,但是内存本身不能用于长期存储数据。应用在运行的状态下需要占用内存空间来存储运行过程中的数据,不同的应用在不同的运行状态占用的内存空间大小不一定相同。内存页是操作系统对内存进行管理的单位,其中,内存页占据的单位内存大小可以不作为限定,不同的移动终端设置的内存页占据的单位内存大小可以不同。
内存页可以包括匿名页、文件页等,在此不做限定。其中,匿名页指没有文件背景的页面,例如堆、栈、数据段等;文件页指有文件背景的页面,程序去读文件后在内存中产生的缓存,文件页也叫文件缓存。通常移动终端的系统内核会将一些内存页进行压缩后存放在内存中,以节省内存占用,因此,内存中通常会存在被压缩后的内存页。例如,对最近最少使用的匿名页进行压缩后存放在内存中。
在一些实施方式中,移动终端可以对内存页被压缩的操作进行记录,从而记录到被压缩过的内存页,移动终端根据对内存页的压缩记录,即可获取到当前已被压缩的内存页。
在另一些实施方式中,移动终端可以对被压缩后的内存页添加标记,例如,对内存页的名称进行标记等,在此不做限定。移动终端获取内存中存在的内存页,再根据该标记,即可获取到内存中当前已被压缩的内存页。
当然,移动终端获取内存中当前已被压缩的内存页的方式可以不作为限定。
作为一种实施方式,移动终端可以每间隔设定时长,获取内存中当前已被压缩的内存页,以从这些内存页中确定后续可以再次被压缩的内存页,对确定的内存页再次进行压缩,也就是说,每间隔设定时长执行一次本申请实施例提供的数据存储方法。
作为另一种实施方式,移动终端也可以接收用户输入的触发指令,根据用户输入的触发指令,执行获取内存中当前已被压缩的内存页,以从这些内存页中确定后续可以再次被压缩的内存页,对确定的内存页再次进行压缩,也就是说,根据用户的触发指令执行本申请实施例提供的数据存储方法。
当然,具体触发步骤S110的方式在本申请实施例中可以不作为限定。
步骤S120:获取所述内存页的历史使用数据。
移动终端可以对内存页的历史使用数据进行记录,以便可以根据记录对内存页进行管理。在一些实施方式中,移动终端可以对内存页的使用时间、使用次数、使用时长等进行记录,从而记录到内存页的历史使用数据。例如,移动终端可以根据对内存页的地址的访问,从而根据访问的时间、次数以及时长等,确定出对内存页的使用时间、使用次数、使用时长等。当然,具体的历史使用数据在本申请实施例中可以不作为限定。其中,历史使用时间可以为内存页每次被使用时的时间,历史使用次数可以为内存页被使用的总次数,历史使用时长可以为内存页被使用的总时长。
步骤S130:根据所述历史使用数据,获取所述内存页中满足历史使用条件的内存页,作为目标内存页。
移动终端在获取到当前已被压缩的内存页的历史使用数据后,则可以根据这些内存页的历史使用数据,确定这些内存页中满足历史使用条件的内存页,以便对满足历史使用条件的内存页进行再次压缩。
在本申请实施例中,移动终端可以根据当前已被压缩内存页中每个内存页的历史使用数据,确定这些内存页的历史使用时间、历史使用次数、历史使用时长中的一种或者多种是否满足历史使用条件。对此,移动终端中可以设置对于历史使用时间而言的历史使用条件、对于历史使用次数而言的历史使用条件以及历史使用时长而言的历史使用条件。
在一些实施方式中,对于历史使用时间的历史使用条件可以为,相邻两次使用内存页的历史使用时间之间的间隔是否大于第一预设间隔,例如,对于内存页A,相邻两次使用内存页A的历史使用时间的间隔为60小时,预设时间间隔为50小时,则该内存页A的历史使用时间满足历史使用条件;对于历史使用时间的历史使用条件也可以为,最近一次的使用时间距离当前时间的间隔是否大于第二预设间隔,例如,内存页B最近一次使用的历史使用时间距离当前时间的间隔为30小时,第二预设间隔为20小时,则内存页B的历史使用时间满足历史使用条件。当然,具体的历史使用时间对应的历史使用条件可以不作为限定。
在一些实施方式中,对于历史使用次数的历史使用条件可以为,内存页的历史使用次数是否小于预设次数,例如,内存页A的历史使用次数小于3次,则内存页A的历史使用次数满足历史使用条件;对于历史使用次数的历史使用条件也可以为,内存页的历史使用次数最小,对应地,根据历史使用数据,获取所述内存页每个内存页的所述历史使用次数,对所述每个内存页的所述历史使用次数的大小进行比较,获得比较结果,获取所述比较结果中所述历史使用次数最小的内存页,作为所述目标内存页,例如,当前已被压缩的内存页中,内存页B的历史使用次数最小,则内存页B的历史使用次数满足历史使用条件,将内存页B作为目标内存页。
在一些实施方式中,对于历史使用时长的历史使用条件可以为,内存页的历史使用时长是否小于预设时长,例如,内存页A的历史使用时长小于10分钟,则内存页A的历史使用时长满足历史使用条件;对于历史使用时长的历史使用条件也可以为,内存页的历史使用时长最小,对应地,根据历史使用数据,获取所述内存页每个内存页的所述历史使用时长,比较所述每个内存页的所述历史使用时长的大小,将所述历史使用时长最小的内存页作为所述目标内存页,例如,当前已被压缩的内存页中,内存页B的历史使用时长最小,则内存页B的历史使用时长满足历史使用条件,将内存页B作为目标内存页。
可以理解的,移动终端确定当前已被压缩的内存页中满足历史使用条件的内存页,可以确定历史使用时间、历史使用次数以及历史使用时长中的一种或者多种满足历史使用条件,例如,内存页A的历史使用时间以及历史使用次数同时满足历史使用条件,则表示内存页A满足历史使用条件,在此不做限定。
当然,在本申请实施例中,具体的历史使用条件可以不作为限定,历史使用条件可以用于从当前已被压缩的内存页中,获取较少使用、或者后续较长时间内不会使用的内存页。
移动终端从当前已被压缩的内存页中确定出满足历史使用条件的内存页后,则可以将满足历史使用条件的内存页,作为目标内存页,目标内存页即为后续可以进行再次压缩的内存页。
步骤S140:对所述目标内存页再次进行压缩并存储。
在本申请实施例中,移动终端在从当前已被压缩的内存页中,确定出满足历史使用条件的内存页后,则可以对这些目标内存页再次进行压缩,以减少目标内存页占用的内存。从而可以实现对内存页的多层级(多次)压缩,具体压缩的层级以及每次压缩的大小可以按实际需求设定。
本申请实施例提供的数据存储方法,通过获取内存中当前已被压缩的内存页,获取内存页的历史使用数据,根据历史使用数据,获取内存页中满足历史使用条件的内存页,作为目标内存页,对目标内存页再次进行压缩并存储,从而实现对内存页的深度压缩,可以节省内存空间,提升内存利用率。
请参阅图2,图2示出了本申请另一个实施例提供的数据存储方法的流程示意图。该方法应用于上述移动终端,下面将针对图2所示的流程进行详细的阐述,所述数据存储方法具体可以包括以下步骤:
步骤S210:获取内存中当前已被压缩的内存页。
步骤S220:获取所述内存页的历史使用数据。
在本申请实施例中,步骤S210以及步骤S220可以参阅前述实施例的内容,在此不再赘述。其中,获取的当前已被压缩的内存页的历史使用数据可以至少包括历史使用时间。
步骤S230:根据所述历史使用时间,获取所述内存页每个内存页最近一次被使用的时间。
在本申请实施例中,移动终端可以根据当前已被压缩的内存页的历史使用时间, 确定这些内存页的历史使用时间是否满足历史使用条件,以从这些内存页中获得满足历史使用条件的内存页。
在一些实施方式中,移动终端可以根据当前已被压缩的内存页的历史使用时间,获取当前已被压缩的内存页中每个内存页的最近一次被使用的时间。例如,当前已被压缩的内存页中包括内存页C,获取的内存页C的历史使用时间包括2019年9月10日16点45分、2019年9月15日10点30分以及2019年9月18日17点12分,移动终端执行该数据存储方法的当前时间为2019年9月18日19点20分,则内存页C的最近一次被使用的时间为2019年9月18日17点12分。
步骤S240:对所述每个内存页最近一次被使用的时间,按照时间先后顺序进行排序,获得排序结果。
在本申请实施例中,移动终端在获取到当前已被压缩的内存页中每个内存页的最近一次被使用的时间之后,则可以按照时间先后顺序对这些最近一次被使用的时间进行排序,以便后续根据排序结果确定满足历史使用条件的内存页。例如,当前已被压缩的内存页包括内存页A、内存页B以及内存页C,内存页A的最近一次被使用的时间为2019年9月17日9点08分,内存页B的最近一次被使用的时间为2019年9月16日16点24分,内存页C的最近一次被使用的时间为2019年9月18日19点00分,则按照时间先后顺序,对内存页A的一次最近被使用的时间、内存页B的一次最近被使用的时间以及内存页C的一次最近被使用的时间进行排序,排序结果为2019年9月16日16点24分,2019年9月17日9点08分,2019年9月18日19点00分。
步骤S250:获取所述排序结果中首位对应的内存页,作为目标内存页。
在本申请实施例中,移动终端在按照时间先后顺序,对当前已被压缩的内存页中每个内存页对应的最近一次被使用的时间进行排序后,则可以根据排序结果,确定满足历史使用条件的内存页。具体的,移动终端可以从排序结果中,获取排在首位的最近一次被使用的时间,并将该首位对应的内存页,确定为满足历史使用条件的内存页,将该首位对应的内存页作为目标内存页,即后续可以进行再次压缩的内存页。可以理解的,该目标内存页的最近一次使用的时间距离当前时间最久,表征该内存页很久未被使用,后续可能也不会被使用,因此可以将该内存页作为可再次被压缩的目标内存页。
步骤S260:对所述目标内存页再次进行压缩并存储。
在本申请实施例中,移动终端在确定出目标内存页后,还可以确定该目标内存页是否满足可再次被压缩的条件,例如该目标内存页的压缩率是否达到设定阈值,即该目标内存页是否已经被压缩到最小而不能再被压缩。如果确定出目标内存页满足再次被压缩的条件,则可以对目标内存页再次进行压缩,实现对内存页的多层级的压缩。
本申请实施例提供的数据存储方法,通过获取内存中当前已被压缩的内存页,获取内存页的历史使用数据,根据历史使用数据中每个已被压缩的内存页的最近一次被使用的时间,对这些内存页中每个内存页最近一次被使用的时间,按照时间先后顺序进行排序,获得排序结果,将排序结果中首位对应的内存页,作为目标内存页,然后对目标内存页再次进行压缩并存储,从而实现对长时间未使用的内存页的深度压缩,可以节省内存空间,提升内存利用率。
请参阅图3,图3示出了本申请又一个实施例提供的数据存储方法的流程示意图。该方法应用于上述移动终端,下面将针对图3所示的流程进行详细的阐述,所述数据存储方法具体可以包括以下步骤:
步骤S310:获取内存中当前已被压缩的内存页。
步骤S320:获取所述内存页的历史使用数据。
在本申请实施例中,步骤S310以及步骤S320可以参阅前述实施例的内容,在此不再赘述。
步骤S330:根据所述历史使用数据,获取所述内存页中满足历史使用条件的内存页,作为目标内存页。
在本申请实施例中,历史使用条件可以包括:在预设时间段内的历史使用次数小于第一设定次数、在所述预设时间段内的历史使用时长小于设定时长、在所述预设时间段内的历史使用次数最少、或者在所述预设时间段内的历史使用时长最小。
在一些实施方式中,预设时间段可以为当前时间以前预设时长内的时间段,即最近预设时长内的时间段,预设时长可以为24小时,也可以为36小时等,在此不做限定。可以理解的,在预设时间段内,如果当前已被压缩的内存页中存在历史使用次数小于第一设定次数的内存页,表示该内存页在被压缩后,最近一段时间内不常被使用,因此可以将该内存页再进行压缩,而将该内存页作为目标内存页。在预设时间段内,如果当前已被压缩的内存页中存在历史使用时长小于设定时长,表示该内存页在被压缩后,最近一段时间内被使用的时间较短,即该内存页不常被使用,因此可以将该内存页再进行压缩,而将该内存页作为目标内存页。在预设时间段内,目标内存页对应的历史使用次数最少,也可以表示该内存页不常被使用,因此可以对该内存页再进行压缩,而将该内存页作为目标内存页。在预设时间段内,目标内存页对应的历史使用时长最少,也可以表示该内存页不常被使用,因此可以对该内存页再进行压缩,而将该内存页作为目标内存页。其中,具体的第一设定次数以及设定时长可以不作为限定,例如,第一设定次数可以为1,也可以2,设定时长可以为0.1分钟,也可以为2分钟。
在本申请实施例中,历史使用条件也可以为上述历史使用条件的结合,例如,历史使用条件可以为历史时长时长最小且历史使用时长小于设定时长,历史使用条件也可以为历史次数时长最小且历史使用次数小于第一设定次数,具体的历史使用条件可以不做限定。
步骤S340:获取所述目标内存页已被压缩的压缩次数。
在本申请实施例中,移动终端从当前已被压缩的内存页中,确定出满足历史使用条件的目标内存页后,在对目标内存页再次进行压缩之前,还可以获取目标内存页已被压缩的压缩次数,以根据已被压缩的次数,确定目标内存页是否可以再次被压缩。
在一些实施方式中,目标内存页被压缩的次数指目标内存页相对未被压缩的状态下被压缩的次数。例如,对于内存页A,被压缩前的原始大小为150兆(MB),在2019年9月10日10点10分被压缩为50MB,在2019年9月11日12点10分被使用,则该内存页给解压后使用,恢复至150MB大小,在2019年9月13日11点12分又被压缩至50MB,而当前时间之前未对内存页A压缩以及解压,则内存页对应的压缩次数为1;又例如,对于内存页B,被压缩前的原始大小为300MB,在2019年9月12日11点00分被压缩为100MB,在2019年9月14日11点20分再次被压缩,由100MB被压缩至30MB,而当前时间之前未对内存页B压缩以及解压,则内存页对应的压缩次数为2。
在一些实施方式中,移动终端可以根据记录的内存页的压缩记录,获取目标内存页已被压缩的压缩次数。可以理解的,移动终端每次对内存页压缩时,均可以记录到压缩记录中,从而移动终端可以根据压缩记录获取到目标内存页已被压缩的压缩次数。
步骤S350:判断所述压缩次数是否小于第二设定次数。
在本申请实施例中,移动终端在获取到被压缩的压缩次数后,可以判断该目标内存页被压缩的压缩次数是否小于第二设定次数。其中,第二设定次数可以为预先设置的可以对内存页进行压缩的次数,即设置的可进行压缩的层级,具体的压缩次数可以根据实际需求设置,例如,可以设置为3次,也可以设置为4次。如果该压缩次数达到第二设定次数(等于或者大于第二设定次数),则表示当前内存页被压缩的层级已经达到设定的层级,而不能再被压缩;如果该压缩次数未达到第二设定次数(小于第二设定次数),则表示当前内存页被压缩的层级未达到设定的层级,即可以再被压缩。
步骤S360:如果所述压缩次数小于第二设定次数,执行所述对所述目标内存页再次进行压缩并存储。
在本申请实施例中,如果步骤S350判断出压缩次数小于第二设定次数,则可以对目标内存页再次进行压缩并存放在内存中。
在本申请实施例中,如果目标内存页被压缩的次数小于第二设定次数时,对目标内存页再次进行压缩并存储,可以包括:
如果所述压缩次数小于第二设定次数,获取所述压缩次数对应的压缩率;根据所述压缩率,对所述目标内存页再次进行压缩并存储。
可以理解的,当内存页被压缩多次后,内存页被压缩的层级越深(压缩次数越多),其每次可压缩的难度会加大,压缩大小的也会变小,因此,可以设置压缩次数与压缩率的对应关系,即压缩层级与压缩率的对应关系,压缩次数越多,压缩率则越高。压缩率指文件压缩后的大小与压缩前的大小之比。例如,内存页在进行第一层级的压缩时,压缩率可以为0.33,内存页在进行第二层级的压缩时,压缩率可以为0.44,在进行第三层级的压缩时,压缩率可以为0.5,当然,以上压缩率仅为举例,并不代表对本申请实施例中具体的压缩率的限定。
进一步的,移动终端可以根据压缩次数与压缩率的对应关系,获取与目标内存页的压缩次数对应的压缩率,再根据获得的压缩率,对目标内存页再次进行压缩并存储。
在一些实施方式中,该数据存储方法还可以包括:如果当前已被压缩的内存页的压缩次数等于或者大于第二设定次数,可以不执行对目标内存页进行压缩。
在另一些实施方式中,该数据存储方法还可以包括:如果所述压缩次数等于或者大于所述第二设定次数,且所述压缩次数小于第三设定次数,判断所述内存的剩余内存是否小于内存阈值,所述第三设定次数大于所述第二设定次数;如果所述剩余内存小于所述内存阈值,对所述目标内存页再次进行压缩并存储;如果所述压缩次数等于或者大于所述第二设定次数,且所述压缩次数不小于所述第三设定次数,不对所述目标内存页进行再次压缩。
可以理解的,如果目标内存页的被压缩的压缩次数等于或者大于第二设定次数,则表示目标内存页被压缩的压缩次数达到了设置的次数,该情况下,目标内存页仍可以被压缩一定的大小,但压缩的难度相对较大,因此通常情况下不会再进行压缩,而在移动终端的系统剩余内存较低的情况下,则可以对该目标内存页进行压缩,以减少内存的占用,增加系统的剩余内存。
因此,如果移动终端判断出目标内存页的压缩次数等于或者大于第二设定次数,则可以获取移动终端当前的剩余内存,以确定剩余内存是否小于内存阈值。其中,移动终端可以通过检测内存的使用情况的方式获得移动终端的剩余内存,例如,当移动终端的操作系统为Android系统时,通过ActivityManager.getMemoryInfo(ActivityManager.MemoryInfo)方法可以获取移动终端的内存当前的可用内存量,即获取移动终端的剩余内存。
移动终端在获取到剩余内存后,则可以判断剩余内存是否小于内存阈值,其中,内存阈值的大小可以不作为限定,例如,可以设置为对目标内存页进行压缩次数达到第二设定次数时的压缩,不会对移动终端的运行造成影响的大小。如果移动终端的剩余内存小于内存阈值,则表示移动终端当前的剩余内存较少,因此可以再对目标内存页进行压缩,而减少内存的占用,增加移动终端的可用内存。如果移动终端的剩余内存等于或者大于内存阈值,则表示移动终端的剩余内存较多,因此,可以不再对目标内存页进行压缩,以避免压缩次数达到第二设定次数时,压缩难度较大,增加系统负担。
在本申请实施例中,该数据存储方法还可以包括:在预设时长后,再次执行所述获取内存中当前已被压缩的内存页的步骤,至所述对所述目标内存页再次进行压缩并 存储的步骤,直至所述目标内存页的压缩率小于设定压缩率。可以理解的,移动终端可以每间隔预设时长,执行一次本申请实施例提供的数据存储方法,从而可以实现对内存页的多层级压缩,达到对内存页的深度压缩的效果,提升内存利用率。
本申请实施例提供的数据存储方法,通过获取内存中当前已被压缩的内存页,获取当前已被压缩的内存页中每个内存页的历史使用数据,根据历史使用数据,获取当前已被压缩的内存页中满足历史使用条件的内存页作为目标内存页,再获取目标内存页已被压缩的压缩次数,然后判断压缩次数是否小于第二设定次数,如果目标内存页的压缩次数小于第二设定次数,执行对目标内存页再次进行压缩并存储,从而实现对满足历史使用条件的已被压缩的内存页的深度压缩,可以节省内存空间,提升内存利用率。
请参阅图4,图4示出了本申请再一个实施例提供的数据存储方法的流程示意图。该方法应用于上述移动终端,下面将针对图4所示的流程进行详细的阐述,所述数据存储方法具体可以包括以下步骤:
步骤S410:获取内存中当前已被压缩的内存页。
步骤S420:获取所述内存页的历史使用数据。
步骤S430:根据所述历史使用数据,获取所述内存页中满足历史使用条件的内存页,作为目标内存页。
在本申请实施例中,步骤S410至步骤S430可以参阅前述实施例的内存,在此不再赘述。
步骤S440:根据所述历史使用数据,确定与所述历史使用数据对应的压缩率。
在本申请实施例中,移动终端在从当前已被压缩的内存页中,确定出满足历史使用条件的目标内存页后,在对目标内存页进行再次压缩时,可以根据历史使用数据,确定与历史使用数据对应的压缩率,以使本次的压缩率与目标内存页的历史使用数据对应。
在一些实施方式中,移动终端可以根据历史使用数据中的历史使用时间、历史使用次数、历史使用时长等,确定历史使用数据对应的压缩率。作为一种方式,目标内存页的历史使用次数越多,则表示目标内存页被使用的可能性越高,因此历史使用次数越多,则本次的压缩率越高,以避免该目标内存页被再次使用时的解压难度较大,增加移动终端的系统负担。作为另一种方式,目标内存页的相邻两次被使用时的历史使用时间的间隔越短,则表示目标内存页被使用的可能性越高,因此该间隔越短,则本次的压缩率越高,以避免该目标内存页被再次使用时的解压难度较大,增加移动终端的系统负担。作为又一种方式,目标内存页的历史使用时长越长,则表示目标内存页被使用的可能性越高,因此历史使用时长越长,则本次的压缩率越高,以避免该目标内存页被再次使用时的解压难度较大,增加移动终端的系统负担。当然,具体根据历史使用数据确定压缩率的方式可以不作为限定,例如,也可以同时根据历史使用时间、历史使用次数以及历史使用时长,共同确定本次对目标内存页的压缩率,可以更为全面的评估目标内存页被使用的可能性。
步骤S450:根据所述压缩率,对所述目标内存页再次进行压缩并存储。
本申请实施例提供的数据存储方法,通过获取内存中当前已被压缩的内存页,获取当前已被压缩的内存页中每个内存页的历史使用数据,根据历史使用数据,获取当前已被压缩的内存页中满足历史使用条件的内存页作为目标内存页,然后根据历史使用数据,确定与历史使用数据对应的压缩率,最后根据压缩率对目标内存页进行压缩,使得本次对目标内存页压缩的压缩率与该目标内存页的历史使用数据对应,从而实现对满足历史使用条件的已被压缩的内存页的深度压缩,可以节省内存空间,提升内存利用率,也避免了该目标内存页被再次使用时的解压难度较大,增加移动终端的系统负担。
请参阅图5,其示出了本申请实施例提供的一种数据存储装置400的结构框图。该数据存储装置400应用上述的移动终端,该数据存储装置400包括:第一内存页获取模块410、使用数据获取模块420、第二内存页获取模块430以及内存页压缩模块440。其中,所述第一内存页获取模块410用于获取内存中当前已被压缩的内存页;所述使用数据获取模块420用于获取所述内存页的历史使用数据;所述第二内存页获取模块430用于根据所述历史使用数据,获取所述内存页中满足历史使用条件的内存页,作为目标内存页;所述内存页压缩模块440用于对所述目标内存页再次进行压缩并存储。
在一些实施方式中,所述历史使用数据可以包括历史使用时间。请参见图6,第二内存页获取模块430可以包括时间获取单元431、时间排序单元432以及内存页确定单元433。时间获取单元431用于根据所述历史使用时间,获取所述内存页每个内存页最近一次被使用的时间;时间排序单元432用于对所述每个内存页最近一次被使用的时间,按照时间先后顺序进行排序,获得排序结果;内存页确定单元433用于获取所述排序结果中首位对应的内存页,作为目标内存页。
在另一些实施方式中,所述历史使用条件可以包括:在预设时间段内的历史使用次数小于第一设定次数、在所述预设时间段内的历史使用时长小于设定时长、在所述预设时间段内的历史使用次数最少、或者在所述预设时间段内的历史使用时长最小。
在本申请实施例中,请参见图7,该数据存储装置400还可以包括:压缩次数获取模块450以及压缩次数判断模块460。压缩次数获取模块450用于内存页压缩模块440对所述目标内存页再次进行压缩并存储之前,获取所述目标内存页已被压缩的压缩次数;压缩次数判断模块460用于判断所述压缩次数是否小于第二设定次数;如果所述压缩次数小于第二设定次数,内存页压缩模块440对所述目标内存页再次进行压缩并存储。
进一步的,内存页压缩模块440可以具体用于:如果所述压缩次数小于第二设定次数,获取所述压缩次数对应的压缩率;根据所述压缩率,对所述目标内存页再次进行压缩并存储。
在一些实施方式中,该数据存储装置400还可以包括内存判断模块。内存判断模块用于如果所述压缩次数等于或者大于所述第二设定次数,且所述压缩次数小于第三设定次数,判断所述内存的剩余内存是否小于内存阈值,所述第三设定次数大于所述第二设定次数;内存页压缩模块440还可以用于如果所述剩余内存小于所述内存阈值,对所述目标内存页再次进行压缩并存储。
在一些实施方式中,请参见图8,内存页压缩模块440可以包括:压缩率获取单元441以及压缩执行单元442。压缩率获取单元441用于根据所述历史使用数据,确定与所述历史使用数据对应的压缩率;压缩执行单元442用于根据所述压缩率,对所述目标内存页再次进行压缩并存储。
在本申请实施例中,该数据存储装置400还可以包括再执行模块。再执行模块用于在预设时长后,再次执行所述获取内存中当前已被压缩的内存页的步骤,至所述对所述目标内存页再次进行压缩并存储的步骤,直至所述目标内存页的压缩率小于设定压缩率。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性,机械或其它形式的耦合。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
综上所述,本申请提供的方案,通过获取内存中当前已被压缩的内存页,获取内 存页的历史使用数据,根据历史使用数据,获取内存页中满足历史使用条件的内存页,作为目标内存页,对目标内存页再次进行压缩并存储,从而实现对内存页的深度压缩,可以节省内存空间,提升内存利用率。
请参考图9,其示出了本申请实施例提供的一种移动终端的结构框图。该移动终端100可以是智能手机、平板电脑、电子书、智能穿戴设备等能够运行应用程序的电子设备。本申请中的移动终端100可以包括一个或多个如下部件:处理器110、存储器120、以及一个或多个应用程序,其中一个或多个应用程序可以被存储在存储器120中并被配置为由一个或多个处理器110执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。
处理器110可以包括一个或者多个处理核。处理器110利用各种接口和线路连接整个移动终端100内的各个部分,通过运行或执行存储在存储器120内的指令、程序、代码集或指令集,以及调用存储在存储器120内的数据,执行移动终端100的各种功能和处理数据。可选地,处理器110可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器110可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器110中,单独通过一块通信芯片进行实现。
存储器120可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器120可用于存储指令、程序、代码、代码集或指令集。存储器120可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储终端100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。
请参考图10,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质800中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。
计算机可读存储介质800可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质800包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质800具有执行上述方法中的任何方法步骤的程序代码810的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码810可以例如以适当形式进行压缩。
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种数据存储方法,其特征在于,所述方法包括:
    获取内存中当前已被压缩的内存页;
    获取所述内存页的历史使用数据;
    根据所述历史使用数据,获取所述内存页中满足历史使用条件的内存页,作为目标内存页;
    对所述目标内存页再次进行压缩并存储。
  2. 根据权利要求1所述的方法,其特征在于,所述历史使用数据包括历史使用时间,所述根据所述历史使用数据,获取所述内存页中满足历史使用条件的内存页,作为目标内存页,包括:
    根据所述历史使用时间,获取所述内存页每个内存页最近一次被使用的时间;
    对所述每个内存页最近一次被使用的时间,按照时间先后顺序进行排序,获得排序结果;
    获取所述排序结果中首位对应的内存页,作为目标内存页。
  3. 根据权利要求1所述的方法,其特征在于,所述历史使用数据包括历史使用次数,所述根据所述历史使用数据,获取所述内存页中满足历史使用条件的内存页,作为目标内存页,包括:
    根据所述历史使用数据,获取所述内存页每个内存页的所述历史使用次数;
    对所述每个内存页的所述历史使用次数的大小进行比较,获得比较结果;
    获取所述比较结果中所述历史使用次数最小的内存页,作为所述目标内存页。
  4. 根据权利要求1所述的方法,其特征在于,所述历史使用数据包括历史使用时长,所述根据所述历史使用数据,获取所述内存页中满足历史使用条件的内存页,作为目标内存页,包括:
    根据所述历史使用数据,获取所述内存页每个内存页的所述历史使用时长;
    比较所述每个内存页的所述历史使用时长的大小;
    将所述历史使用时长最小的内存页作为所述目标内存页。
  5. 根据权利要求1所述的方法,其特征在于,所述历史使用条件包括:
    在预设时间段内的历史使用次数小于第一设定次数、在所述预设时间段内的历史使用时长小于设定时长、在所述预设时间段内的历史使用次数最少、或者在所述预设时间段内的历史使用时长最小。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,在所述对所述目标内存页再次进行压缩并存储之前,所述方法还包括:
    获取所述目标内存页已被压缩的压缩次数;
    判断所述压缩次数是否小于第二设定次数;
    如果所述压缩次数小于第二设定次数,执行所述对所述目标内存页再次进行压缩并存储。
  7. 根据权利要求6所述的方法,其特征在于,所述如果所述压缩次数小于第二设定次数,执行所述对所述目标内存页再次进行压缩并存储,包括:
    如果所述压缩次数小于第二设定次数,获取所述压缩次数对应的压缩率;
    根据所述压缩率,对所述目标内存页再次进行压缩并存储。
  8. 根据权利要求6所述的方法,其特征在于,所述方法还包括:
    如果所述压缩次数等于或者大于所述第二设定次数,且所述压缩次数小于第三设定次数,判断所述内存的剩余内存是否小于内存阈值,所述第三设定次数大于所述第 二设定次数;
    如果所述剩余内存小于所述内存阈值,对所述目标内存页再次进行压缩并存储。
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括:
    如果所述压缩次数等于或者大于所述第二设定次数,且所述压缩次数不小于所述第三设定次数,不对所述目标内存页进行再次压缩。
  10. 根据权利要求1-9任一项所述的方法,其特征在于,所述对所述目标内存页再次进行压缩并存储,包括:
    根据所述历史使用数据,确定与所述历史使用数据对应的压缩率;
    根据所述压缩率,对所述目标内存页再次进行压缩并存储。
  11. 根据权利要求10所述的方法,其特征在于,所述历史使用数据包括所述历史使用次数,所述根据所述历史使用数据,确定与所述历史使用数据对应的压缩率,包括:
    根据所述历史使用次数确定与所述历史使用数据对应的压缩率。
  12. 根据权利要求10所述的方法,其特征在于,所述历史使用数据包括所述历史使用时间,所述根据所述历史使用数据,确定与所述历史使用数据对应的压缩率,包括:
    根据所述历史使用时间的间隔长短确定与所述历史使用数据对应的压缩率。
  13. 根据权利要求10所述的方法,其特征在于,所述历史使用数据包括所述历史使用时长,所述根据所述历史使用数据,确定与所述历史使用数据对应的压缩率,包括:
    根据所述历史使用时长确定与所述历史使用数据对应的压缩率。
  14. 根据权利要求10所述的方法,其特征在于,所述根据所述历史使用数据,确定与所述历史使用数据对应的压缩率,包括:
    根据所述历史使用时间、所述历史使用次数以及所述历史使用时长,共同确定与所述历史使用数据对应的压缩率。
  15. 根据权利要求1-14任一项所述的方法,其特征在于,所述获取内存中当前已被压缩的内存页,包括:
    每间隔设定时长,获取内存中当前已被压缩的内存页。
  16. 根据权利要求1-14任一项所述的方法,其特征在于,所述获取内存中当前已被压缩的内存页,还包括:
    接收用户输入的触发指令;
    根据所述触发指令获取内存中当前已被压缩的内存页。
  17. 根据权利要求1-16任一项所述的方法,其特征在于,所述方法还包括:
    在预设时长后,再次执行所述获取内存中当前已被压缩的内存页的步骤,至所述对所述目标内存页再次进行压缩并存储的步骤,直至所述目标内存页的压缩率小于设定压缩率。
  18. 一种数据存储装置,其特征在于,所述装置包括:第一内存页获取模块、使用数据获取模块、第二内存页获取模块以及内存页压缩模块,其中,
    所述第一内存页获取模块用于获取内存中当前已被压缩的内存页;
    所述使用数据获取模块用于获取所述内存页的历史使用数据;
    所述第二内存页获取模块用于根据所述历史使用数据,获取所述内存页中满足历史使用条件的内存页,作为目标内存页;
    所述内存页压缩模块用于对所述目标内存页再次进行压缩并存储。
  19. 一种移动终端,其特征在于,包括:
    一个或多个处理器;
    存储器;
    一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行如权利要求1-17任一项所述的方法。
  20. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1-17任一项所述的方法。
PCT/CN2020/116555 2019-09-27 2020-09-21 数据存储方法、装置、移动终端及存储介质 WO2021057665A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910927308.3 2019-09-27
CN201910927308.3A CN110765031B (zh) 2019-09-27 2019-09-27 数据存储方法、装置、移动终端及存储介质

Publications (1)

Publication Number Publication Date
WO2021057665A1 true WO2021057665A1 (zh) 2021-04-01

Family

ID=69330590

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/116555 WO2021057665A1 (zh) 2019-09-27 2020-09-21 数据存储方法、装置、移动终端及存储介质

Country Status (2)

Country Link
CN (1) CN110765031B (zh)
WO (1) WO2021057665A1 (zh)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110765031B (zh) * 2019-09-27 2022-08-12 Oppo广东移动通信有限公司 数据存储方法、装置、移动终端及存储介质
WO2021243531A1 (zh) * 2020-06-02 2021-12-09 深圳市欢太科技有限公司 数据压缩方法、装置、电子设备及存储介质
CN111949564B (zh) * 2020-08-13 2024-05-17 Vidaa(荷兰)国际控股有限公司 一种内存交换方法及显示设备
CN112463039B (zh) * 2020-11-17 2023-05-12 浙江大华技术股份有限公司 数据存储方法、设备以及存储介质
CN112540984B (zh) * 2020-11-23 2023-10-03 成都佳华物链云科技有限公司 数据存储方法、查询方法、装置、电子设备及存储介质
CN117666929A (zh) * 2022-08-29 2024-03-08 华为技术有限公司 一种数据存储方法及相关装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1672135A (zh) * 2002-08-06 2005-09-21 国际商业机器公司 基于可压缩性程度使用压缩主存储器的系统和方法
US20190181881A1 (en) * 2017-12-08 2019-06-13 Toshiba Memory Corporation Data processing apparatus, memory system, and method of processing data
CN110275870A (zh) * 2019-05-22 2019-09-24 深圳壹账通智能科技有限公司 缓存文件的管理方法、装置、计算机设备及存储介质
CN110765031A (zh) * 2019-09-27 2020-02-07 Oppo(重庆)智能科技有限公司 数据存储方法、装置、移动终端及存储介质

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090100195A1 (en) * 2007-10-11 2009-04-16 Barsness Eric L Methods and Apparatus for Autonomic Compression Level Selection for Backup Environments
WO2013147819A1 (en) * 2012-03-29 2013-10-03 Intel Corporation Compression-enabled blending of data in non-volatile memory
CN106648469B (zh) * 2016-12-29 2020-01-17 华为技术有限公司 一种缓存数据处理方法、装置和存储控制器
CN106843450A (zh) * 2017-01-23 2017-06-13 努比亚技术有限公司 一种终端应用的存储处理方法和装置
CN109299112B (zh) * 2018-11-15 2020-01-17 北京百度网讯科技有限公司 用于处理数据的方法和装置
CN109656722B (zh) * 2019-01-04 2021-05-11 Oppo广东移动通信有限公司 内存优化方法、装置、移动终端及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1672135A (zh) * 2002-08-06 2005-09-21 国际商业机器公司 基于可压缩性程度使用压缩主存储器的系统和方法
US20190181881A1 (en) * 2017-12-08 2019-06-13 Toshiba Memory Corporation Data processing apparatus, memory system, and method of processing data
CN110275870A (zh) * 2019-05-22 2019-09-24 深圳壹账通智能科技有限公司 缓存文件的管理方法、装置、计算机设备及存储介质
CN110765031A (zh) * 2019-09-27 2020-02-07 Oppo(重庆)智能科技有限公司 数据存储方法、装置、移动终端及存储介质

Also Published As

Publication number Publication date
CN110765031B (zh) 2022-08-12
CN110765031A (zh) 2020-02-07

Similar Documents

Publication Publication Date Title
WO2021057665A1 (zh) 数据存储方法、装置、移动终端及存储介质
CN109756230B (zh) 数据压缩存储方法、数据压缩方法、装置、设备及介质
CN111352861B (zh) 内存压缩方法、装置及电子设备
US9946464B2 (en) Systems and methods for predicting compressibility of data
KR100690804B1 (ko) 휴대단말기의 메모리 정리 방법
CN110764906B (zh) 内存回收处理方法、装置、电子设备以及存储介质
US10649905B2 (en) Method and apparatus for storing data
WO2021057619A1 (zh) 内存回收方法、装置、电子设备及存储介质
EP3958120A1 (en) Method and device for anonymous page management, terminal device, and readable storage medium
WO2021057623A1 (zh) 内存回收方法、装置、电子设备及存储介质
WO2021057622A1 (zh) 内存回收方法、装置、电子设备及存储介质
TWI634421B (zh) 用以存取資料之電子裝置及其資料存取方法
CN113873255B (zh) 一种视频数据传输方法、视频数据解码方法及相关装置
CN111857574A (zh) 一种写请求数据压缩方法、系统、终端及存储介质
CN112840663B (zh) 视频编码方法、装置、电子设备及存储介质
CN109508782B (zh) 基于神经网络深度学习的加速电路和方法
WO2021243531A1 (zh) 数据压缩方法、装置、电子设备及存储介质
US20220357980A1 (en) Selectively offloading the compression and decompression of files to a hardware controller
WO2021179170A1 (zh) 数据推送方法、装置、服务器及存储介质
CN111459682A (zh) 频率调整方法、装置、电子设备以及存储介质
US20200250101A1 (en) System and method for intelligent tile-based memory bandwidth management
CN116027968A (zh) 闪存块读取次数压缩方法、装置、计算机设备及存储介质
WO2021077263A1 (zh) 耗电日志处理方法、装置、电子设备以及存储介质
JP2018505489A (ja) システムオンチップにおける動的メモリ利用
CN111966472A (zh) 一种工业实时操作系统的进程调度方法及系统

Legal Events

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

Ref document number: 20868231

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20868231

Country of ref document: EP

Kind code of ref document: A1