CN105912480A - Cache management method, device and mobile terminal - Google Patents

Cache management method, device and mobile terminal Download PDF

Info

Publication number
CN105912480A
CN105912480A CN201610204036.0A CN201610204036A CN105912480A CN 105912480 A CN105912480 A CN 105912480A CN 201610204036 A CN201610204036 A CN 201610204036A CN 105912480 A CN105912480 A CN 105912480A
Authority
CN
China
Prior art keywords
image
image control
resource
file
virtual machine
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.)
Pending
Application number
CN201610204036.0A
Other languages
Chinese (zh)
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.)
LeTV Holding Beijing Co Ltd
LeTV Mobile Intelligent Information Technology Beijing Co Ltd
Original Assignee
LeTV Holding Beijing Co Ltd
LeTV Mobile Intelligent Information Technology Beijing 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 LeTV Holding Beijing Co Ltd, LeTV Mobile Intelligent Information Technology Beijing Co Ltd filed Critical LeTV Holding Beijing Co Ltd
Priority to CN201610204036.0A priority Critical patent/CN105912480A/en
Publication of CN105912480A publication Critical patent/CN105912480A/en
Pending legal-status Critical Current

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
    • G06F12/12Replacement control
    • G06F12/121Replacement control using replacement algorithms
    • G06F12/123Replacement control using replacement algorithms with age lists, e.g. queue, most recently used [MRU] list or least recently used [LRU] list
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a cache management method, device and a mobile terminal, pertaining to the technical field of computer mobile terminals. The method comprises following steps: obtaining image files; generating image controls in order to display the image files in the image controls; recording the number of generated image controls; and determining whether the number of generated image controls exceeds the pre-set value, releasing image resources of at least one part of image controls when the pre-set value is exceeded and notifying a virtual machine to recover image resources released.Therefore, image resources of at least one part of image controls are released when the number of generated image controls exceeds the pre-set value, namely, the cache occupies much and the virtual machine is notified to recover image resources released in order to release cache space. As a result, the cache does not occupy too much and the mobile terminal kept running smoothly

Description

