WO2015085732A1 - 终端内存处理方法、装置及终端 - Google Patents

终端内存处理方法、装置及终端 Download PDF

Info

Publication number
WO2015085732A1
WO2015085732A1 PCT/CN2014/079532 CN2014079532W WO2015085732A1 WO 2015085732 A1 WO2015085732 A1 WO 2015085732A1 CN 2014079532 W CN2014079532 W CN 2014079532W WO 2015085732 A1 WO2015085732 A1 WO 2015085732A1
Authority
WO
WIPO (PCT)
Prior art keywords
cache
cached
level
cache area
area
Prior art date
Application number
PCT/CN2014/079532
Other languages
English (en)
French (fr)
Inventor
王正和
陈华
陈小强
丁岩
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2015085732A1 publication Critical patent/WO2015085732A1/zh

Links

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/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems

Definitions

  • the present invention relates to the field of communications, and in particular to a terminal memory processing method, apparatus, and terminal.
  • BACKGROUND OF THE INVENTION In the context of the popularity of mobile Internet applications, applications on mobile terminals have to stand out, and a good experience for applications is indispensable. For example, when an application obtains network picture data from a network, it is entirely possible for the user to perform some repetitive operations to view the same picture information. For such problems, there are usually two solutions: One is to store the image information that has been viewed in the past in memory, and the life cycle of each Java object that stores the image information runs through the entire application life cycle.
  • the method speeds up the access speed of the data, but it is often easy to cause an OutOflvlemoryException; the other is that when the user starts to view other picture information, the Java object storing the current picture information is end-referenced, so that the garbage collector can recycle it.
  • the memory space when the user needs to browse the picture information again, re-acquire the picture information, this method greatly reduces the possibility of OutOflvlemoryException, but reduces the user experience.
  • the first implementation will cause a lot of memory waste, and the second implementation has the drawback that even if the garbage collection thread has not been garbage collected, the object containing the image information is still stored in memory, and the application has to be rebuilt. An object.
  • a picture loading method and apparatus of the Android system are disclosed.
  • This patent only uses a soft reference method for image loading.
  • the method includes: A. issuing an instruction for loading a picture, and initializing a soft reference for storing the picture; B. determining whether the picture to be displayed is stored in the soft reference; C. if the soft reference does not store the If the picture to be displayed is loaded, the image loading thread is loaded for loading; if the picture to be displayed is stored in the soft reference, the process directly proceeds to step F; D. if the memory is insufficient, the content stored in the soft reference is automatically recovered. The picture is loaded until the memory is sufficient; E.
  • the picture to be displayed is loaded and stored in the soft reference; F.
  • the picture to be displayed is directly read from the soft reference and displayed.
  • memory resources are relatively scarce, and only soft references may not achieve the best cache effect. Therefore, in the related art, there is a problem that the terminal memory is relatively tight and the user experience of the terminal application is highly demanded.
  • the present invention provides a terminal memory processing method and apparatus, so as to at least solve the problem of contradiction in the related art that the terminal memory is relatively tight and the user experience of the terminal application is very high.
  • a terminal memory processing method including: dividing the terminal memory into a plurality of cache areas; classifying the plurality of cache areas; The cache object in the terminal memory is hierarchically cached.
  • the dividing the terminal memory into the plurality of cache areas comprises: dividing the terminal memory into a first-level cache area and a second-level cache area, wherein the cache object in the first-level cache area is prohibited from being garbage The recycler recycles, and the cache object in the secondary cache area is recovered by the garbage collector when the predetermined storage capacity is satisfied.
  • the hierarchical cache processing of the cached object in the memory of the terminal according to the cached area after the grading includes: determining whether the cached object in the first-level cache area exceeds a predetermined capacity; if the determination result is yes And converting the cached object cached in the first level cache area to being cached in the second level cache area.
  • converting the cached object in the L1 cache area to the cache in the L2 cache area comprises: sorting cached objects in the L1 cache area according to the amount of access; A cache object with a small amount of access in the level 1 cache area is converted to be cached in the level 2 cache area.
  • the L1 cache area caches the cache object in the L1 cache area by using a chain hash map LinkHashMap container.
  • the L2 cache area uses a parallel hash map ConcurrentHashMap container to cache the cache object in the L2 cache area.
  • a terminal memory processing apparatus including: a dividing module configured to divide the terminal memory into a plurality of cache areas; and a grading module configured to classify the plurality of cache areas The cache module is configured to perform hierarchical cache processing on the cached objects in the terminal memory according to the cached area.
  • the dividing module includes: a dividing unit, configured to divide the terminal memory into a level 1 cache area and a level 2 cache area, wherein the cache object in the level 1 cache area is prohibited from being recycled by the garbage collector; The cache object in the L2 cache area is reclaimed by the garbage collector when a predetermined storage capacity is satisfied.
  • the cache module includes: a determining unit, configured to determine whether the object cached in the level-1 cache area exceeds a predetermined capacity; and the converting unit is configured to, when the determining result of the determining unit is yes, The cached object cached in the level 1 cache area is converted to be cached in the level 2 cache area.
  • the converting unit includes: a sorting subunit, configured to sort the cached objects in the first level cache area according to the amount of accesses; and convert the subunits, set to preferentially access the first level cache area A small amount of cached objects are converted to be cached within the secondary cache area.
  • a terminal comprising the apparatus of any of the above.
  • the terminal memory is divided into a plurality of cache areas; the plurality of cache areas are classified; and the cached objects in the terminal memory are hierarchically cached according to the classified cache area.
  • FIG. 2 is a structural block diagram of a terminal memory processing device according to an embodiment of the present invention
  • FIG. 3 is a terminal memory according to an embodiment of the present invention.
  • FIG. 4 is a block diagram showing the structure of the cache module 26 in the terminal memory processing device according to the embodiment of the present invention;
  • FIG. 5 is a diagram showing the conversion in the cache module 26 in the terminal memory processing device according to the embodiment of the present invention;
  • Fig. 6 is a block diagram showing the structure of a terminal according to an embodiment of the present invention.
  • FIG. 1 is a flowchart of a terminal memory processing method according to an embodiment of the present invention.
  • the process includes the following steps: Step S102: partitioning terminal memory Steps S104: The plurality of cache areas are classified. Step S106: Perform hierarchical storage processing on the cached objects in the terminal memory according to the classified cache area.
  • Step S102 partitioning terminal memory
  • Steps S104 The plurality of cache areas are classified.
  • Step S106 Perform hierarchical storage processing on the cached objects in the terminal memory according to the classified cache area.
  • the cache area in the memory of the terminal is classified, and the cached object is hierarchically cached according to the cached area, which is compared with the cache in which the fixed cache is completely fixed or the soft reference is not fixed.
  • the terminal memory may be divided into corresponding number of cache areas according to specific needs, and corresponding processing is performed according to the divided cache areas, for example, the terminal memory may be divided into one.
  • the cache area and the level 2 cache area wherein the cache object in the level 1 cache area is prohibited from being recycled by the garbage collector, and the cache object in the level 2 cache area is recycled by the garbage collector when the predetermined storage capacity is satisfied.
  • the terminal memory is divided into cache areas that can perform different cache processing on the cache objects, that is, different cache processing is performed on the cache objects.
  • a plurality of methods may also be used. For example, a cache capacity may be set to the first-level cache area (that is, the cache cannot be cached in the first-level cache area).
  • the cached cached object in the primary cache area is converted to be cached in the secondary cache area.
  • the cache object in the level 1 cache area may be selectively converted to the second level cache according to specific considerations. Caching in the area, for example, the consideration may be the importance of the cached object, the amount of access to the cached object, etc., for example, the cached objects in the first-level cache area may be sorted according to the amount of access; Cache objects with less access in the area are converted to cache in the second level cache area.
  • first-level cache area and the second-level cache area may use a plurality of cache containers to store the cache object, for example, because the chain hash map link HashMap container may have a certain sorting function on the cache object, therefore,
  • the L1 cache area can use a chain hash map LinkHashMap container to cache cached objects in the L1 cache area. Due to the parallel hash mapping ConcurrentHashMap container can The efficient parallel processing of the cached object, therefore, the secondary cache area can use the parallel hash map ConcurrentHashMap container to cache the cached object in the secondary cache area.
  • a terminal memory processing device is also provided, which is used to implement the foregoing embodiments and preferred embodiments, and has not been described again.
  • module may implement a combination of software and/or hardware of a predetermined function.
  • the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and conceivable.
  • 2 is a block diagram showing the structure of a terminal memory processing device according to an embodiment of the present invention. As shown in FIG. 2, the device includes a dividing module 22, a grading module 24, and a cache module 26. The device will be described below.
  • the dividing module 22 is configured to divide the terminal memory into a plurality of buffer areas; the grading module 24 is connected to the dividing module 22, and is configured to classify the plurality of buffer areas; the cache module 26 is connected to the grading module 24, and is set to The cached object in the terminal memory is hierarchically cached according to the ranked cache area.
  • FIG. 3 is a structural block diagram of a partitioning module 22 in a terminal memory processing apparatus according to an embodiment of the present invention. As shown in FIG. 3, the partitioning module 22 includes a dividing unit 32, which will be described below.
  • the dividing unit 32 is configured to divide the terminal memory into a level 1 cache area and a level 2 cache area, wherein the cache object in the level 1 cache area is prohibited from being recycled by the garbage collector, and the cache object in the level 2 cache area satisfies the predetermined storage.
  • the capacity is recycled by the garbage collector.
  • 4 is a structural block diagram of a cache module 26 in a terminal memory processing device according to an embodiment of the present invention. As shown in FIG. 4, the cache module 26 includes a determining unit 42 and a converting unit 44. The cache module 26 will be described below.
  • the determining unit 42 is configured to determine whether the object cached in the level 1 cache area exceeds a predetermined capacity; the converting unit 44 is connected to the determining unit 42 and configured to set the level 1 cache area if the determining result of the determining unit is yes
  • the cached objects in the cache are converted to be cached in the secondary cache area.
  • FIG. 5 is a structural block diagram of a converting unit 44 in the cache module 26 in the terminal memory processing apparatus according to an embodiment of the present invention. As shown in FIG. 5, the converting unit 44 includes: a sorting subunit 52 and a converting subunit 54, and the following The conversion unit 44 will be described.
  • the sorting sub-unit 52 is arranged to sort the cache objects in the level-1 cache area according to the amount of accesses; the conversion sub-unit 54, connected to the sorting sub-unit 52, is set to preferentially have less access in the level-1 cache area.
  • the cache object is converted to be cached in the secondary cache area.
  • a terminal is also provided.
  • FIG. 6 is a structural block diagram of a terminal according to an embodiment of the present invention. As shown in FIG. 6, the terminal 60 includes the terminal memory processing device 62 of any of the above. Operations such as accessing disk files, accessing network resources, and querying the database are all important factors that affect the performance of the application.
  • the second-level cache of the application is constructed on the basis of the existing memory, and the memory cache OutOflvlemoryException is effectively avoided. For example, using the caching strategy for image caching can achieve a high user experience.
  • the solution mainly includes the following points: 1. Constructing an application level using a strong reference of JAVA. Cache; 2, JAVA soft reference to build a second-level cache; 3, with the LinkHashMap class provided by JAVA to achieve the least recently used (Least Recently Used (LRU) algorithm and a level 1 cache container; 4, in the first and second level cache Dynamic two-way conversion; 5, dynamically modify the level of the first-level cache according to the memory size of the mobile terminal; 6, using the ConcurrentHashMap provided by JAVA to achieve the second-level cache container; 7, provide a compressed cache strategy.
  • LRU Least Recently Used
  • the first-level cache constructed by using the strong reference to the object to be cached is constructed, the second-level cache is constructed by using the soft reference, and then the first-level cache is dynamically converted according to the LRU algorithm.
  • this two-pronged approach not only enhances the smoothness of page browsing, but also greatly enhances the user experience, and effectively reduces the probability of OutOflvlemoryException exceptions, so that our application can stand out in today's competitively motivated mobile Internet applications, and win the favor of users. Finally won the market. Preferred embodiments of the present invention will now be described.
  • a strong reference cache area of a suitable size is created according to the size of the memory of the mobile terminal, and the object stored in the strong reference cache area is not actively recycled during garbage collection, that is, as long as it is not actively released. It will run through the entire life cycle of the application, so the reference cache here constitutes the above-mentioned level 1 cache, which stores the objects (such as image data) that are often used in the application in the level one cache. Due to the support of the level 1 cache, users will not feel the lag of the application page when they use it.
  • the physical memory size limit is limited to the first-level cache capacity
  • an unrestricted second-level cache area built using soft references is introduced, and the soft reference area is mainly used to store the picture resources that are eliminated by the LRU algorithm according to the LRU algorithm.
  • the level 2 cached image resources will be more and more eliminated when it is eliminated from the primary cache, when the memory is large enough to exceed the physical memory.
  • the OutOflvlemoryException will occur after the sum, which violates the robustness of the application.
  • the soft reference of the JAVA used in the second level cache constructed in the preferred embodiment dynamically determines whether to recycle the memory occupied by the software object when the JAVA garbage collector occurs, when the memory arrives When the physical memory limit is reached, the memory occupied by the soft reference object is forcibly recovered. If there is enough support for the application to run the memory, the garbage collector will ignore the soft reference object. Because of the unique nature of the soft reference, the common OutOflvlemoryException can be effectively avoided. The exception occurs, which greatly improves the robustness of the application. In the construction of the first-level cache container, the LinkHashMap class provided by JAVA is mainly used.
  • LinkHashMap One characteristic of the class itself is that it can dynamically set the attributes to sort the objects in the container according to the access level. Therefore, with this class, only the convenient operation of moving the first level cache to the second level cache is needed, and the difficulty of implementing the LRU algorithm is greatly reduced.
  • the ConcurrentHashMap class provided in JAVA, because the current general application is multi-threaded access, so this requires consideration of the synchronization security of the container, of course, there are many multi-threaded containers in JAVA.
  • ConcurrentHashMap uses a split lock, so ConcurrentHashMap can achieve better throughput.
  • a compressed post-cache policy is provided for the cached object. This can be determined based on the subsequent tests to fully consider the response and performance. It should be noted that the above-mentioned strong reference (StrongReference) is the most common reference used. If an object has a strong reference, the garbage collector will never recycle it.
  • the strong cache is used to implement the level 1 cache, but when the application obtains the network picture data from the network, the user is completely likely to perform some repetitive operations to view the same picture information.
  • the garbage collector will not recycle it; if the memory space is insufficient, the memory of these objects will be reclaimed. As long as the garbage collector does not recycle it, the object can be used by the program.
  • Soft references can be used to implement memory-sensitive caching. Using soft references
  • SoftReference Implementing a second level cache is a very necessary thing. When dealing with a large number of images, soft reference techniques can be used to prevent memory overflow. In Android development, in order to prevent memory overflow, you can use soft reference technology when dealing with some objects that take up a lot of memory and have a long declaration period. After using soft references, the memory space of these cached image resources can be released before the OutOflvlemory exception occurs, thus avoiding the upper limit of memory and avoiding memory overflow. Although soft references are more convenient to use when there is enough memory space, soft references cannot be used when there is insufficient memory space, because they can be recycled by the garbage collector at any time.
  • the LRU+ soft reference method to cache the image to set the two-level cache.
  • SoftReference ⁇ Bitmap the soft reference of the Bitmap retained in the Level 2 cache.
  • the LinkedHashMap inherits the HashMap.
  • the underlying Hash algorithm implements the Hash algorithm through the Hash table + singly linked list, and internally maintains a list of element access sequences.
  • ConcurrentHashMap's concurrent read and write speed is very fast, mainly due to its internal data structure and unique hash operation and separation lock mechanism. The performance of the application is very important. In order to improve the speed of reading and writing data, one of the methods is to use the caching mechanism. As the core infrastructure, the cache must have the following functions: 1. Quickly locate the data; 2. Concurrently change the data; Expiration control and asynchronous write of data; 4. Consistency of cached data in case of high concurrency.
  • the ConcurrentHashMap class contains two static inner classes, HashEntry and P Segment.
  • HashEntry is used to encapsulate the key/value pairs of the mapping table; Segment is used to act as a data partitioning and locking role, and each Segment object is a number of tables of the entire hash mapping table. Each table is a linked list of several HashEntry objects.
  • a ConcurrentHashMap instance contains an array of several Segment objects.
  • a large number of default images are used in Android, for example, the app has a default avatar, a default game icon, etc. These images are used in many places. If you read the picture every time, because the hardware is operated by reading the file, the slow speed will result in performance degradation. Therefore, you can consider caching the image and reading it directly from memory when needed.
  • bitmap is one of the most important classes of image processing in the Android system. It can be used to capture image file information, perform image cropping, rotation, scaling, etc., and save image files in a specified format.
  • Method 1 compress the image when it is saved locally, and compress it when the image is changed from Bitmap to File.
  • the feature is that the image in the form of file is indeed compressed, but when the recompressed file is a Bitmap, the memory it occupies has not changed.
  • This method is to compress the quality of the image, it does not reduce the pixels of the image. That is, the method will reconstruct the image, but it is possible that the color depth of the pixel (ie, the bit depth) and the transparency of each pixel will change.
  • JPEG onlysupports opaque (opaque), that is, after compression in the JPEG format, the original image is transparent. The elements will disappear, so this format can cause distortion.
  • the pixel of the image is not changed.
  • the recompressed compressed file is a Bitmap, it does not occupy less memory.
  • the compression is performed, that is, the picture is changed from the File form to the Bitmap form. Its characteristic is that by setting the sampling rate, reducing the pixels of the picture, reducing the pixels of the Bitmap, thus reducing the memory it occupies.
  • the above two methods sum up the sentence is to compress the Bitmap in memory, it is necessary to reduce its pixels; to compress to File, it is necessary to reduce its quality.
  • soft references can extend the life cycle of data objects, for mobile devices, memory resources are relatively scarce, and using only soft references may not achieve the best cache effect.
  • two cache areas are created by: a strong reference cache area and a soft reference cache area.
  • a limited picture object is stored in the strong reference buffer area, and some of the least frequently used picture objects are moved to the soft reference buffer area according to the LRU policy, and the picture is loaded from the network when there are no picture objects in the cache area.
  • dual-cache can be used to implement a memory-sensitive cache to prevent memory leaks and enhance the robustness of the program. It not only reduces the memory dependence, but also realizes the memory cache, and can effectively prevent memory leaks.
  • the low-performance system can also run smoothly (user experience), the data loading speed becomes faster, and the stability of the application is greatly improved. Experience).
  • the above modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices.
  • the computing device may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • the above is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.
  • a terminal memory processing method, apparatus, and terminal provided by an embodiment of the present invention have the following beneficial effects:
  • the terminal memory in the related art is relatively tight and the user experience of the terminal application is high.
  • the contradictory problem has reached the realization of the cache of memory, effectively solving the contradiction between memory tension and application experience, and improving the user experience.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种终端内存处理方法、装置及终端,该方法包括:将终端内存划分为多个缓存区域;对该多个缓存区域进行分级;依据分级后的缓存区域对终端内存中的缓存对象进行分级缓存处理,解决了相关技术中终端内存相对紧张又对终端应用的用户体验要求很高的矛盾的问题,进而达到了实现对内存的高速缓存,有效解决内存紧张与应用体验相矛盾的问题,提高用户体验的效果。

