Unlock instant, AI-driven research and patent intelligence for your innovation.

A method and system for automatic memory release based on image resources

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

Active Publication Date: 2020-12-15
WUHAN DOUYU NETWORK TECH CO LTD
View PDF5 Cites 0 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
  • A method and system for automatic memory release based on image resources
  • A method and system for automatic memory release based on image resources
  • A method and system for automatic memory release based on image 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

Disclosed are an image resource-based automatic memory release method and system. The method comprises: using a cachable thread pool in an image loader to perform asynchronous loading of image resources (S1); each time an image is loaded, constructing a map object corresponding to the loaded image, wherein the map object has stored therein the loading address of the image and a storage address of the loaded image in a memory, and all map objects are stored in a list relationship table (S2); traversing the list relationship table at a preset interval, to acquire a bitmap object according to the storage address of the loaded image in the memory, contained in the list relationship table (S3); and if the bitmap object satisfies a collection condition, triggering a collection mechanism in the memory to collect the bitmap object and execute release of the memory (S4). The use of a cacheable thread pool to asynchronously load images effectively solves the issue of ANR (Application Not Responding) when storing excessively large image files. The method improves development efficiency for the developer and reduces the possibility of a programming anomaly.

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, during 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...

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 Patents(China)
IPC IPC(8): G06F9/50
CPCG06F9/5016G06F9/5022
Inventor 张磊张文明陈少杰
Owner WUHAN DOUYU NETWORK TECH CO LTD