Buffer memory management method, device and mobile terminal
Technical field
The present invention relates to computer technical field of mobile terminals, be specifically related to a kind of buffer memory management method, Device and mobile terminal.
Background technology
In the mobile Internet epoch, user increasingly get used to the mobile terminals such as mobile phone browse photo, Webpage etc. with image file.In Android system, it will usually use the figures such as such as ImageView As control shows various picture, user often opens an image file, and mobile terminal will generate one Individual ImageView Image control, and according to the size of image file to be loaded, to Image control Distribute certain spatial cache.
Constantly open multiple image file along with user, mobile terminal will generate multiple ImageView Image control, can take increasing spatial cache, is limited to caching and the place of current mobile terminal The disposal ability of reason device, so can cause running of mobile terminal slow, even crash, collapse.
Summary of the invention
The technical problem to be solved in the present invention is that mobile terminal continuous load image file can take too much Caching, causes running of mobile terminal slow, even crashes, collapses.
To this end, embodiments provide a kind of buffer memory management method, including: obtain image file; Generate Image control to show described image file in described Image control;The image that record is generated The quantity of control;Judge that the quantity of the Image control generated, whether beyond preset value, is preset when exceeding During value, discharge the image resource of at least some of Image control, and notify what virtual machine recovery was discharged Image resource.
Preferably, the step of the image resource of at least some of Image control of described release includes: use Lru algorithm, the image resource of release least recently used image file.
Preferably, the step of the image resource of at least some of Image control of described release includes: according to The time order and function sequence that Image control generates, the literary composition of the image shown by Image control that release generates the earliest The image resource of part.
Preferably, described image file is bitmap format file.
Preferably, described method is after described notice virtual machine reclaims the image resource discharged, also Including: again notify after at preset time intervals that virtual machine reclaims the image resource discharged.
The embodiment of the present invention additionally provides a kind of cache management device, including: acquiring unit, it is used for obtaining Take image file;Signal generating unit, is used for generating Image control described with display in described Image control Image file;Record unit, for the quantity of the Image control that record is generated;Judging unit, uses In judging that whether the quantity of the Image control generated is beyond preset value;Releasing unit, for described When judging unit judges the quantity of the Image control generated beyond preset value, at least some of figure of release Image resource as control;Notification unit, the image resource discharged for notifying virtual machine to reclaim.
Preferably, described releasing unit uses lru algorithm, discharges least recently used image file Image resource.
Preferably, the time order and function sequence that described releasing unit generates according to Image control, release is the earliest The image resource of the image file shown by Image control generated.
Preferably, described notification unit be additionally operable to notice virtual machine reclaim the image resource that discharged it After predetermined time interval after, notice virtual machine reclaims the image resource that discharged again.
The embodiment of the present invention additionally provides a kind of mobile terminal, including the caching pipe described in any of the above-described item Reason device.
Buffer memory management method, device and the mobile terminal that the embodiment of the present invention is provided, at the figure generated As control quantity is beyond preset value, when i.e. caching takies excessive, discharge at least some of Image control Image resource, and notify that virtual machine reclaims the image resource that discharged to discharge spatial cache, thus can To keep caching will not take too much, keep running of mobile terminal smooth.
Accompanying drawing explanation
By being more clearly understood from the features and advantages of the present invention with reference to accompanying drawing, accompanying drawing is schematic And should not be construed as the present invention is carried out any restriction, in the accompanying drawings:
Fig. 1 shows the flow chart of buffer memory management method according to embodiments of the present invention;
Fig. 2 shows the schematic diagram of cache management device according to embodiments of the present invention.
Detailed description of the invention
Below in conjunction with accompanying drawing, embodiments of the present invention is described in detail.
Embodiments providing a kind of buffer memory management method, the method goes for mobile phone, puts down The mobile terminals such as plate computer, as it is shown in figure 1, the method comprises the steps:
S11. image file is obtained.When user clicks on certain image file, mobile terminal just can obtain Get the image file that user is clicked on.Preferably, image file is bitmap (bmp) formatted file, So mobile terminal can directly display when loading this document, and without decoding operation, opens more Rapidly.
S12. Image control is generated to show this image file in Image control.In Android system, This Image control can be such as ImageView Image control, and ImageView Image control is responsible for aobvious Diagram picture, the source of its image both can be the id of resource file, it is also possible to be Drawable object or Bitmap object, it is also possible to be the network address of content supplier.
S13. the quantity of the Image control that record is generated.User often opens an image file, mobile Terminal will generate an Image control, and mobile terminal can record the number of generated Image control Amount.
S14. judge whether the quantity of the Image control generated exceeds preset value, when beyond preset value Perform step S15, when without departing from preset value, illustrate that spatial cache still has a large amount of more than needed, it is not necessary to perform Any operation.Here, preset value can dispatch from the factory in advance according to the size of mobile terminal institute band caching Set, it is also possible to by user according to oneself use habit sets itself.
S15. the image resource of at least some of Image control is discharged.After image resource is released, should Image would not be shown.
S16. notice virtual machine reclaims the image resource discharged.
By above-mentioned steps, mobile terminal, i.e. caches beyond preset value in the Image control quantity generated When taking excessive, discharge the image resource of at least some of Image control, and notify that virtual machine reclaims institute The image resource of release, to discharge spatial cache, such that it is able to keep caching will not take too much, keeps Running of mobile terminal is smooth.
In step S15, mobile terminal can discharge the image resource of all images control, it is also possible to Only discharge the image resource of a part of Image control.Preferably, only release part figure As the image resource of control, and make caching take and remain in a certain degree, such that it is able to take into account Running of mobile terminal is smooth and to open image file speed fast.
Preferably, mobile terminal can use LRU (Least Recently Used) algorithm, the most in the recent period Minimum use algorithm, the image resource of release least recently used image file;Mobile terminal also may be used With the time order and function sequence generated according to Image control, discharge shown by the Image control generated the earliest The image resource of image file, such that it is able to make user obtain more preferably image browsing file experience.
As a kind of preferred implementation, after step S16, it is additionally may included in predetermined time interval After again notify that virtual machine reclaims the image resource that discharged.Mobile terminal is performing step S16 notice After virtual machine reclaims the image resource discharged, it is likely to be due to various reasons and causes discharged image to provide Source is not recovered, and is recovered to discharge spatial cache in order to ensure the image resource discharged, mobile whole End can notify after the such as 1-5 second that virtual machine reclaims the image resource discharged again.
Correspondingly, embodiments providing a kind of cache management device, this device goes for The mobile terminal such as mobile phone, panel computer, as in figure 2 it is shown, this device includes:
Acquiring unit 21, is used for obtaining image file.When user clicks on certain image file, mobile Terminal just can get the image file that user is clicked on.
Signal generating unit 22, is used for generating Image control to show this image file in Image control.? In Android system, this Image control can be such as ImageView Image control, and ImageView schemes As control is responsible for showing image, the source of its image both can be the id of resource file, it is also possible to be Drawable object or Bitmap object, it is also possible to be the network address of content supplier.
Record unit 23, for the quantity of the Image control that record is generated.User often opens a figure As file, mobile terminal will generate an Image control, and mobile terminal can be recorded and be generated The quantity of Image control.
Judging unit 24, for judging that whether the quantity of the Image control generated is beyond preset value.When When judging unit 24 judges the quantity of the Image control generated without departing from preset value, spatial cache is described Still have a large amount of more than needed, it is not necessary to perform any operation.Here, preset value can be according to mobile terminal institute The size of band caching and factory setting in advance, it is also possible to set voluntarily according to the use habit of oneself by user Fixed.
Releasing unit 25, the quantity of the Image control for judging to be generated at judging unit 24 exceeds pre- If during value, discharging the image resource of at least some of Image control.After image resource is released, should Image would not be shown.
Notification unit 26, the image resource discharged for notifying virtual machine to reclaim.
By said apparatus, mobile terminal, i.e. caches beyond preset value in the Image control quantity generated When taking excessive, discharge the image resource of at least some of Image control, and notify that virtual machine reclaims institute The image resource of release, to discharge spatial cache, such that it is able to keep caching will not take too much, keeps Running of mobile terminal is smooth.
Here, releasing unit 25 can discharge the image resource of all images control, it is also possible to only releases Put the image resource of a part of Image control.Preferably, a part of image control is only discharged The image resource of part, and make caching take and remain in a certain degree, such that it is able to take into account movement Terminal operating is smooth and to open image file speed fast.
Preferably, releasing unit 25 can use LRU (Least Recently Used) algorithm, i.e. Recent minimum use algorithm, the image resource of release least recently used image file;Releasing unit The 25 time order and function sequences that can also generate according to Image control, the Image control institute that release generates the earliest The image resource of the image file of display, such that it is able to make user obtain more preferably image browsing file body Test.
As a kind of preferred implementation, notification unit 26 is additionally operable to reclaim at notice virtual machine discharged Image resource after predetermined time interval after again notify virtual machine reclaim discharged image money Source.Notification unit 26, after notice virtual machine reclaims the image resource discharged, is likely to be due to all former Because causing discharged image resource not to be recovered, in order to ensure the image resource discharged be recovered with Release spatial cache, notification unit 26 can again notify after the such as 1-5 second that virtual machine reclaims and be released The image resource put.
The embodiment of the present invention additionally provides a kind of mobile terminal, and it includes that cache management as above fills Put, thus mobile terminal can be in the Image control quantity generated beyond preset value, i.e. caching took Time big, discharge the image resource of at least some of Image control, and notify what virtual machine recovery was discharged Image resource is to discharge spatial cache, such that it is able to keep caching will not take too much, keeps mobile whole End runs smoothness.
It should also be appreciated by one skilled in the art embodiments of the invention can be provided as method, system, Or computer program.Therefore, the present invention can use complete hardware embodiment, complete software to implement Example or the form of the embodiment in terms of combining software and hardware.And, the present invention can use at one Or multiple wherein include computer usable program code computer-usable storage medium (include but not It is limited to disk memory, CD-ROM, optical memory etc.) the upper computer program implemented Form.
The present invention is with reference to method, equipment (system) and computer program according to embodiments of the present invention The flow chart of product and/or block diagram describe, it should be understood that can be realized stream by computer program instructions In each flow process in journey figure and/or block diagram and/or square frame and flow chart and/or block diagram Flow process and/or the combination of square frame.These computer program instructions can be provided to general purpose computer, specially With the processor of computer, Embedded Processor or other programmable data processing device to produce one Machine so that the instruction performed by the processor of computer or other programmable data processing device is produced Raw for realizing one flow process of flow chart or multiple flow process and/or one square frame of block diagram or multiple side The device of the function specified in frame.
These computer program instructions may be alternatively stored in and computer or other programmable datas can be guided to process In the computer-readable memory that equipment works in a specific way so that be stored in this computer-readable and deposit Instruction in reservoir produces the manufacture including command device, and this command device realizes flow chart one The function specified in flow process or multiple flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions also can be loaded into computer or other programmable data processing device On so that on computer or other programmable devices, perform sequence of operations step to produce computer The process realized, thus the instruction performed on computer or other programmable devices provides and is used for realizing One flow process of flow chart or multiple flow process and/or one square frame of block diagram or multiple square frame are specified The step of function.
Although being described in conjunction with the accompanying embodiments of the present invention, but those skilled in the art can be Without departing from the case of the spirit and scope of the present invention, various modification can be adapted and modification, such amendment and Within the scope of modification each falls within and is defined by the appended claims.