Description

终端内存处理方法、 装置及终端 技术领域 本发明涉及通信领域, 具体而言, 涉及一种终端内存处理方法、 装置及终端。 背景技术 在移动互联网应用风靡的背景下, 移动终端上的应用要想脱颖而出, 对于应用来 说良好的体验是必不可少的。 如当应用从网络中获取网络图片数据时, 用户完全有可 能做一些重复性的操作去查看相同的图片信息。 对于这样的问题, 通常会有两种解决 方法: 一种是把过去查看过的图片信息保存在内存中, 每一个存储了图片信息的 Java 对象的生命周期都贯穿整个应用程序生命周期, 此种方法加快了数据的访问速度, 但 往往容易造成 OutOflvlemoryException; 另一种是当用户开始查看其它图片信息的时 候, 把存储了当前的图片信息的 Java对象结束引用, 使得垃圾收集器可以回收其所占 用的内存空间, 当用户再次需要浏览该图片信息的时候, 重新获取图片信息, 此种方 法大大降低了 OutOflvlemoryException发生的可能性, 但降低了用户的体验。 显然第一种实现方法将造成大量的内存浪费, 而第二种实现的缺陷在于即使垃圾 收集线程还没有进行垃圾收集, 包含图片信息的对象仍然完好的保存在内存中, 应用 程序也要重新构建一个对象。 例如, 在专利申请号为 CN201110454870.2的中国专利 "基于 Android系统的图片 加载方法和设置" 中公开了一种 Android系统的图片加载方法和装置。 该专利仅对图 片加载采用软引用的方法。 该方法包括: A、 发出图片加载任务的指令, 并初始化存 储图片的软引用; B、 判断所述软引用中是否存储有所需要显示的图片; C、 若所述软 引用中没有存储所述要显示的图片, 则运行图片加载线程进行加载; 若所述软引用中 存储有所述所要显示的图片, 则直接进入步骤 F; D、 若内存不足, 则自动回收所述软 引用中存储的图片直至所述内存充足; E、 所述所要显示的图片加载完成, 并存储于 所述软引用中; F、从所述软引用中直接读取所述所要显示的图片并显示。对于移动设 备来说, 内存资源相对来说比较紧缺, 仅适用软引用未必能够达到最佳的缓存效果。 因此, 在相关技术中存在终端内存相对紧张同时又对终端应用的用户体验要求很 高的矛盾的问题。 发明内容 本发明提供了一种终端内存处理方法及装置, 以至少解决相关技术中存在终端内 存相对紧张同时又对终端应用的用户体验要求很高的矛盾的问题。 根据本发明的一个方面, 提供了一种终端内存处理方法, 包括: 将所述终端内存 划分为多个缓存区域; 对所述多个缓存区域进行分级; 依据分级后的所述缓存区域对 所述终端内存中的缓存对象进行分级缓存处理。 优选地, 将所述终端内存划分为所述多个缓存区域包括: 将所述终端内存划分为 一级缓存区域和二级缓存区域, 其中, 所述一级缓存区域内的缓存对象禁止被垃圾回 收器回收, 所述二级缓存区域内的缓存对象在满足预定存储容量时被所述垃圾回收器 回收。 优选地, 依据分级后的所述缓存区域对所述终端内存中的缓存对象进行分级缓存 处理包括: 判断所述一级缓存区域内缓存的对象是否超过预定容量; 在判断结果为是 的情况下, 将所述一级缓存区域内缓存的缓存对象转换为在所述二级缓存区域进行缓 存。 优选地, 将所述一级缓存区域内缓存的对象转换为在所述二级缓存区域进行缓存 包括: 对所述一级缓存区域内的缓存对象依据访问量的多少进行排序; 优先将所述一 级缓存区域内访问量少的缓存对象转换为在所述二级缓存区域内进行缓存。 优选地,所述一级缓存区域采用链状哈希映射 LinkHashMap容器对所述一级缓存 区域内的缓存对象进行缓存。 优选地, 所述二级缓存区域采用并行哈希映射 ConcurrentHashMap容器对所述二 级缓存区域内的缓存对象进行缓存。 根据本发明的另一方面, 提供了一种终端内存处理装置, 包括: 划分模块, 设置 为将所述终端内存划分为多个缓存区域; 分级模块, 设置为对所述多个缓存区域进行 分级; 缓存模块, 设置为依据分级后的所述缓存区域对所述终端内存中的缓存对象进 行分级缓存处理。 优选地, 所述划分模块包括: 划分单元, 设置为将所述终端内存划分为一级缓存 区域和二级缓存区域,其中,所述一级缓存区域内的缓存对象禁止被垃圾回收器回收, 所述二级缓存区域内的缓存对象在满足预定存储容量时被所述垃圾回收器回收。 优选地, 所述缓存模块包括: 判断单元, 设置为判断所述一级缓存区域内缓存的 对象是否超过预定容量; 转换单元,设置为在所述判断单元的判断结果为是的情况下, 将所述一级缓存区域内缓存的缓存对象转换为在所述二级缓存区域进行缓存。 优选地, 所述转换单元包括: 排序子单元, 设置为对所述一级缓存区域内的缓存 对象依据访问量的多少进行排序; 转换子单元, 设置为优先将所述一级缓存区域内访 问量少的缓存对象转换为在所述二级缓存区域内进行缓存。 根据本发明的再一方面, 提供了一种终端, 包括上述任一项所述的装置。 通过本发明, 采用将所述终端内存划分为多个缓存区域; 对所述多个缓存区域进 行分级; 依据分级后的所述缓存区域对所述终端内存中的缓存对象进行分级缓存处理 解决了相关技术中存在终端内存相对紧张同时又对终端应用的用户体验要求很高的矛 盾的问题,进而达到了实现对内存的高速缓存,有效解决内存紧张与应用体验相矛盾, 提高用户体验的效果。 附图说明 此处所说明的附图用来提供对本发明的进一步理解, 构成本申请的一部分, 本发 明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的不当限定。 在附图 中: 图 1是根据本发明实施例的终端内存处理方法的流程图; 图 2是根据本发明实施例的终端内存处理装置的结构框图; 图 3是根据本发明实施例的终端内存处理装置中划分模块 22的结构框图; 图 4是根据本发明实施例的终端内存处理装置中缓存模块 26的结构框图; 图 5是根据本发明实施例的终端内存处理装置中缓存模块 26中转换单元 44的结 构框图; 图 6是根据本发明实施例的终端的结构框图。 具体实施方式 下文中将参考附图并结合实施例来详细说明本发明。 需要说明的是, 在不冲突的 情况下, 本申请中的实施例及实施例中的特征可以相互组合。 在本实施例中提供了一种终端内存处理方法, 图 1是根据本发明实施例的终端内 存处理方法的流程图, 如图 1所示, 该流程包括如下步骤: 步骤 S102, 将终端内存划分为多个缓存区域; 步骤 S104, 对该多个缓存区域进行分级; 步骤 S106, 依据分级后的缓存区域对终端内存中的缓存对象进行分级缓存处理。 通过上述步骤, 对终端内存中的缓存区域进行分级, 依据分级后的缓存区域对缓 存对象进行分级缓存, 相对于相关技术中仅采用完全固定缓存或是完全不固定软引用 的缓存来说, 采用对缓存区域进行有区分地缓存对象, 不仅解决了相关技术中浪费内 存或是严重影响用户体验的问题, 即存在终端内存相对紧张同时又对终端应用的用户 体验要求很高的矛盾的问题, 进而达到了实现对内存的高速缓存, 有效解决内存紧张 与应用体验相矛盾, 提高用户体验的效果。 优选地, 将终端内存划分为多个缓存区域时, 可以依据具体的需要将终端内存划 分为对应数目的缓存区域, 依据划分后的缓存区域分别进行对应处理, 例如, 可以将 终端内存划分为一级缓存区域和二级缓存区域, 其中, 一级缓存区域内的缓存对象禁 止被垃圾回收器回收, 二级缓存区域内的缓存对象在满足预定存储容量时被垃圾回收 器回收。 即将终端内存划分为可以对缓存对象实行不同缓存处理的缓存区域, 即实现 对缓存对象实行不同的缓存处理。 依据分级后的缓存区域对终端内存中的缓存对象进行分级缓存处理时, 也可以采 用多种方式, 例如, 可以先给一级缓存区域设置一个缓存容量 (即在该一级缓存区域 内不能缓存超过该容量), 之后, 判断一级缓存区域内缓存的对象是否超过预定容量; 在判断结果为是的情况下, 将一级缓存区域内缓存的缓存对象转换为在二级缓存区域 进行缓存。 而在将一级缓存区域内缓存的对象转换为在二级缓存区域进行缓存时, 也 可以依据具体的考虑因素, 对一级缓存区域中的缓存对象实行有选择地转换为在该二 级缓存区域中进行缓存, 例如, 该考虑因素可以为缓存对象的重要程度, 缓存对象的 访问量等, 比如, 可以对一级缓存区域内的缓存对象依据访问量的多少进行排序; 优 先将一级缓存区域内访问量少的缓存对象转换为在二级缓存区域内进行缓存。 需要说明的是, 上述一级缓存区域以及二级缓存区域可以采用多种缓存容器对缓 存对象进行存储, 例如, 由于链状哈希映射 LinkHashMap容器可以对缓存对象具有一 定的排序功能, 因此, 由于一级缓存区域可以采用链状哈希映射 LinkHashMap容器对 一级缓存区域内的缓存对象进行缓存。 由于并行哈希映射 ConcurrentHashMap容器可 以对缓存对象进行高效的并行处理, 因此, 该二级缓存区域可以采用并行哈希映射 ConcurrentHashMap容器对二级缓存区域内的缓存对象进行缓存。 在本实施例中还提供了一种终端内存处理装置, 该装置用于实现上述实施例及优 选实施方式, 已经进行过说明的不再赘述。 如以下所使用的, 术语 "模块"可以实现 预定功能的软件和 /或硬件的组合。 尽管以下实施例所描述的装置较佳地以软件来实 现, 但是硬件, 或者软件和硬件的组合的实现也是可能并被构想的。 图 2是根据本发明实施例的终端内存处理装置的结构框图, 如图 2所示, 该装置 包括划分模块 22、 分级模块 24和缓存模块 26, 下面对装置进行说明。 划分模块 22, 设置为将终端内存划分为多个缓存区域; 分级模块 24, 连接至上述 划分模块 22, 设置为对多个缓存区域进行分级; 缓存模块 26, 连接至上述分级模块 24, 设置为依据分级后的缓存区域对终端内存中的缓存对象进行分级缓存处理。 图 3是根据本发明实施例的终端内存处理装置中划分模块 22的结构框图, 如图 3 所示, 该划分模块 22包括划分单元 32, 下面对该划分单元 32进行说明。 划分单元 32, 设置为将终端内存划分为一级缓存区域和二级缓存区域, 其中, 一 级缓存区域内的缓存对象禁止被垃圾回收器回收, 二级缓存区域内的缓存对象在满足 预定存储容量时被垃圾回收器回收。 图 4是根据本发明实施例的终端内存处理装置中缓存模块 26的结构框图, 如图 4 所示, 该缓存模块 26包括判断单元 42和转换单元 44, 下面对该缓存模块 26进行说 明。 判断单元 42, 设置为判断一级缓存区域内缓存的对象是否超过预定容量; 转换单 元 44, 连接至上述判断单元 42, 设置为在判断单元的判断结果为是的情况下, 将一级 缓存区域内缓存的缓存对象转换为在二级缓存区域进行缓存。 图 5是根据本发明实施例的终端内存处理装置中缓存模块 26中转换单元 44的结 构框图, 如图 5所示, 该转换单元 44包括: 排序子单元 52和转换子单元 54, 下面对 该转换单元 44进行说明。 排序子单元 52, 设置为对一级缓存区域内的缓存对象依据访问量的多少进行排 序; 转换子单元 54, 连接至上述排序子单元 52, 设置为优先将一级缓存区域内访问量 少的缓存对象转换为在二级缓存区域内进行缓存。 在本实施例中,还提供了一种终端, 图 6是根据本发明实施例的终端的结构框图, 如图 6所示, 该终端 60包括上述任一项的终端内存处理装置 62。 像访问磁盘文件、 访问网络资源、 查询数据库等操作都是影响应用程序执行性能 的重要因素, 如果能重新获取那些尚未被回收的 Java对象的引用, 必将减少不必要的 访问, 大大提高程序的运行速度。 因此, 在本实施例中基于终端 (例如, 手机) 内存 相对紧张同时又对手机应用的用户体验要求很高的矛盾, 即在面对手机终端内存一定 的情况下, 对手机应用的用户响应性与手机应用的健壮性都提出了很高的要求。 在本 实施例中, 在内存一定的前提下做到充分利用现有内存基础上构建应用的二级缓存并 且做到有效避免内存缓存 OutOflvlemoryException发生。例如,对图片缓存采用该缓存 策略后就可以达到很高的用户体验。 下面对本发明实施例的双缓存方案进行描述, 便于以下叙述, 以下以终端内存消 耗比较突出的图片为例进行说明, 该方案主要包括以下几点: 1、 使用 JAVA的强引用 构建应用的一级缓存; 2、 JAVA软引用构建二级缓存; 3、借助 JAVA提供的 LinkHashMap 类实现近期最少使用 (Least Recently Used, 简称为 LRU) 算法和一级缓存容器; 4、 在一级与二级缓存之间动态双向转换; 5、根据手机终端内存大小动态修改一级缓存大 小; 6、 使用 JAVA提供的 ConcurrentHashMap实现二级缓存容器; 7、 提供压缩后缓 存策略。 通过本发明实施例, 根据 JAVA 自有垃圾回收器的特性对需要缓存的对象使用强 引用构建的一级缓存, 采用软引用构建二级缓存, 再根据 LRU算法动态转换一、二级 缓存中的对象, 这样双管齐下, 不仅增强了页面浏览的流畅从而大大增强用户体验, 并且有效的降低了 OutOflvlemoryException异常发生的机率,从而使我们的应用在如今 竞争相当激励移动互联网应用中能够脱颖而出, 得到用户的青睐最终赢得市场。 下面对本发明的优选实施方式进行说明。 在本优选实施方式中, 首先, 根据手机终端内存的大小创建一个合适大小的强引 用缓存区域, 在强引用缓存区域所存放的对象在垃圾回收时不会主动被回收, 即只要 不主动释放就会贯穿应用的整个生命周期, 所以这里的引用缓存就构成上述所说的一 级缓存, 在一级缓存里存放应用中经常使用到的对象(例如, 图片数据)。 由于一级缓 存的支撑, 用户在使用时就不会感觉到应用页面的滞后。 但由于物理内存大小限制一 级缓存容量是有限的, 所以引入采用软引用构建的不限大小的二级缓存区域, 软引用 区域主要用来存放一级缓存区域根据 LRU算法淘汰下来的图片资源, 随着应用的运 行, 从一级缓存淘汰时二级缓存的图片资源将会越来越多, 当内存大到超出物理内存 总和后就会发生 OutOflvlemoryException异常, 这样就违背了应用的健壮性。 因此, 在 本优选实施方式中构建的二级缓存采用的 JAVA的软引用,根据软引用的特性在 JAVA 垃圾回收器发生的时候会动态决定是否回收软件用所指对象占用的内存, 当内存到达 物理内存极限的时候就会强行回收软引用对象所占用的内存, 如果尚有足够支撑应用 运行内存, 垃圾回收器就会忽略软引用对象, 由于软引用这个独特性质, 所以可以有 效避免常见的 OutOflvlemoryException异常的发生, 这样就大大提高了应用的健壮性。 在构建一级缓存的容器时, 主要采用了 JAVA提供的 LinkHashMap类, 之所以采用这 样的容器是因为在应用不断使用的时候会不断将后续的图片资源根据 LRU算法转移 至二级缓存, LinkHashMap该类本身存在一个特性就是可以动态设置属性根据访问高 低将容器中的对象进行排序, 所以借助这个类只需要实现一级缓存向二级缓存移动的 便捷操作, 将实现 LRU算法难度大大降低。在实现二级缓存时我们采用了 JAVA中提 供的 ConcurrentHashMap类, 由于现在的一般应用都是多线程访问, 所以这就要求考 虑容器的同步安全问题,当然 JAVA中多线程安全的容器还有很多,如 Vector、HashTable 等,但是这些类实现多线程安装用的整个方法加上内部锁实现,而 ConcurrentHashMap 采用的是分离锁, 所以使用 ConcurrentHashMap能够达到更好的吞吐量。 在最后对于 缓存的对象提供了压缩后缓存策略, 这一点可以根据后续的测试充分考虑响应与性能 兼顾的前提下决定是否采用压缩后缓存。 需要说明的是, 上述所指的强引用 (StrongReference) 是使用最普遍的引用。 如 果一个对象具有强引用, 那垃圾回收器绝不会回收它。 当内存空间不足, Java虚拟机 宁愿抛出 OutOlMemoryEiror错误, 使程序异常终止, 也不会靠随意回收具有强引用 的对象来解决内存不足的问题。 因此, 在本优选实施例中, 采用强引用来实现一级缓 存, 但是当应用从网络中获取网络图片数据时, 用户完全有可能做一些重复性的操作 去查看相同的图片信息。 另外, 如果一个对象只具有软引用, 则内存空间足够, 垃圾回收器就不会回收它; 如果内存空间不足了, 就会回收这些对象的内存。 只要垃圾回收器没有回收它, 该对 象就可以被程序使用。 软引用可用来实现内存敏感的高速缓存。 使用软引用
( SoftReference) 实现二级缓存是非常有必要的一件事情。 在处理大量图片的时候, 使用软引用技术可以来防止内存溢出。 在 Android开发中, 为了防止内存溢出, 在处 理一些占用一些内存大而且声明周期较长的对象的时候, 可以尽量使用软引用技术。 使用软引用以后,在 OutOflvlemory异常发生之前,这些缓存的图片资源的内存空间是 可以被释放掉的, 从而避免内存达到上限, 避免内存溢出的发生。 虽然软引用在内存空间足够的时候使用起来比较方便, 而在内存空间不足的时候 就不能使用软引用, 因为随时都可能被垃圾回收器回收。 因此, 在 Android开发中可 以使用 LRU+软引用 的方法来缓存图片设置两级缓存, 第一级用 LinkedHashMap<String,Bitmap>保留 Bitmap 的强引用, 但是控制缓存的大小 MAX_CAPACITY=10, 当继续向该缓存中存数据的时候, 将会把一级缓存中的最近最 少使用的元素放入二级缓存 ConcurrentHashMap< Sting, SoftReference<Bitmap», 二级 缓存中保留的 Bitmap的软引用。 把图片保存到 LRU集合中的时候, 同时保存在一个软引用的集合之中,如果此元 素被 LRU算法删除,可能垃圾回收器还并没有回收,可以通过软引用的集合获取到此 引用。 需要说明的是, LinkedHashMap继承了 HashMap底层是通过 Hash表 +单向链表实 现 Hash算法, 内部自己维护了一套元素访问顺序的列表。 ConcurrentHashMap的并发 读写速度很快, 主要归功于其内部数据结构和独特的 hash运算以及分离锁的机制。应 用的性能很重要, 为了提高数据的读写速度, 方法之一就是采用缓存机制, 作为核心 基础设施, 缓存必须具备以下几个方面的功能: 1.快速定位数据; 2.并发变更数据; 3. 数据的过期控制与异步写入; 4.高并发的情况下缓存数据的一致性。 ConcurrentHashMap类包含两个静态内部类 HashEntry禾 P Segment。 HashEntry用来封 装映射表的键 /值对; Segment用来充当数据划分和锁的角色, 每个 Segment对象是整 个散列映射表的若干个 table。 每个 table是由若干个 HashEntry对象链接起来的链表。 一个 ConcurrentHashMap实例中包含由若干个 Segment对象组成的数组。 在 Android中用到大量的默认图片, 比如, 应用中有默认的头像, 默认游戏图标 等等, 这些图片很多地方会用到。 如果每次都去读取图片, 由于读取文件需要硬件操 作, 速度较慢, 会导致性能降低。 因此, 可以考虑将图片缓存起来, 需要的时候直接 从内存中读取。 但是由于图片占用内存空间比较大, 缓存很多图片需要很多的内存, 就可能比较容易发生 OutOflvlemoryException异常。这时,可以采用将图片压缩或者使 用软引用的方法来避免这个问题的发生。 下面将详细介绍这两种方法。 较大图片文件上传到服务器一般都需要压缩调整, 以保证数据通信的效率是最主 要的。 首先图片的存在形式主要有三种, 第一种是以文件形式即以二级制形式存在于 硬盘上, 第二种是以流的形式即以二进制形式存在于内存中, 第三种则是以 Bitmap形 式。 这三种的区别是文件形式和流形式对图片的体积大小并没有影响, 也就是说, 如 果手机 SD卡上的内存如果有 100K,那么通过流的形式读到内存中,也一定是占 100K 的内存; 当如果图片以 Bitmap的形式存在时, 其占用的内存会瞬间变大, 假如 500K 文件形式的图片加载到内存, 以 Bitmap形式存在时, 占用内存将近 10M, 当然这个增 大的倍数并不是固定的。 Bitmap是 Android系统中的图像处理的最重要的类之一, 用 它可以获取图像文件信息, 进行图像剪切、 旋转、 缩放等操作, 并可以指定格式保存 图像文件。 以下简单介绍几种常见的图片压缩方式: 方式一,将图片保存到本地时进行压缩, 即将图片从 Bitmap形式变为 File形式时 进行压缩。 其特点是 file形式的图片确实被压缩了, 但是当重新读取压缩后的 file为 Bitmap 时, 它占用的内存并没有改变。 该方法是压缩图片的质量, 它不会减少图片的像素。 也就是该方法会让图片重新构造, 但是有可能像素的色深 (即位深) 和每个像素的透 明度会变化, JPEG onlysupports opaque (不透明), 也就是说以 JPEG格式压缩后, 原 来图片中透明的元素将消失, 所以这种格式可能造成失真。 既然它是改变了图片的显 示质量, 达到了对 File形式图片的图片进行压缩, 图片的像素没有改变的话, 那重新 读取经过压缩的 file为 Bitmap时, 它占用的内存并不会少。 方式二, 将图片从本地读到内存时, 进行压缩, 即图片从 File 形式变为 Bitmap 形式。 其特点是通过设置采样率, 减少图片的像素, 减少 Bitmap的像素, 从而减少了它 所占用的内存。 以上两种方法总结一句话就是要想压缩内存中的 Bitmap, 就要减少它的像素; 要 想压缩为 File, 就要降低它的质量。 通过以上对于 Java软引用类型的了解,可以知道使用软引用来构建缓存是比较合 适的。 虽然软引用能够延长数据对象的生命周期, 但是对于移动设备来说, 内存资源 相对来说比较紧缺, 仅使用软引用未必能达到最佳的缓存效果。 通常会使用一些组合 方式来进行数据缓存, 最常用的是强引用、 软引用加本地缓存的方式。 采用上述实施例及优选实施方式的双缓存处理, 通过创建两个缓存区域: 强引用 缓存区域和软引用缓存区域。在强引用缓存区中保存有限的图片对象,根据 LRU策略 把一些最不常用的图片对象移到软引用缓存区, 当缓存区域中都没有图片对象时从网 络加载图片。完成后把图片数据保存到 SDCard中,并根据 LRU策略进行管理 SDCard 中保存的图片文件。 综上所述, 采用双缓存, 可以实现内存敏感的高速缓存, 防止内存泄露, 增强程 序的健壮性。 不仅降低了对内存的依赖, 实现内存的高速缓存, 而且能够有效防止内 存泄露, 低性能的系统中也能畅快运行(用户体验), 数据加载速度变快, 大大提高了 应用的稳定性 (用户体验)。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可以用通用 的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布在多个计算装置所 组成的网络上, 可选地, 它们可以用计算装置可执行的程序代码来实现, 从而, 可以 将它们存储在存储装置中由计算装置来执行, 并且在某些情况下, 可以以不同于此处 的顺序执行所示出或描述的步骤, 或者将它们分别制作成各个集成电路模块, 或者将 它们中的多个模块或步骤制作成单个集成电路模块来实现。 这样, 本发明不限制于任 何特定的硬件和软件结合。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技 术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的 任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。 工业实用性 如上所述, 本发明实施例提供的一种终端内存处理方法、 装置及终端具有以下有 益效果: 解决了相关技术中存在的终端内存相对紧张同时又对终端应用的用户体验要 求很高的矛盾的问题, 进而达到了实现对内存的高速缓存, 有效解决内存紧张与应用 体验相矛盾, 提高用户体验的效果。

