Automatic memory release method and system based on picture resources

An automatic release and picture technology, applied in resource allocation, program control design, instrumentation, etc., can solve problems such as memory out-of-bounds, exceptions, and memory leaks

Active Publication Date: 2017-11-17
WUHAN DOUYU NETWORK TECH CO LTD
View PDF5 Cites 20 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

In this way, if we no longer use the image but forget to release the bitmap, it may cause a memory leak, and in severe cases, it will cause an OOM (out of memory) exception

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Automatic memory release method and system based on picture resources
  • Automatic memory release method and system based on picture resources
  • Automatic memory release method and system based on picture resources

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0048] The specific implementation manners of the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

[0049] see figure 1 , provides a method for automatically releasing memory based on image resources according to an embodiment of the present invention, including: S1, using a cacheable thread pool to asynchronously load image resources in the image loader; S2, constructing and Load the map object corresponding to the picture, where the map object stores the picture loading address and the storage address in the memory after the picture is loaded, and stores all the map objects in the list relational table; S3, according to the preset time interval, traverses the entire The list relationship table, according to the storage address in the memory after the picture in the li...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention provides an automatic memory release method and system based on picture resources. The method comprises following steps: performing asynchronous loading on picture resources by means of a cacheable thread pool; building a map object corresponding to a loaded picture each time as the picture is loaded; storing all the map objects in a list relation table; traversing the whole list relation table according to a preset time interval and obtaining a bitmap bitmap object according to a storage address of the loaded picture in the map object; if the bitmap object satisfies a recovery condition, then the recovery mechanism in the memory is triggered for recovering the bitmap object. According to the method of the invention, a thread pool with cache function is selected to load pictures asynchronously, effectively solving the problem that large pictures lead to ANR problems and regularly cleaning bitmap objects in the memory to automatically release memory; when the system resource is limited, system memory abnormity is avoided; the development efficiency of developers is increased and the possibility of abnormal programs is reduced.

Description

technical field [0001] The present invention relates to the technical field of memory release, and more specifically, to a method and system for automatically releasing memory based on image resources. Background technique [0002] Pictures are a frequently used component during Android development, and Bitmap objects can usually be used to carry a picture in Android. The overhead of pictures in memory is very large. At present, in the development process, developers usually instantiate and release bitmap objects manually. In this way, if we no longer use the image but forget to release the bitmap, it may cause a memory leak, and in severe cases, it will cause an OOM (out of memory) exception. Contents of the invention [0003] The present invention provides a method and system for automatically releasing memory based on image resources to overcome the above problems or at least partially solve the above problems. [0004] According to the first aspect of the present inv...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/50
CPCG06F9/5016G06F9/5022
Inventor 张磊张文明陈少杰
Owner WUHAN DOUYU NETWORK TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products