Claims (10)

1. a buffer memory management method, it is characterised in that including:
Obtain image file;
Generate Image control to show described image file in described Image control;
The quantity of the Image control that record is generated;
Judge that the quantity of the Image control generated, whether beyond preset value, when beyond preset value, is released Put the image resource of at least some of Image control, and notify that virtual machine reclaims the image resource discharged.
Buffer memory management method the most according to claim 1, it is characterised in that described release is at least The step of the image resource of a part of Image control includes: uses lru algorithm, discharges minimum making The image resource of image file.
Buffer memory management method the most according to claim 1, it is characterised in that described release is at least The step of the image resource of a part of Image control includes: the time order and function row generated according to Image control Sequence, the image resource of the image file shown by Image control that release generates the earliest.
Buffer memory management method the most according to claim 1, it is characterised in that described image file It it is bitmap format file.
5. according to the buffer memory management method according to any one of claim 1-4, it is characterised in that After described notice virtual machine reclaims the image resource discharged, also include: after at preset time intervals Notice virtual machine reclaims the image resource discharged again.
6. a cache management device, it is characterised in that including:
Acquiring unit, is used for obtaining image file;
Signal generating unit, is used for generating Image control to show described image file in described Image control;
Record unit, for the quantity of the Image control that record is generated;
Judging unit, for judging that whether the quantity of the Image control generated is beyond preset value;
Releasing unit, the quantity of the Image control for judging to be generated at described judging unit exceeds pre- If during value, discharging the image resource of at least some of Image control;
Notification unit, the image resource discharged for notifying virtual machine to reclaim.
Cache management device the most according to claim 6, it is characterised in that described releasing unit Use lru algorithm, the image resource of release least recently used image file.
Cache management device the most according to claim 6, it is characterised in that described releasing unit The time order and function sequence generated according to Image control, the figure shown by Image control that release generates the earliest Image resource as file.
9. according to the cache management device according to any one of claim 6-8, it is characterised in that institute State notification unit to be additionally operable to reclaim between the scheduled time after the image resource discharged at notice virtual machine Every rear, notice virtual machine reclaims the image resource discharged again.
10. a mobile terminal, it is characterised in that include delaying according to any one of claim 6-9 Deposit managing device.
CN201610204036.0A 2016-04-01 2016-04-01 Cache management method, device and mobile terminal Pending CN105912480A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610204036.0A CN105912480A (en) 2016-04-01 2016-04-01 Cache management method, device and mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610204036.0A CN105912480A (en) 2016-04-01 2016-04-01 Cache management method, device and mobile terminal