Claims

权 利 要 求 书
1. 一种终端内存处理方法, 包括: 将所述终端内存划分为多个缓存区域;
对所述多个缓存区域进行分级;
依据分级后的所述缓存区域对所述终端内存中的缓存对象进行分级缓存处 理。
2. 根据权利要求 1所述的方法, 其中, 将所述终端内存划分为所述多个缓存区域 包括: 将所述终端内存划分为一级缓存区域和二级缓存区域, 其中, 所述一级缓 存区域内的缓存对象禁止被垃圾回收器回收, 所述二级缓存区域内的缓存对象 在满足预定存储容量时被所述垃圾回收器回收。
3. 根据权利要求 2所述的方法, 其中, 依据分级后的所述缓存区域对所述终端内 存中的缓存对象进行分级缓存处理包括:
判断所述一级缓存区域内缓存的对象是否超过预定容量;
在判断结果为是的情况下, 将所述一级缓存区域内缓存的缓存对象转换为 在所述二级缓存区域进行缓存。
4. 根据权利要求 3所述的方法, 其中, 将所述一级缓存区域内缓存的对象转换为 在所述二级缓存区域进行缓存包括:
对所述一级缓存区域内的缓存对象依据访问量的多少进行排序; 优先将所述一级缓存区域内访问量少的缓存对象转换为在所述二级缓存区 域内进行缓存。
5. 根据权利要求 2至 4中任一项所述的方法, 其中, 所述一级缓存区域采用链状 哈希映射 LinkHashMap容器对所述一级缓存区域内的缓存对象进行缓存。
6. 根据权利要求 2至 4中任一项所述的方法, 其中, 所述二级缓存区域采用并行 哈希映射 ConcurrentHashMap 容器对所述二级缓存区域内的缓存对象进行缓 存。
7. 一种终端内存处理装置, 包括: 划分模块, 设置为将所述终端内存划分为多个缓存区域; 分级模块, 设置为对所述多个缓存区域进行分级;
缓存模块, 设置为依据分级后的所述缓存区域对所述终端内存中的缓存对 象进行分级缓存处理。
8. 根据权利要求 7所述的装置, 其中, 所述划分模块包括: 划分单元, 设置为将所述终端内存划分为一级缓存区域和二级缓存区域, 其中, 所述一级缓存区域内的缓存对象禁止被垃圾回收器回收, 所述二级缓存 区域内的缓存对象在满足预定存储容量时被所述垃圾回收器回收。
9. 根据权利要求 8所述的装置, 其中, 所述缓存模块包括: 判断单元,设置为判断所述一级缓存区域内缓存的对象是否超过预定容量; 转换单元, 设置为在所述判断单元的判断结果为是的情况下, 将所述一级 缓存区域内缓存的缓存对象转换为在所述二级缓存区域进行缓存。
10. 根据权利要求 9所述的装置, 其中, 所述转换单元包括: 排序子单元, 设置为对所述一级缓存区域内的缓存对象依据访问量的多少 进行排序;
转换子单元, 设置为优先将所述一级缓存区域内访问量少的缓存对象转换 为在所述二级缓存区域内进行缓存。
11. 一种终端, 包括权利要求 7至 10中任一项所述的装置。
PCT/CN2014/079532 2013-12-10 2014-06-09 终端内存处理方法、装置及终端 WO2015085732A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310669799.9 2013-12-10
CN201310669799.9A CN104699626B (zh) 2013-12-10 2013-12-10 终端内存处理方法、装置及终端

