CN107656699B - Picture calling method and device - Google Patents

Picture calling method and device Download PDF

Info

Publication number
CN107656699B
CN107656699B CN201710712580.0A CN201710712580A CN107656699B CN 107656699 B CN107656699 B CN 107656699B CN 201710712580 A CN201710712580 A CN 201710712580A CN 107656699 B CN107656699 B CN 107656699B
Authority
CN
China
Prior art keywords
memory area
bitmap
picture
picture set
bitmap file
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201710712580.0A
Other languages
Chinese (zh)
Other versions
CN107656699A (en
Inventor
王秀强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhiche Shanghai Industrial Co ltd
Original Assignee
Shanghai Vcyber Intelligence Technology Co ltd
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 Shanghai Vcyber Intelligence Technology Co ltd filed Critical Shanghai Vcyber Intelligence Technology Co ltd
Priority to CN201710712580.0A priority Critical patent/CN107656699B/en
Publication of CN107656699A publication Critical patent/CN107656699A/en
Application granted granted Critical
Publication of CN107656699B publication Critical patent/CN107656699B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a picture calling method and a picture calling device, wherein the method comprises the following steps: if the picture set is detected to be called, extracting the picture set from a local storage, wherein the picture set comprises at least one picture; detecting whether the size of a memory required by the picture set exceeds a preset threshold value; if not, caching the picture set into a system appointed memory area, and enabling the application program to call the picture set from the system appointed memory area; if yes, caching the picture set into a pre-established memory area; in the memory area, creating a bitmap file corresponding to each picture in the picture set one by one so that an application program calls the bitmap file from the memory area; and if the application program is monitored to be closed, emptying and releasing the memory area, and deleting bitmap information, wherein the bitmap information is information generated when the bitmap file is created. Therefore, the problem of error reporting of system abnormity which possibly occurs is solved, the stability of the system is improved, and the user experience is improved.

Description

Picture calling method and device
Technical Field
The embodiment of the invention relates to the field of communication, in particular to a picture calling method and device.
Background
Currently, with the rapid development of mobile terminals, people have higher and higher requirements on the processing speed and stability of the mobile terminals. In the prior art, in order to improve the work efficiency of picture calling, a cache mode is usually adopted. Specifically, when the application needs to use the picture on the network side, the mobile terminal stores the picture to the local and calls the picture in the local storage, in the calling process, the mobile terminal extracts the picture to the memory for caching, then the picture in the cache is applied to the application, and the application still uses the picture in the cache when being used again.
However, the prior art occupies the Memory, and therefore, the problem Of Memory overflow (OOM) may be caused. To prevent this problem, the solutions adopted in the prior art are generally: and (4) periodically clearing the cache, namely recycling the picture by using a system source generation method. However, when a picture is reclaimed, the program's references corresponding to the picture are not cleared. Therefore, when the application calls the picture again according to the reference, since the picture is already recycled, an abnormal error report will be caused. However, if pictures are not recycled, an OOM problem may result.
Therefore, an effective solution has not been proposed at present for the problem that the solution in the prior art is incomplete, which may cause system memory overflow or may cause system abnormal error reporting.
Disclosure of Invention
The embodiment of the invention provides a picture calling method, which aims to solve the problem that in the picture calling method in the prior art, due to the fact that a scheme is incomplete, system memory overflow or abnormal error reporting of a system can be caused.
In order to solve the above problem, the present invention discloses a picture calling method, which comprises:
if the picture set is detected to be called, extracting the picture set from a local storage, wherein the picture set comprises at least one picture;
detecting whether the size of a memory required by the picture set exceeds a preset threshold value;
if not, caching the picture set into a system appointed memory area, and enabling the application program to call the picture set from the system appointed memory area;
if yes, caching the picture set into a pre-established memory area;
in the memory area, creating a bitmap file corresponding to each picture in the picture set one by one so that an application program calls the bitmap file from the memory area; and the number of the first and second groups,
and if the application program is monitored to be closed, emptying and releasing the memory area, and deleting bitmap information, wherein the bitmap information is information generated when the bitmap file is created.
According to another aspect of the present invention, there is provided a picture call apparatus, the apparatus including:
the extraction module is used for extracting a picture set from a local storage if the picture set is detected to be called, wherein the picture set comprises at least one picture;
the detection module is used for detecting whether the size of the memory required by the picture set exceeds a preset threshold value;
the first caching module is used for caching the picture set into a system appointed memory area if the picture set is not cached in the system appointed memory area, so that the application program calls the picture set from the system appointed memory area;
if the second cache is yes, caching the picture set into a pre-established memory area;
the creating module is used for creating a bitmap file which corresponds to each picture in the picture set one by one in the memory area so that the application program calls the bitmap file from the memory area; and the number of the first and second groups,
and the release module is used for emptying and releasing the memory area and deleting the bitmap information if the application program is monitored to be closed, wherein the bitmap information is information generated when the bitmap file is created.
Compared with the prior art, the technical scheme of the invention can effectively prevent the overflow problem of the system memory by emptying and releasing the pre-established memory area. And in the process of calling the picture, the picture set and related resources are cached in the special memory area, so that cache data are not generated in a local cache, the pre-created memory area is emptied and released after the picture is used, and the related bitmap information is deleted, so that when other application programs call the picture again, the picture cannot be guided to the deleted memory area, therefore, on the premise of ensuring the picture calling efficiency, the problem of abnormal error reporting of a system possibly occurring is effectively solved, the stability of the system is improved, and the user experience is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
FIG. 1 is a flowchart of a method for calling a picture according to an embodiment of the present invention;
FIG. 2 is a second flowchart of a picture calling method according to an embodiment of the present invention;
FIG. 3 is a block diagram of a picture call apparatus according to an embodiment of the present invention;
FIG. 4 is a second block diagram of a picture-calling device according to an embodiment of the present invention;
FIG. 5 is a third block diagram of a picture-calling device according to an embodiment of the present invention;
fig. 6 is a fourth block diagram of a picture call apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Example one
Referring to fig. 1, a flowchart of a picture calling method according to an embodiment of the present invention is shown, which may specifically include the following steps:
step 101, if it is detected that a picture set needs to be called, extracting the picture set from a local storage, wherein the picture set comprises at least one picture.
Specifically, in the embodiment of the present invention, the method in the embodiment of the present invention may be applied to a mobile terminal or other devices, for example: tablet, PC, etc.
Taking the mobile terminal as an example, in an embodiment, if the user opens the application program, the user instruction may be triggered by the mobile terminal to instruct the application program to use at least one picture in the local storage of the mobile terminal. After receiving the user instruction, the mobile terminal can determine the picture set which needs to be called by the current mobile terminal.
In another embodiment, the mobile terminal may also automatically trigger the picture call process according to a preset rule. For example, the following steps are carried out: after the operator presets the application program A to start, at least one picture stored locally is automatically transferred. Then, after detecting that the application program a is started, the mobile terminal determines that the at least one picture needs to be called currently.
Specifically, in the embodiment of the present invention, when detecting that the picture set needs to be called currently, the mobile terminal extracts at least one specified picture from the local storage to form the picture set.
Step 102, detecting whether the size of the memory required by the picture set exceeds a predetermined threshold.
Specifically, in the embodiment of the present invention, the mobile terminal detects whether the size of the memory required by the picture set exceeds a predetermined threshold. In the embodiment of the present invention, the predetermined threshold may be set by a user according to actual requirements, i.e. factors such as processing capability of the device, which is not limited by the present invention.
And 103, if not, caching the picture set into a system-specified memory area, so that the application program calls the picture set from the system-specified memory area.
Specifically, in the embodiment of the present invention, if the mobile terminal detects that the size of the memory required by the picture set does not exceed the predetermined threshold, the technical solution in the prior art embodiment may be used, that is, the picture set is cached in the memory area specified by the system, and in the subsequent processing process, the application program may directly call the picture set from the memory area specified by the system.
And 104, if yes, caching the picture set into a pre-established memory area.
Specifically, in the embodiment of the present invention, if the mobile terminal detects that the size of the memory required by the picture set exceeds the predetermined threshold, the picture set is cached in the memory area created in advance. In the embodiment of the present invention, when the system in the mobile terminal detects that there is a picture set to be cached (i.e. a picture set whose size exceeds a predetermined threshold), a memory area is created in the memory. In one embodiment, when the system creates the memory area, the memory area may be created according to the size of the picture set. In another embodiment, the size of the memory area may be set in advance by an operator, and the system creates the memory area according to the setting of the operator. In another embodiment, the location of the memory area in the memory may be randomly selected by the system, which is not limited in the present invention.
And 105, creating a bitmap file corresponding to each picture in the picture set one by one in the memory area so that the application program calls the bitmap file from the memory area.
Specifically, in the embodiment of the present invention, the mobile terminal performs subsequent operations in the created memory area, specifically: and the mobile terminal creates a bitmap file corresponding to each picture one by one according to each picture in the picture set. The bitmap file may have a specified format, such as: in Drawable format, so that an application can call the bitmap file directly from a pre-created memory area.
And step 106, if the application program is monitored to be closed, emptying and releasing the memory area, and deleting bitmap information, wherein the bitmap information is information generated when a bitmap file is created.
Specifically, in the embodiment of the present invention, the mobile terminal monitors the state of the application program in real time, and if it is monitored that the application program is closed, the mobile terminal will empty the memory area, that is, delete the picture set, the bitmap file, and the like in the memory area. Meanwhile, the mobile terminal deletes the bitmap information generated in the process of creating the bitmap file. The bitmap information includes, but is not limited to: and the bitmap object is used for identifying the reference relation of the application program to the bitmap file.
According to the technical scheme, the memory area which is created in advance is emptied and released, so that the problem of overflow of the system memory can be effectively prevented. And in the process of calling the picture, the picture set and related resources are cached in the special memory area, so that cache data are not generated in a local cache, the pre-created memory area is emptied and released after the picture is used, and the related bitmap information is deleted, so that when other application programs call the picture again, the picture cannot be guided to the deleted memory area, therefore, on the premise of ensuring the picture calling efficiency, the problem of abnormal error reporting of a system possibly occurring is effectively solved, the stability of the system is improved, and the user experience is improved.
Example two
Referring to fig. 2, a flowchart of a picture calling method according to an embodiment of the present invention is shown, which may specifically include the following steps:
step 201, if it is detected that the picture set needs to be called, extracting the picture set from the local storage.
Specifically, in the embodiment of the present invention, the method in the embodiment of the present invention may be applied to a mobile terminal or other devices, for example: tablet, PC, etc. Taking the mobile terminal as an example, in an embodiment, if the user opens the application program, the user instruction may be triggered by the mobile terminal to instruct the application program to use at least one of the local storages of the mobile terminal. After the mobile terminal receives the user instruction, the fact that the current mobile terminal needs to call the picture can be determined.
In another embodiment, the mobile terminal may also automatically trigger the picture call process according to a preset rule. For example, the following steps are carried out: after the operator presets the application program A to start, the picture set is automatically transferred. Then, after detecting that the application program a is started, the mobile terminal determines that at least one picture in the mobile terminal needs to be called currently.
Specifically, when the mobile terminal detects that at least one picture in the mobile terminal needs to be called, the mobile terminal queries the target storage space in the local storage according to the picture. The target storage space is used for storing resource files. In one embodiment, the way to query the target storage space may be: and searching according to the identification information of the storage space. In another embodiment, the way to query the target storage space may also be: and searching according to the content in the storage space. In embodiments of the present invention, resource files include, but are not limited to: media files such as pictures, animations, etc.
The mobile terminal extracts at least one picture and forms a picture set.
Step 202, detecting whether the size of the memory required by the picture set exceeds a predetermined threshold.
Specifically, in the embodiment of the present invention, the mobile terminal detects whether the size of the memory required by the picture set exceeds a predetermined threshold. If yes, go to step 203. If not, the subsequent processing can be performed on the picture according to the caching mode in the embodiment of the prior art. That is, the picture set is cached in the memory area specified by the system, and in the subsequent processing process, the application program can directly call the picture set from the memory area specified by the system.
In the embodiment of the present invention, the predetermined threshold may be set by a user according to actual requirements, i.e. factors such as processing capability of the device, which is not limited by the present invention.
Step 203, caching the picture set into a pre-created memory area.
Specifically, in the embodiment of the present invention, if the mobile terminal detects that the size of the memory required by the picture set exceeds the predetermined threshold, the picture set is cached in the memory area created in advance. In the embodiment of the present invention, when the system in the mobile terminal detects that there is a picture set to be cached (i.e. a picture set whose size exceeds a predetermined threshold), a memory area is created in the memory. In one embodiment, when the system creates the memory area, the memory area may be created according to the size of the picture set. In another embodiment, the size of the memory area may be set in advance by an operator, and the system creates the memory area according to the setting of the operator. In another embodiment, the location of the memory area in the memory may be randomly selected by the system, which is not limited in the present invention.
Step 204, creating at least one intermediate bitmap file according to the picture set.
Specifically, in the embodiment of the present invention, the mobile terminal may create an intermediate bitmap file corresponding to each picture according to each picture in the picture set. The intermediate bitmap file may be generated by the following statements:
Bitmap bmp=BitmapFactory.decodeResource(res,R.drawable.test)
step 205, at least one bitmap object is generated.
Specifically, in the embodiment of the present invention, the mobile terminal generates a bitmap object corresponding to each intermediate bitmap file one to one. In an embodiment of the present invention, the bitmap object is used to identify an intermediate bitmap file. That is, the bitmap object is an index of the intermediate bitmap file, and the application program can search for the bitmap file according to the bitmap object (since the intermediate bitmap file is encapsulated as the bitmap file in the subsequent step, the application program searches for the bitmap file when calling according to the bitmap object), and calls the corresponding bitmap file. The "bmp" in the above statement is the bitmap object in the embodiment of the present invention.
Step 206, according to the at least one bitmap object, at least one intermediate bitmap file is encapsulated to obtain a bitmap file corresponding to each intermediate bitmap file.
Specifically, in the embodiment of the present invention, step 206 specifically includes:
step 2061, call package statement.
Step 2062, according to the at least one bitmap object, encapsulating each of the at least one intermediate bitmap file into a bitmap file with a drawable format through an encapsulation statement.
Specifically, the mobile terminal encapsulates each generated intermediate bitmap file into a bitmap file with a specified format, i.e., a drawable format. Further, in the embodiment of the present invention, the mobile terminal encapsulates the middle bitmap file into a bitmapstrawable format. Therefore, the application program can directly use the bitmap file, and the processing efficiency of the application program is improved. Specifically, the encapsulation process can be implemented by the following statements:
pngdrawable=new BitmapDrawable(bmp);
that is, in the embodiment of the present invention, the mobile terminal encapsulates the middle bitmap file into a bitmap drawable format according to the bitmap object (bmp).
Subsequently, the application may call the bitmap file by referencing a function. The specific implementation can be realized through the following statements:
tv.setBackgroundDrawable(pngdrawable)。
therefore, it is seen that in the foregoing embodiments, the picture calling method in the embodiments of the present invention calls a picture set, dynamically creates a memory area for caching the picture set and a bitmap object, a bitmap file, and the like associated with the picture set, and after the application is called this time, clears all resources in the memory area, deletes the resources and a corresponding reference relationship, and the like. Therefore, the invention can generate new resources in the pre-created memory area when calling each time, thereby avoiding the utilization of the following in the picture calling method in the prior art: getResources (). getdrawable (id) statement, cache the picture locally, and cache resources will appear in the calling process of the application program, which causes the next time the application program directly returns to the cache resources in the calling process, thus causing the problem of system exception. The specific deletion method is as follows:
step 207, if it is monitored that the application program is closed, emptying and releasing the memory area, and deleting bitmap information, wherein the bitmap information is information generated when the bitmap file is created.
Specifically, in the embodiment of the present invention, if it is monitored that the application program is closed, the memory area is located according to at least one bitmap object. Then, the mobile terminal clears and releases the memory area.
Specifically, in the embodiment of the present invention, step 207 specifically includes:
in the substep 2071, if it is detected that the application is closed, the picture set and the bitmap file cached in the local memory are deleted.
Specifically, in the embodiment of the present invention, the mobile terminal monitors the state of the application program in real time, and if it is monitored that the application program is closed, the mobile terminal deletes the bitmap file and the image set, which are cached in the local memory.
Specifically, the mobile terminal in the embodiment of the present invention deletes the bitmap file by the following statements:
pngdrawable=null;
and deleting the picture set in the cache by:
bitmap.recycle();
substep 2072, deleting at least one bitmap object.
Specifically, in the embodiment of the present invention, the mobile terminal further deletes the generated at least one bitmap object, and if another application program calls the picture set again, since the bitmap object is deleted, the application program regenerates the bitmap file by reusing the picture calling method in the embodiment of the present invention, and cannot find the pre-created memory area according to the deleted bitmap object, and causes a problem of abnormal error reporting of the system. The bitmap object is deleted by:
bitmap=null
substep 2073, the nulling application calls a reference function used when the bitmap file.
Specifically, in the embodiment of the present invention, the mobile terminal further extracts the reference function of the bitmap file from the nulling application program, thereby further avoiding the occurrence of the problem of abnormal error reporting of the system. Specifically, the null reference function can be implemented by:
tv.setBackgroundDrawable(null);
in addition, in a preferred embodiment of the present invention, the mobile terminal may also clear application level garbage, such as: registries, reference relationships, etc. In another embodiment, the mobile terminal may perform overall garbage cleaning, i.e. cleaning the application layer and the bottom layer. Therefore, information possibly related to the generated bitmap file is cleaned, the risk of abnormal error reporting of the system is further reduced, and the stability of the system is improved.
In summary, according to the technical solution in the embodiment of the present invention, the pre-created memory area is cleared and released, so that the problem of system memory overflow can be effectively prevented. And in the process of calling the picture, the picture set and related resources are cached in the special memory area, so that cache data are not generated in a local cache, the pre-created memory area is emptied and released after the picture is used, and the related bitmap information is deleted, so that when other application programs call the picture again, the picture cannot be guided to the deleted memory area, therefore, on the premise of ensuring the picture calling efficiency, the problem of abnormal error reporting of a system possibly occurring is effectively solved, the stability of the system is improved, and the user experience is improved.
EXAMPLE III
Referring to fig. 3, a block diagram of a picture call apparatus according to an embodiment of the present invention is shown, where the apparatus may specifically include the following modules:
the extracting module 301 is configured to extract a picture set from a local storage if it is detected that the picture set needs to be called, where the picture set includes at least one picture.
The detecting module 302 is configured to detect whether a size of a memory required by the picture set exceeds a predetermined threshold.
The first caching module 303 is configured to cache the picture set in the system-specific memory area if the picture set is not cached in the system-specific memory area, so that the application program calls the picture set from the system-specific memory area.
A second caching module 304, configured to cache the picture set in a pre-created memory area if the picture set is in the memory area;
a creating module 305, configured to create, in the memory area, a bitmap file corresponding to each picture in the picture set one by one, so that the application program calls the bitmap file from the memory area; and the number of the first and second groups,
the release module 306 is configured to empty and release the memory area and delete the bitmap information if it is monitored that the application program is closed, where the bitmap information is information generated when the bitmap file is created.
Referring to fig. 4, in an alternative embodiment of the present invention, on the basis of fig. 3, the creating module 305 further includes:
the creating sub-module 3051 is configured to create at least one intermediate bitmap file according to the picture set, where the at least one intermediate bitmap file corresponds to pictures in the picture set one by one.
The generating sub-module 3052 is configured to generate at least one bitmap object, where the at least one bitmap object corresponds to at least one intermediate bitmap file one to one, and each bitmap object is used to identify the corresponding intermediate bitmap file.
The encapsulation sub-module 3053 is configured to encapsulate the at least one intermediate bitmap file according to the at least one bitmap object, so as to obtain a bitmap file corresponding to each intermediate bitmap file.
Moreover, in an alternative embodiment of the present invention, the encapsulation sub-module 3053 is further configured to:
a package statement is invoked.
And according to the at least one bitmap object, packaging each intermediate bitmap file in the at least one intermediate bitmap file into a bitmap file with a drawable format through a packaging statement.
Referring to fig. 5, in an alternative embodiment of the present invention, the releasing module 306 further includes, on the basis of fig. 3:
the positioning sub-module 3061 is configured to, if it is monitored that the application program is closed, position the memory area according to at least one bitmap object.
The release submodule 3062 is configured to empty and release the memory region.
Referring to fig. 6, in an alternative embodiment of the present invention, the releasing module 306 further includes, on the basis of fig. 3:
the first deleting submodule 3063 is configured to delete the picture set and the bitmap file cached in the memory area if it is monitored that the application program is closed.
The second delete submodule 3064 is configured to delete the memory region.
A third deletion submodule 3065 for deleting the at least one bitmap object.
The nulling sub-module 3066 is used for nulling the reference function used when the application calls the bitmap file.
In summary, the apparatus in the embodiment of the present invention can effectively prevent the occurrence of the system memory overflow problem by clearing and releasing the pre-created memory area. And in the process of calling the picture, the picture set and related resources are cached in the special memory area, so that cache data are not generated in a local cache, the pre-created memory area is emptied and released after the picture is used, and the related bitmap information is deleted, so that when other application programs call the picture again, the picture cannot be guided to the deleted memory area, therefore, on the premise of ensuring the picture calling efficiency, the problem of abnormal error reporting of a system possibly occurring is effectively solved, the stability of the system is improved, and the user experience is improved.
For the apparatus embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
Embodiments of the invention may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above detailed description is provided for the picture calling method and device provided by the present invention, and a specific example is applied in the description to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A picture calling method, comprising:
if the picture set is detected to be required to be called, extracting the picture set from a local storage, wherein the picture set comprises at least one picture;
detecting whether the size of a memory required by the picture set exceeds a preset threshold value;
if not, caching the picture set into a system-specified memory area, and enabling an application program to call the picture set from the system-specified memory area;
if so, caching the picture set into a pre-established memory area, wherein the pre-established memory area is a memory area pre-established in a memory;
creating a bitmap file corresponding to each picture in the picture set one by one in the memory area so that the application program calls the bitmap file from the memory area; and the number of the first and second groups,
if the application program is monitored to be closed, emptying and releasing the pre-established memory area, and deleting bitmap information, wherein the bitmap information is information generated when the bitmap file is established.
2. The method according to claim 1, wherein the step of creating, in the memory area, a bitmap file corresponding to each picture in the picture set one to one specifically includes:
creating at least one intermediate bitmap file according to the picture set, wherein the at least one intermediate bitmap file corresponds to each picture in the picture set one by one;
generating at least one bitmap object, wherein the at least one bitmap object is in one-to-one correspondence with the at least one intermediate bitmap file, and each bitmap object is used for identifying the corresponding intermediate bitmap file;
and encapsulating the at least one intermediate bitmap file according to the at least one bitmap object to obtain a bitmap file corresponding to each intermediate bitmap file.
3. The method according to claim 2, wherein the step of encapsulating the at least one intermediate bitmap file according to the at least one bitmap object specifically comprises:
calling a packaging statement;
and according to the at least one bitmap object, packaging each of the at least one intermediate bitmap file into a bitmap file with a drawable format through the packaging statement.
4. The method according to claim 2, wherein if it is monitored that the application program is closed, the step of emptying and releasing the pre-created memory area and deleting bitmap information specifically comprises:
if the application program is monitored to be closed, positioning the memory area according to the at least one bitmap object;
and clearing and releasing the memory area.
5. The method according to claim 2, wherein if it is monitored that the application program is closed, the step of emptying and releasing the pre-created memory area and deleting bitmap information specifically comprises:
if the application program is monitored to be closed, deleting the picture set cached in the memory area and the bitmap file;
deleting the memory area; and
deleting the at least one bitmap object; and the number of the first and second groups,
and nulling a reference function used when the application program calls the bitmap file.
6. An apparatus for calling a picture, comprising:
the device comprises an extraction module, a storage module and a processing module, wherein the extraction module is used for extracting a picture set from a local storage if the picture set is detected to be required to be called, and the picture set comprises at least one picture;
the detection module is used for detecting whether the size of the memory required by the picture set exceeds a preset threshold value;
the first caching module is used for caching the picture set into a system-specified memory area if the picture set is not cached in the system-specified memory area, so that an application program calls the picture set from the system-specified memory area;
the second cache module is used for caching the picture set into a pre-established memory area if the picture set is in the memory area, wherein the pre-established memory area is a memory area pre-established in a memory;
the creating module is used for creating a bitmap file which corresponds to each picture in the picture set one by one in the memory area so that the application program calls the bitmap file from the memory area; and the number of the first and second groups,
and the release module is used for emptying and releasing the pre-established memory area and deleting bitmap information if the application program is monitored to be closed, wherein the bitmap information is information generated when the bitmap file is established.
7. The apparatus of claim 6, wherein the creation module further comprises:
the creating sub-module is used for creating at least one middle bitmap file according to the picture set, and the at least one middle bitmap file corresponds to each picture in the picture set one by one;
the generation submodule is used for generating at least one bitmap object, wherein the bitmap object corresponds to the intermediate bitmap file one by one, and each bitmap object is used for identifying the corresponding intermediate bitmap file;
and the packaging sub-module is used for packaging the at least one intermediate bitmap file according to the at least one bitmap object so as to obtain a bitmap file corresponding to each intermediate bitmap file.
8. The apparatus of claim 7, wherein the encapsulation submodule is further configured to:
calling a packaging statement;
and according to the at least one bitmap object, packaging each of the at least one intermediate bitmap file into a bitmap file with a drawable format through the packaging statement.
9. The apparatus of claim 7, wherein the release module further comprises:
the positioning sub-module is used for positioning the memory area according to the at least one bitmap object if the application program is monitored to be closed;
and the release submodule is used for emptying and releasing the memory area.
10. The apparatus of claim 7, wherein the release module further comprises:
the first deleting submodule is used for deleting the picture set cached in the memory area and the bitmap file if the situation that the application program is closed is monitored;
the second deleting submodule is used for deleting the memory area; and
a third deletion submodule for deleting the at least one bitmap object; and the number of the first and second groups,
and the vacancy submodule is used for nulling a reference function used when the application program calls the bitmap file.
CN201710712580.0A 2017-08-18 2017-08-18 Picture calling method and device Active CN107656699B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710712580.0A CN107656699B (en) 2017-08-18 2017-08-18 Picture calling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710712580.0A CN107656699B (en) 2017-08-18 2017-08-18 Picture calling method and device

Publications (2)

Publication Number Publication Date
CN107656699A CN107656699A (en) 2018-02-02
CN107656699B true CN107656699B (en) 2020-11-10

Family

ID=61127715

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710712580.0A Active CN107656699B (en) 2017-08-18 2017-08-18 Picture calling method and device

Country Status (1)

Country Link
CN (1) CN107656699B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110032421B (en) * 2019-04-18 2021-09-28 腾讯科技(深圳)有限公司 Method and device for managing atlas in memory, terminal and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2053840A2 (en) * 2007-10-25 2009-04-29 Canon Kabushiki Kaisha Recording apparatus and method for controlling the recording apparatus
CN105046640A (en) * 2015-05-14 2015-11-11 深圳市美贝壳科技有限公司 Picture memory managing method and apparatus
CN105373471A (en) * 2014-08-29 2016-03-02 腾讯科技(深圳)有限公司 Detection method and apparatus for memory leak bug
CN105912480A (en) * 2016-04-01 2016-08-31 乐视控股(北京)有限公司 Cache management method, device and mobile terminal

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4786484B2 (en) * 2006-09-15 2011-10-05 ルネサスエレクトロニクス株式会社 Data supply method for arithmetic processing and image processing apparatus
CN100589104C (en) * 2008-01-25 2010-02-10 中兴通讯股份有限公司 Method and device for loading picture resource in embedded system
CN102662615B (en) * 2012-03-23 2015-01-14 安科智慧城市技术(中国)有限公司 Embedded equipment and picture displaying method and system of embedded equipment
CN104657378A (en) * 2013-11-20 2015-05-27 青岛海信移动通信技术股份有限公司 File cache method and device
CN103885753A (en) * 2014-03-03 2014-06-25 广州金山网络科技有限公司 Management method and device for caching images and client side
CN104267996A (en) * 2014-09-29 2015-01-07 广州金山网络科技有限公司 Image resource processing method, device and terminal
CN106802955B (en) * 2017-01-19 2020-06-16 浪潮通用软件有限公司 Picture data caching method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2053840A2 (en) * 2007-10-25 2009-04-29 Canon Kabushiki Kaisha Recording apparatus and method for controlling the recording apparatus
CN105373471A (en) * 2014-08-29 2016-03-02 腾讯科技(深圳)有限公司 Detection method and apparatus for memory leak bug
CN105046640A (en) * 2015-05-14 2015-11-11 深圳市美贝壳科技有限公司 Picture memory managing method and apparatus
CN105912480A (en) * 2016-04-01 2016-08-31 乐视控股(北京)有限公司 Cache management method, device and mobile terminal

Also Published As

Publication number Publication date
CN107656699A (en) 2018-02-02

Similar Documents

Publication Publication Date Title
CN107506291B (en) Analysis method and device based on data acquisition
CN108021590B (en) Target object attribute determining method, attribute updating method and device
EP3432159B1 (en) Garbage collection method and device
CN108121511B (en) Data processing method, device and equipment in distributed edge storage system
CN112732406B (en) Cloud platform virtual machine recovery method and computer equipment
CN105791354A (en) Job scheduling method and cloud scheduling server
JP2014529142A (en) Managing object life in a cyclic graph
CN104461786A (en) Recovery method and system for Android system
CN105786805A (en) Intelligent mobile terminal, document manager and file display method of same
CN107656699B (en) Picture calling method and device
CN101854359A (en) Access control method based on virtualized calculation
CN104166720A (en) Data recycling method of intelligent terminal device and intelligent terminal device
CN105426544A (en) Method and device for monitoring state of database
CN114691445A (en) Cluster fault processing method and device, electronic equipment and readable storage medium
CN115952491B (en) Method, device, electronic equipment and medium for hook objective function
CN104317673B (en) Recovery method, device and its restoration methods of application program, device
CN111857954A (en) Container management method, device, equipment and medium
CN113268401B (en) Log information output method and device and computer readable storage medium
CN105787359A (en) Course guarding method and device
CN107357864B (en) File processing method and terminal
CN115878932A (en) Website security event processing method, device, equipment and medium
CN106201358A (en) A kind of method and device of internal memory garbage reclamation
CN112286733B (en) Method, device and equipment for determining backup data recovery time and storage medium
CN111625336B (en) Thread data processing method and device
CN108011920B (en) Cloud backup method, electronic equipment, storage medium and system for all-in-one machine

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220805

Address after: 200131 building C, No. 888, Huanhu West 2nd Road, Lingang New District, Pudong New Area, Shanghai

Patentee after: Zhiche (Shanghai) Industrial Co.,Ltd.

Address before: 200335 rooms 904-906, building a, Hongqiao International Science and Technology Plaza, 999 Jinzhong Road, Changning District, Shanghai

Patentee before: SHANGHAI VCYBER INTELLIGENCE TECHNOLOGY CO.,LTD.