Publications (1)

Publication Number Publication Date
CN105912480A true CN105912480A (en) 2016-08-31

Family

ID=56744599

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610204036.0A Pending CN105912480A (en) 2016-04-01 2016-04-01 Cache management method, device and mobile terminal

Country Status (1)

Country Link
CN (1) CN105912480A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107656699A (en) * 2017-08-18 2018-02-02 上海车音智能科技有限公司 Picture call method and device
CN111524059A (en) * 2019-02-01 2020-08-11 珠海金山办公软件有限公司 Memory utilization method, system, terminal and storage medium during image caching

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6125209A (en) * 1997-04-04 2000-09-26 Sony United Kingdom Limited Database accessing method and apparatus
CN101221580A (en) * 2008-01-03 2008-07-16 中兴通讯股份有限公司 Method for improving page layout display performance of embedded browser
CN102508892A (en) * 2011-10-25 2012-06-20 深圳市万兴软件有限公司 System and method for quickly previewing pictures
CN103631777A (en) * 2012-08-21 2014-03-12 腾讯科技(深圳)有限公司 Method and system for browsing image

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6125209A (en) * 1997-04-04 2000-09-26 Sony United Kingdom Limited Database accessing method and apparatus
CN101221580A (en) * 2008-01-03 2008-07-16 中兴通讯股份有限公司 Method for improving page layout display performance of embedded browser
CN102508892A (en) * 2011-10-25 2012-06-20 深圳市万兴软件有限公司 System and method for quickly previewing pictures
CN103631777A (en) * 2012-08-21 2014-03-12 腾讯科技(深圳)有限公司 Method and system for browsing image

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107656699A (en) * 2017-08-18 2018-02-02 上海车音智能科技有限公司 Picture call method and device
CN107656699B (en) * 2017-08-18 2020-11-10 上海车音智能科技有限公司 Picture calling method and device
CN111524059A (en) * 2019-02-01 2020-08-11 珠海金山办公软件有限公司 Memory utilization method, system, terminal and storage medium during image caching