Publications (1)

Publication Number Publication Date
WO2015085732A1 true WO2015085732A1 (zh) 2015-06-18

Family

ID=53346776

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/079532 WO2015085732A1 (zh) 2013-12-10 2014-06-09 终端内存处理方法、装置及终端

Country Status (2)

Country Link
CN (1) CN104699626B (zh)
WO (1) WO2015085732A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110442404A (zh) * 2019-08-13 2019-11-12 武汉斗鱼鱼乐网络科技有限公司 一种对象释放方法、装置、设备和存储介质
CN111813347A (zh) * 2020-07-24 2020-10-23 济南浪潮数据技术有限公司 垃圾回收空间管理方法、装置及计算机可读存储介质
CN112783656A (zh) * 2021-01-29 2021-05-11 网易(杭州)网络有限公司 内存管理方法、介质、装置和计算设备
CN116243850A (zh) * 2021-06-08 2023-06-09 荣耀终端有限公司 一种存储器管理方法及电子设备

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108132757B (zh) * 2016-12-01 2021-10-19 阿里巴巴集团控股有限公司 数据的存储方法、装置及电子设备
CN106649130A (zh) * 2016-12-28 2017-05-10 乐蜜科技有限公司 内存空间回收方法、装置和电子设备
CN106802955B (zh) * 2017-01-19 2020-06-16 浪潮通用软件有限公司 一种图片数据缓存方法
TWI653533B (zh) * 2017-03-07 2019-03-11 慧榮科技股份有限公司 資料儲存裝置以及其操作方法
CN109992393A (zh) 2017-12-29 2019-07-09 广东欧珀移动通信有限公司 应用处理方法和装置、电子设备、计算机可读存储介质
CN108551490B (zh) * 2018-05-14 2021-06-18 西京学院 一种工业流数据编码解码系统及方法
CN109376125A (zh) * 2018-09-25 2019-02-22 郑州云海信息技术有限公司 一种元数据存储方法、装置、设备及计算机可读存储介质
CN109947367B (zh) * 2019-03-15 2024-01-09 维沃移动通信有限公司 一种文件的处理方法及终端
US11474941B2 (en) * 2020-03-09 2022-10-18 International Business Machines Corporation Using multi-tiered cache to satisfy input/output requests

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1852318A (zh) * 2006-04-19 2006-10-25 华中科技大学 适用于对象网络存储的分布式多级缓存系统
CN101770412A (zh) * 2010-01-22 2010-07-07 华中科技大学 一种连续数据缓存系统及其数据缓存方法
CN101908022A (zh) * 2010-08-13 2010-12-08 优视科技有限公司 一种用于移动通讯设备终端的内存管理方法及其装置
US20120284450A1 (en) * 2011-05-06 2012-11-08 Genesys Logic, Inc. Flash memory system and managing and collecting methods for flash memory with invalid page messages thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1852318A (zh) * 2006-04-19 2006-10-25 华中科技大学 适用于对象网络存储的分布式多级缓存系统
CN101770412A (zh) * 2010-01-22 2010-07-07 华中科技大学 一种连续数据缓存系统及其数据缓存方法
CN101908022A (zh) * 2010-08-13 2010-12-08 优视科技有限公司 一种用于移动通讯设备终端的内存管理方法及其装置
US20120284450A1 (en) * 2011-05-06 2012-11-08 Genesys Logic, Inc. Flash memory system and managing and collecting methods for flash memory with invalid page messages thereof

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110442404A (zh) * 2019-08-13 2019-11-12 武汉斗鱼鱼乐网络科技有限公司 一种对象释放方法、装置、设备和存储介质
CN110442404B (zh) * 2019-08-13 2022-07-05 武汉斗鱼鱼乐网络科技有限公司 一种对象释放方法、装置、设备和存储介质
CN111813347A (zh) * 2020-07-24 2020-10-23 济南浪潮数据技术有限公司 垃圾回收空间管理方法、装置及计算机可读存储介质
CN111813347B (zh) * 2020-07-24 2022-06-07 济南浪潮数据技术有限公司 垃圾回收空间管理方法、装置及计算机可读存储介质
CN112783656A (zh) * 2021-01-29 2021-05-11 网易(杭州)网络有限公司 内存管理方法、介质、装置和计算设备
CN112783656B (zh) * 2021-01-29 2024-04-30 杭州网易智企科技有限公司 内存管理方法、介质、装置和计算设备
CN116243850A (zh) * 2021-06-08 2023-06-09 荣耀终端有限公司 一种存储器管理方法及电子设备
CN116243850B (zh) * 2021-06-08 2024-05-28 荣耀终端有限公司 一种存储器管理方法及电子设备