Similar Documents

Publication Publication Date Title
US9158699B2 (en) Memory management techniques
CN106980579B (en) Picture loading method and device
CN111159436B (en) Method, device and computing equipment for recommending multimedia content
US11089354B1 (en) Content aggregator
CN111258921B (en) Garbage memory recycling method and device, electronic equipment and storage medium
CN111880991B (en) Memory optimization method and device, electronic equipment and computer readable storage medium
CN104808952B (en) data cache method and device
US9811261B1 (en) Dynamic buffer size
CN104503887A (en) Method and device for showing state of computing equipment
EP3734446B1 (en) Processing method, storage medium and electronic device
Okoshi et al. Attelia: Sensing user's attention status on smart phones
CN106649146A (en) Memory release method and apparatus
CN111083217A (en) Method and device for pushing Feed stream and electronic equipment
CN106358062A (en) Browser video file playing processing method and equipment
CN105912591A (en) Method and device for looking back image documents and mobile terminal
CN106708478B (en) Scroll view display method and apparatus
CN109472540B (en) Service processing method and device
CN105912480A (en) Cache management method, device and mobile terminal
CN112214376A (en) Storage space prompting method and device
CN104601535A (en) Video processing method and system
CN111475299A (en) Memory allocation method and device, storage medium and electronic equipment
US20120284313A1 (en) Monitoring heap in real-time by a mobile agent to assess performance of virtual machine
US20200117443A1 (en) Selective application updates based on usage analytics
KR101779791B1 (en) Transmitting information based on reading speed
CN102843369B (en) The Network Access Method at UI interface and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20160831