Also Published As

Publication number Publication date
CN104699626B (zh) 2019-02-19
CN104699626A (zh) 2015-06-10

Similar Documents

Publication Publication Date Title
WO2015085732A1 (zh) 终端内存处理方法、装置及终端
US11599546B2 (en) Stream browser for data streams
US9166866B2 (en) Hydration and dehydration with placeholders
US11307769B2 (en) Data storage method, apparatus and storage medium
US10264039B2 (en) Streaming content and placeholders
CN109213772B (zh) 数据存储方法及NVMe存储系统
CN108804031B (zh) 最佳记录查找
US9734158B2 (en) Searching and placeholders
US8972690B2 (en) Methods and apparatuses for usage based allocation block size tuning
Bortnikov et al. Accordion: Better memory organization for LSM key-value stores
US11860861B2 (en) Growing dynamic shared memory hash table
US9727479B1 (en) Compressing portions of a buffer cache using an LRU queue
CN108108089B (zh) 一种图片加载方法及装置
CN104778270A (zh) 一种用于多文件的存储方法
US8495286B2 (en) Write buffer for improved DRAM write access patterns
Zhai et al. Hadoop perfect file: A fast and memory-efficient metadata access archive file to face small files problem in hdfs
US10031859B2 (en) Pulse counters
US20240036728A1 (en) Method and apparatus for processing data, reduction server, and mapping server
CN109218799B (zh) 安卓电视快速切换高清图的方法、存储介质、设备及系统
Jia et al. SlimCache: Exploiting data compression opportunities in flash-based key-value caching
CN103577604B (zh) 一种用于Hadoop分布式环境的图像索引结构
CN109101197A (zh) 一种文件存储和访问方法、装置、文件存储器及系统
CN114942727B (zh) 微内核文件系统可扩展页面缓存系统及方法
WO2024152714A1 (zh) 内存回收方法、计算机设备、介质和程序产品
US11943296B2 (en) Workload-based cache compression in a distributed storage system

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: 14870527

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: 14870527

Country of ref document: EP

Kind code of ref document: A1