CN107704321A - Memory allocation method and device and terminal equipment - Google Patents

Memory allocation method and device and terminal equipment Download PDF

Info

Publication number
CN107704321A
CN107704321A CN201710914547.6A CN201710914547A CN107704321A CN 107704321 A CN107704321 A CN 107704321A CN 201710914547 A CN201710914547 A CN 201710914547A CN 107704321 A CN107704321 A CN 107704321A
Authority
CN
China
Prior art keywords
page
anonymous
recycled
compression
memory
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
CN201710914547.6A
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.)
Yuanxin Technology
Original Assignee
Yuanxin Technology
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 Yuanxin Technology filed Critical Yuanxin Technology
Priority to CN201710914547.6A priority Critical patent/CN107704321A/en
Publication of CN107704321A publication Critical patent/CN107704321A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • 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/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Abstract

The embodiment of the invention provides a memory allocation method, a memory allocation device and terminal equipment, wherein the memory allocation method comprises the following steps: when the anonymous page is recovered, compressing the anonymous page to be recovered, and determining a memory page corresponding to the compressed anonymous page to be recovered, wherein the memory page is a memory space with a preset size; and storing the compressed anonymous page to be recovered in the memory page. According to the method provided by the embodiment of the invention, the anonymous pages to be recovered are recovered to the memory space with the preset size, so that the operating system can run more application programs, the memory use efficiency is improved, and when the operating system needs to access the anonymous pages again, the anonymous pages are directly read from the memory space for storing the anonymous pages, so that the interaction between the anonymous pages and a magnetic disk is effectively avoided when the anonymous pages are processed, the input and output data volume of the magnetic disk is greatly reduced, and the performance of the operating system is obviously improved.

Description

The method, apparatus and terminal device of Memory Allocation
Technical field
The present invention relates to terminal device internal memory processing technology field, and specifically, the present invention relates to a kind of Memory Allocation Method, apparatus and terminal device.
Background technology
With the high speed development of technology, in order to meet people to the demand of the intelligent terminal of multiple operating system and to intelligent end The security requirement of operating system is held, carries out the virtual of intelligent terminal operation system usually using the following two kinds scheme in the industry at present Change, one kind is KVM (Kernel Virtual Machine, kernel virtual machine), and its advantage is safe, and shortcoming is consumption Resource is big;Another kind is to be based on linux container technology, and its advantage is lightweight.Because can use for intelligent terminal operation system is interior It is limited to deposit, and then, no matter using any virtualization scheme, when running two or more operating systems at the same time, all can The problem of being related to memory management, the utilization rate for improving internal memory and the performance for improving operating system turn into urgent problem to be solved.
At present, in the case where multiple operating system is run simultaneously, each operating system can take a large amount of internal memories to run Application program, because intelligent terminal is different from server, the memory size of intelligent terminal is often limited, then, works as operation When system discovery internal memory residual capacity is too low, operating system nucleus can carry out page recovery, that is, kill some background process, To vacate memory headroom.Wherein, most typical example is exactly that, when internal memory residual capacity is too low, can directly reclaim the clean page Internal memory, and the dirty page is write disk up, namely the anonymous page of process is write in the exchange partition of disk, to release The internal memory of its occupancy is put, waits and reads the anonymous page from disk again when needing, however, the read or write speed of disk is often slower than internal memory A lot, when programmer request occurs, operating system inputoutput data amount will be caused substantially to rise, cause operating system performance tight Decline again, or even the phenomenon of operating system interim card occur.
The content of the invention
To overcome above-mentioned technical problem or solving above-mentioned technical problem at least in part, spy proposes following technical scheme:
The embodiment provides a kind of method of Memory Allocation, including:
When reclaiming the anonymous page, the anonymous page to be recycled is compressed, and determines the anonymous page pair to be recycled after compression The page answered, wherein, the page is the memory headroom of default size;
The anonymous page to be recycled after compression is stored in the page.
Preferably, page corresponding to the anonymous page to be recycled after the determination compression, is specifically included:
Determine to whether there is free space in allocated multiple pages;
If free space be present, there will be the page of free space to be defined as the anonymous page pair to be recycled after compression The page answered;
If free space is not present, a page is distributed for the anonymous page to be recycled after compression;
Wherein, a page can store the anonymous page to be recycled after N number of compression, and N is positive integer.
Preferably, it is described to determine to whether there is free space in allocated multiple pages, including:
Allocated multiple pages are traveled through successively, to judge in allocated multiple pages with the presence or absence of available sky Between.
Preferably, the sequencing according to the distribution time, allocated multiple pages are connected successively in the form of chained list Connect.
Preferably, the compression anonymous page to be recycled, is specifically included:
The anonymous page to be recycled is extracted, and the anonymous page to be recycled is pressed by default compression algorithm Contracting.
Another embodiment of the present invention provides a kind of device of Memory Allocation, including:
Compression module, for when reclaiming the anonymous page, compressing the anonymous page to be recycled, and determine to treat back after compression Page corresponding to the anonymous page is received, wherein, the page is the memory headroom of default size;
Memory module, for the anonymous page to be recycled after compression to be stored in into the page.
Preferably, the compression module specifically includes:
Judging submodule, for determining to whether there is free space in allocated multiple pages;
Determination sub-module, for when judging submodule determination has free space, there will be the page of free space It is defined as page corresponding to the anonymous page to be recycled after compression;When judging submodule determines that free space is not present, it is The anonymous page to be recycled after compression distributes a page;Wherein, a page can store to be recycled after N number of compression The anonymous page, N are positive integer.
Preferably, the judging submodule is specifically used for traveling through allocated multiple pages successively, to judge to have distributed Multiple pages in whether there is free space.
Preferably, the sequencing according to the distribution time, allocated multiple pages are connected successively in the form of chained list Connect.
Preferably, the compression module is specifically used for extracting the anonymous page to be recycled, and by presetting compression algorithm pair The anonymous page to be recycled is compressed.
Another embodiment of the present invention provides a kind of terminal device, including memory, processor and is stored in memory Computer program that is upper and can running on a processor, it is characterised in that realized during the computing device described program above-mentioned The method of Memory Allocation.
Embodiment of the present invention provides a kind of method of Memory Allocation, and compressing the anonymous page to be recycled can be certain Reduce the memory space that the anonymous page to be recycled takes in degree, the anonymous page be recycled to the memory headroom of default size, Memory headroom can be not only discharged to use to other applications so that operating system can run more application programs, The service efficiency of internal memory is improved, and when operating system needs to access again these anonymous pages, directly these are hidden from preservation Name the page memory headroom in read, so as to effectively prevent handle the anonymous page when with interacting between disk, greatly The inputoutput data amount of disk is reduced, significantly improves the performance of operating system.
The additional aspect of the present invention and advantage will be set forth in part in the description, and these will become from the following description Obtain substantially, or recognized by the practice of the present invention.
Brief description of the drawings
Of the invention above-mentioned and/or additional aspect and advantage will become from the following description of the accompanying drawings of embodiments Substantially and it is readily appreciated that, wherein:
Fig. 1 is the flow chart of the memory allocation method of the embodiment of the present invention;
Fig. 2 is the basic process schematic diagram of the memory allocation method of the embodiment of the present invention;
Fig. 3 is the schematic diagram with the anonymous page after the storage compression of chain sheet form of the embodiment of the present invention;
Fig. 4 is the schematic diagram of the anonymous page after the random storage compression of the embodiment of the present invention;
Fig. 5 is the structural representation of the Memory Allocation device of further embodiment of this invention;
Fig. 6 is the structural representation of the Memory Allocation device of another embodiment of the present invention;
Fig. 7 is the structural representation of the terminal device of another embodiment of the present invention.
Embodiment
Embodiments of the invention are described below in detail, the example of the embodiment is shown in the drawings, wherein from beginning to end Same or similar label represents same or similar element or the element with same or like function.Below with reference to attached The embodiment of figure description is exemplary, is only used for explaining the present invention, and is not construed as limiting the claims.
Those skilled in the art of the present technique are appreciated that unless expressly stated, singulative " one " used herein, " one It is individual ", " described " and "the" may also comprise plural form.It is to be further understood that what is used in the specification of the present invention arranges Diction " comprising " refer to the feature, integer, step, operation, element and/or component be present, but it is not excluded that in the presence of or addition One or more other features, integer, step, operation, element, component and/or their groups.It should be understood that when we claim member Part is " connected " or during " coupled " to another element, and it can be directly connected or coupled to other elements, or there may also be Intermediary element.In addition, " connection " used herein or " coupling " can include wireless connection or wireless coupling.It is used herein to arrange Taking leave "and/or" includes whole or any cell and all combinations of one or more associated list items.
Those skilled in the art of the present technique are appreciated that unless otherwise defined, all terms used herein (including technology art Language and scientific terminology), there is the general understanding identical meaning with the those of ordinary skill in art of the present invention.Should also Understand, those terms defined in such as general dictionary, it should be understood that have with the context of prior art The consistent meaning of meaning, and unless by specific definitions as here, idealization or the implication of overly formal otherwise will not be used To explain.
Those skilled in the art of the present technique are appreciated that " terminal " used herein above, " terminal device " both include wireless communication The equipment of number receiver, it only possesses the equipment of the wireless signal receiver of non-emissive ability, includes receiving again and transmitting hardware Equipment, its have on bidirectional communication link, can carry out two-way communication reception and launch hardware equipment.This equipment It can include:Honeycomb or other communication equipments, it has single line display or multi-line display or shown without multi-line The honeycomb of device or other communication equipments;PCS (Personal Communications Service, PCS Personal Communications System), it can With combine voice, data processing, fax and/or its communication ability;PDA (Personal Digital Assistant, it is personal Digital assistants), it can include radio frequency receiver, pager, the Internet/intranet access, web browser, notepad, day Go through and/or GPS (Global Positioning System, global positioning system) receiver;Conventional laptop and/or palm Type computer or other equipment, its have and/or the conventional laptop including radio frequency receiver and/or palmtop computer or its His equipment." terminal " used herein above, " terminal device " they can be portable, can transport, installed in the vehicles (aviation, Sea-freight and/or land) in, or be suitable for and/or be configured in local runtime, and/or with distribution form, operate in the earth And/or any other position operation in space." terminal " used herein above, " terminal device " can also be communication terminal, on Network termination, music/video playback terminal, such as can be PDA, MID (Mobile Internet Device, mobile Internet Equipment) and/or mobile phone or the equipment such as intelligent television, set top box with music/video playing function.
The embodiments of the invention provide a kind of method of Memory Allocation, as shown in figure 1, this method includes:Step 110, exist When reclaiming the anonymous page, the anonymous page to be recycled is compressed, and determines page corresponding to the anonymous page to be recycled after compression, Wherein, page is the memory headroom of default size;Step 120, the anonymous page to be recycled after compression is stored in page.
Preferably, the anonymous page to be recycled is compressed to specifically include:The anonymous page to be recycled is extracted, and passes through default pressure Compression algorithm is compressed to the anonymous page to be recycled.
Specifically, can be anonymous before anonymous programmer request is gone out, namely in release when anonymous page recovery occurs Before page internal memory, pass through default compression algorithm (such as LZO:LempelZivOberhumer, lossless data compression algorithms) it is right The anonymous page to be recycled is compressed, and one section of space of default size is distributed in internal memory, for storing hideing after compressing The name page, Fig. 2 illustrates a basic process of above-mentioned memory allocation method, in fig. 2, when due to internal memory residue free space When too low, it may occur that LRU (Least Recently Used, least recently used) shared file page, LRM (Link Resource Manager, Link resource manager) the anonymous page such as the anonymous other file pages of the page and LRU recovery, and It is swapped out and (carries out programmer request), wherein, before above-mentioned anonymous programmer request is gone out, first to above-mentioned to be recycled The anonymous page carries out Memory recycle operation, i.e., that is distributed in internal memory after one section of space storage compression of default size above-mentioned treats back The anonymous page is received, then carries out programmer request operation, and for the clean page, then directly carry out Memory recycle operation.Pass through this Kind operating method, it can not only discharge memory headroom and be used to other applications so that operating system can be run more Application program, and when operating system needs to access again these anonymous pages, directly from preserving these anonymous pages Read in memory headroom, without reading these anonymous pages into disk, greatly reduce the input and output of disk Data volume, significantly increase the performance of operating system.
Further, can be by being added in kernel code swap_write_page during specific implementation Hook, the anonymous page to be exchanged is extracted, is put into function compress_page, the function can call kernel to support Compression algorithm (such as LZO) the anonymous page is compressed, be then saved in structure variable compress_page_ In header, without the anonymous page is write on disk, wherein, compress_page_header signs herein are above-mentioned Page;When again reading off the anonymous page being saved in structure variable compress_page_header, also lead to A hook is crossed, the anonymous page is directly read from compress_page_header, and the anonymity is decompressed in internal memory The page, so as to avoid onto disk reading the anonymous page.
Embodiment of the present invention provides a kind of method of Memory Allocation, compared with prior art, compresses to be recycled hide The name page can reduce the memory space that the anonymous page to be recycled takes to a certain extent, the anonymous page is recycled to default Size memory headroom (the anonymous page after compression than it is uncompressed when shared memory headroom it is small), can not only discharge internal memory sky Between give other applications use so that operating system can run more application programs, improve the service efficiency of internal memory, and And when operating system needs to access again these anonymous pages, directly read from the memory headroom for preserving these anonymous pages , with interacting between disk when handling the anonymous page so as to effectively prevent, greatly reduce the input and output number of disk According to amount, the performance of operating system is significantly improved.
The alternatively possible implementation of the embodiment of the present invention, on the basis of as shown in Figure 1, step 110 is specifically wrapped Include:Step 111, determine to whether there is free space in allocated multiple pages, if step 112, free space be present, Page corresponding to the anonymous page to be recycled being defined as there will be the page of free space after compression;If in the absence of available sky Between, then distribute a page for the anonymous page to be recycled after compression;Wherein, after a page can store N number of compression The anonymous page to be recycled, N is positive integer.
Preferably, determine to whether there is free space in allocated multiple pages, including:Travel through successively allocated Multiple pages, to judge to whether there is free space in allocated multiple pages.
Preferably, the sequencing according to the distribution time, allocated multiple pages are connected successively in the form of chained list Connect.
Specifically, if the operation for reclaiming the anonymous page is initiated first, i.e., never occurred the anonymous page of recovery before Operation, then it is determined that corresponding to the anonymous page to be recycled after compression during page, direct one page of distribution, The anonymous page to be recycled after being compressed with storage, wherein, a page can store the anonymous page to be recycled after N number of compression Face, N are positive integer.It should be noted that the method for the Memory Allocation of the embodiment of the present invention, only distributes a page every time, The anonymous page to be recycled after page storage compression, the space of a page are possible to preserve and treated after several compress Reclaim the anonymous page.
Further, if the operation for reclaiming the anonymous page is not initiated first, i.e., occurred the anonymous page of recovery before The operation in face, then it is determined that corresponding to the anonymous page to be recycled after compression during page, it is first determined allocated It whether there is free space in multiple pages, if free space be present in allocated multiple pages, there will be can Page corresponding to the anonymous page to be recycled after being defined as compression with the page in space;If allocated multiple pages In free space is not present, then be that the anonymous page to be recycled after compression distributes a page, wherein, a page can The anonymous page to be recycled after N number of compression is stored, N is positive integer, and N preferred value is 2.
Further, during it is determined that whether there is free space in allocated multiple pages, travel through successively Allocated multiple pages, to judge to whether there is free space in allocated multiple pages.It should be noted that Distribution multiple pages according to distribution the time sequencing, be sequentially connected in the form of chained list, wherein, it is allocated certain , can be according to the sequencing of recovery time, the anonymous page in the form of chained list after storage compression in individual page, can also Random is stored in the anonymous page after compression in corresponding free space.
Further, by taking the anonymous page after a page only preserves two compressions as an example, i.e., N value is 2, briefly Illustrate the method for the Memory Allocation during implementing, wherein, represented with structure variable compress_page_header An allocated page, after represent to store in page with variable compress_page_first first compresses The anonymous page, abbreviation CPF, the anonymity after second compression for representing to store in page with variable compress_page_last The page.
Wherein, the value that Fig. 3 gives N is 2, and in some allocated page, the priority according to recovery time Sequentially, the schematic diagram of the anonymous page in the form of chained list after storage compression;The value that Fig. 4 gives N is 2, and is being distributed Some page in, by the anonymous page random storage after compression in the schematic diagram of corresponding free space.
Embodiment of the present invention provides a kind of method of Memory Allocation, it is determined that existing in allocated multiple pages During free space, the anonymous page to be recycled after compression is stored in the free space of allocated multiple pages, made interior The memory space for depositing page is efficiently utilized, according to the sequencing of distribution time, by allocated multiple pages with chained list Form be sequentially connected, can be in some feelings beneficial to when whether there is free space in searching allocated multiple pages Searched before directly being skipped under condition and in the absence of the page of free space, effectively improved search efficiency.
Another embodiment of the invention provides a kind of device of Memory Allocation, as shown in figure 5, including compression module 51 With memory module 52.
Compression module 51 is used for when reclaiming the anonymous page, compresses the anonymous page to be recycled, and determines to treat after compression Page corresponding to the anonymous page is reclaimed, wherein, page is the memory headroom of default size.
Memory module 52 is used to the anonymous page to be recycled after compression being stored in page.
Preferably, compression module 51 is specifically used for extracting the anonymous page to be recycled, and is treated by default compression algorithm The anonymous page of recovery is compressed.
Specifically, can be anonymous before anonymous programmer request is gone out, namely in release when anonymous page recovery occurs Before page internal memory, pass through default compression algorithm (such as LZO:LempelZivOberhumer, lossless data compression algorithms) it is right The anonymous page to be recycled is compressed, and one section of space of default size is distributed in internal memory, for storing hideing after compressing The name page, wherein, Fig. 2 illustrates a basic process of above-mentioned memory allocation method, in fig. 2, when can due to internal memory residue With space it is too low when, it may occur that LRU (Least Recently Used, least recently used) shared file page, LRM (Link Resource Manager, Link resource manager) the anonymous page such as the anonymous other file pages of the page and LRU recovery, and It is swapped out and (carries out programmer request), wherein, before above-mentioned anonymous programmer request is gone out, first to above-mentioned to be recycled The anonymous page carries out Memory recycle operation, i.e., that is distributed in internal memory after one section of space storage compression of default size above-mentioned treats back The anonymous page is received, then carries out programmer request operation, and for the clean page, then directly carry out Memory recycle operation.Pass through this Kind operating method, it can not only discharge memory headroom and be used to other applications so that operating system can be run more Application program, and when operating system needs to access again these anonymous pages, directly from preserving these anonymous pages Read in memory headroom, without reading these anonymous pages into disk, greatly reduce the input and output of disk Data volume, significantly improve the performance of operating system.
Embodiment of the present invention, anonymous page to be recycled can be reduced to a certain extent by compressing the anonymous page to be recycled The memory space that face takes, the anonymous page is recycled to the memory headroom of default size, can not only discharge memory headroom to Other applications use so that operating system can run more application programs, improve the service efficiency of internal memory, and work as When operating system needs to access again these anonymous pages, directly reading is from the memory headroom for preserving these anonymous pages Can, with interacting between disk when handling the anonymous page so as to effectively prevent, greatly reduce the inputoutput data of disk Amount, significantly improve the performance of operating system.
Preferably, as shown in fig. 6, the compression module 51 of the device specifically includes:Judging submodule 511 and determination sub-module 512。
Judging submodule 511, for determining to whether there is free space in allocated multiple pages.
Determination sub-module 512, for when judging submodule determination has free space, there will be the internal memory of free space Page is defined as page corresponding to the anonymous page to be recycled after compression;When judging submodule determines that free space is not present, A page is distributed for the anonymous page to be recycled after compression;Wherein, a page, which can store, treats back after N number of compression The anonymous page is received, N is positive integer.
Preferably, determine to whether there is free space in allocated multiple pages, including:Travel through successively allocated Multiple pages, to judge to whether there is free space in allocated multiple pages.
Preferably, the sequencing according to the distribution time, allocated multiple pages are connected successively in the form of chained list Connect.
Specifically, if the operation for reclaiming the anonymous page is initiated first, i.e., never occurred the anonymous page of recovery before Operation, then it is determined that corresponding to the anonymous page to be recycled after compression during page, direct one page of distribution, The anonymous page to be recycled after being compressed with storage, wherein, a page can store the anonymous page to be recycled after N number of compression Face, N are positive integer.It should be noted that the method for the Memory Allocation of the embodiment of the present invention, only distributes a page every time, The anonymous page to be recycled after page storage compression, the space of a page are possible to preserve and treated after several compress Reclaim the anonymous page.
Further, if the operation for reclaiming the anonymous page is not initiated first, i.e., occurred the anonymous page of recovery before The operation in face, then it is determined that corresponding to the anonymous page to be recycled after compression during page, it is first determined allocated It whether there is free space in multiple pages, if free space be present in allocated multiple pages, there will be can Page corresponding to the anonymous page to be recycled after being defined as compression with the page in space;If allocated multiple pages In free space is not present, then be that the anonymous page to be recycled after compression distributes a page, wherein, a page can The anonymous page to be recycled after N number of compression is stored, N is positive integer, and N preferred value is 2.
Further, during it is determined that whether there is free space in allocated multiple pages, travel through successively Allocated multiple pages, to judge to whether there is free space in allocated multiple pages.It should be noted that Distribution multiple pages according to distribution the time sequencing, be sequentially connected in the form of chained list, wherein, it is allocated certain , can be according to the sequencing of recovery time, the anonymous page in the form of chained list after storage compression in individual page, can also Random is stored in the anonymous page after compression in corresponding free space.
Embodiment of the present invention provides a kind of method of Memory Allocation, it is determined that existing in allocated multiple pages During free space, the anonymous page to be recycled after compression is stored in the free space of allocated multiple pages, made interior The memory space for depositing page is efficiently utilized, according to the sequencing of distribution time, by allocated multiple pages with chained list Form be sequentially connected, can be in some feelings beneficial to when whether there is free space in searching allocated multiple pages Searched before directly being skipped under condition and in the absence of the page of free space, effectively improved search efficiency.
The embodiment of the present invention additionally provides a kind of terminal device, as shown in fig. 7, for convenience of description, illustrate only and this The related part of inventive embodiments, particular technique details do not disclose, refer to present invention method part.The terminal can Think including desktop computer, tablet personal computer, PDA (Personal Digital Assistant, personal digital assistant), mobile phone, Any terminal devices such as POS (Point of Sales, point-of-sale terminal), vehicle-mounted computer, so that terminal is mobile phone as an example:
Fig. 7 is illustrated that the block diagram of the part-structure of the mobile phone related to terminal provided in an embodiment of the present invention.Reference chart 7, mobile phone includes:Radio frequency (Radio Frequency, RF) circuit 710, memory 720, input block 730, display unit 740, Sensor 750, voicefrequency circuit 760, Wireless Fidelity (wireless fidelity, WiFi) module 770, processor 780 and The grade part of power supply 790.It will be understood by those skilled in the art that the handset structure shown in Fig. 7 does not form the restriction to mobile phone, It can include than illustrating more or less parts, either combine some parts or different parts arrangement.
Each component parts of mobile phone is specifically introduced with reference to Fig. 7:
RF circuits 710 can be used for receive and send messages or communication process in, the reception and transmission of signal, especially, by base station After downlink information receives, handled to processor 780;In addition, it is sent to base station by up data are designed.Generally, RF circuits 710 Including but not limited to antenna, at least one amplifier, transceiver, coupler, low-noise amplifier (Low Noise Amplifier, LNA), duplexer etc..In addition, RF circuits 710 can also be communicated by radio communication with network and other equipment. Above-mentioned radio communication can use any communication standard or agreement, including but not limited to global system for mobile communications (Global System of Mobile communication, GSM), general packet radio service (General Packet Radio Service, GPRS), CDMA (Code Division Multiple Access, CDMA), WCDMA (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), Email, Short Message Service (Short Messaging Service, SMS) etc..
Memory 720 can be used for storage software program and module, and processor 780 is stored in memory 720 by operation Software program and module, so as to perform the various function application of mobile phone and data processing.Memory 720 can mainly include Storing program area and storage data field, wherein, storing program area can storage program area, the application journey needed at least one function Sequence (such as sound-playing function, image player function etc.) etc.;Storage data field can store uses what is created according to mobile phone Data (such as voice data, phone directory etc.) etc.., can be with addition, memory 720 can include high-speed random access memory Including nonvolatile memory, for example, at least a disk memory, flush memory device or other volatile solid-states Part.
Input block 730 can be used for the numeral or character information for receiving input, and produce with the user of mobile phone set with And the key signals input that function control is relevant.Specifically, input block 730 may include that contact panel 731 and other inputs are set Standby 732.Contact panel 731, also referred to as touch-screen, collect user on or near it touch operation (such as user use The operation of any suitable object such as finger, stylus or annex on contact panel 731 or near contact panel 731), and root Corresponding attachment means are driven according to formula set in advance.Optionally, contact panel 731 may include touch detecting apparatus and touch Two parts of controller.Wherein, the touch orientation of touch detecting apparatus detection user, and the signal that touch operation is brought is detected, Transmit a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and is converted into touching Point coordinates, then give processor 780, and the order sent of reception processing device 780 and can be performed.Furthermore, it is possible to using electricity The polytypes such as resistive, condenser type, infrared ray and surface acoustic wave realize contact panel 731.Except contact panel 731, input Unit 730 can also include other input equipments 732.Specifically, other input equipments 732 can include but is not limited to secondary or physical bond One or more in disk, function key (such as volume control button, switch key etc.), trace ball, mouse, action bars etc..
Display unit 740 can be used for display by user input information or be supplied to user information and mobile phone it is various Menu.Display unit 740 may include display panel 741, optionally, can use liquid crystal display (Liquid Crystal Display, LCD), the form such as Organic Light Emitting Diode (Organic Light-Emitting Diode, OLED) it is aobvious to configure Show panel 741.Further, contact panel 731 can cover display panel 741, when contact panel 731 is detected thereon or attached After near touch operation, processor 780 is sent to determine the type of touch event, is followed by subsequent processing device 780 according to touch event Type corresponding visual output is provided on display panel 741.Although in the figure 7, contact panel 731 and display panel 741 It is the part independent as two to realize the input of mobile phone and input function, but in some embodiments it is possible to by touch-control Panel 731 is integrated with display panel 741 and realizes input and the output function of mobile phone.
Mobile phone may also include at least one sensor 750, such as optical sensor, motion sensor and other sensors. Specifically, optical sensor may include ambient light sensor and proximity transducer, wherein, ambient light sensor can be according to ambient light Light and shade adjust the brightness of display panel 741, proximity transducer can close display panel 741 when mobile phone is moved in one's ear And/or backlight.As one kind of motion sensor, accelerometer sensor can detect in all directions (generally three axles) acceleration Size, size and the direction of gravity are can detect that when static, (for example horizontal/vertical screen is cut available for the application of identification mobile phone posture Change, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap) etc.;May be used also as mobile phone The other sensors such as the gyroscope of configuration, barometer, hygrometer, thermometer, infrared ray sensor, will not be repeated here.
Voicefrequency circuit 760, loudspeaker 761, microphone 762 can provide the COBBAIF between user and mobile phone.Audio-frequency electric Electric signal after the voice data received conversion can be transferred to loudspeaker 761, sound is converted to by loudspeaker 761 by road 760 Signal output;On the other hand, the voice signal of collection is converted to electric signal by microphone 762, is turned after being received by voicefrequency circuit 760 Voice data is changed to, then after voice data output processor 780 is handled, through RF circuits 710 to be sent to such as another mobile phone, Or voice data is exported to memory 720 further to handle.
WiFi belongs to short range wireless transmission technology, and mobile phone can help user's transceiver electronicses postal by WiFi module 770 Part, browse webpage and access streaming video etc., it has provided the user wireless broadband internet and accessed.Although Fig. 7 is shown WiFi module 770, but it is understood that, it is simultaneously not belonging to must be configured into for mobile phone, can not change as needed completely Become in the essential scope of invention and omit.
Processor 780 is the control centre of mobile phone, using various interfaces and the various pieces of connection whole mobile phone, is led to Cross operation or perform the software program and/or module being stored in memory 720, and call and be stored in memory 720 Data, the various functions and processing data of mobile phone are performed, so as to carry out integral monitoring to mobile phone.Optionally, processor 780 can wrap Include one or more processing units;Preferably, processor 780 can integrate application processor and modem processor, wherein, should Operating system, user interface and application program etc. are mainly handled with processor, modem processor mainly handles radio communication. It is understood that above-mentioned modem processor can not also be integrated into processor 780.
Mobile phone also includes the power supply 790 (such as battery) to all parts power supply, it is preferred that power supply can pass through power supply pipe Reason system and processor 780 are logically contiguous, so as to realize management charging, electric discharge and power managed by power-supply management system Etc. function.
Although being not shown, mobile phone can also include camera, bluetooth module etc., will not be repeated here.
In embodiments of the present invention, the processor 780 included by the terminal also has following functions:
When reclaiming the anonymous page, the anonymous page to be recycled is compressed, and determines the anonymous page pair to be recycled after compression The page answered, wherein, page is the memory headroom of default size;
The anonymous page to be recycled after compression is stored in page.
Preferably, it is determined that compression after the anonymous page to be recycled corresponding to page, specifically include:
Determine to whether there is free space in allocated multiple pages;
If free space be present, there will be the page of free space to be defined as the anonymous page to be recycled after compression Page;
If free space is not present, a page is distributed for the anonymous page to be recycled after compression;
Wherein, a page can store the anonymous page to be recycled after N number of compression, and N is positive integer.
Preferably, determine to whether there is free space in allocated multiple pages, including:Travel through successively allocated Multiple pages, to judge to whether there is free space in allocated multiple pages.
Preferably, the sequencing according to the distribution time, allocated multiple pages are connected successively in the form of chained list Connect.
Preferably, the anonymous page to be recycled is compressed, is specifically included:The anonymous page to be recycled is extracted, and by default Compression algorithm is compressed to the anonymous page to be recycled.
Those skilled in the art of the present technique are appreciated that the present invention includes being related to for performing in operation described herein One or more equipment.These equipment can specially be designed and manufactured for required purpose, or can also be included general Known device in computer.These equipment have the computer program being stored in it, and these computer programs are optionally Activation or reconstruct.Such computer program can be stored in equipment (for example, computer) computer-readable recording medium or be stored in E-command and it is coupled to respectively in any kind of medium of bus suitable for storage, the computer-readable medium is included but not Be limited to any kind of disk (including floppy disk, hard disk, CD, CD-ROM and magneto-optic disk), ROM (Read-Only Memory, only Read memory), RAM (Random Access Memory, immediately memory), EPROM (Erasable Programmable Read-Only Memory, Erarable Programmable Read only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory, EEPROM), flash memory, magnetic card or light card Piece.It is, computer-readable recording medium includes storing or transmitting any Jie of information in the form of it can read by equipment (for example, computer) Matter.
Those skilled in the art of the present technique be appreciated that can with computer program instructions come realize these structure charts and/or The combination of each frame and these structure charts and/or the frame in block diagram and/or flow graph in block diagram and/or flow graph.This technology is led Field technique personnel be appreciated that these computer program instructions can be supplied to all-purpose computer, special purpose computer or other The processor of programmable data processing method is realized, so as to pass through the processing of computer or other programmable data processing methods Device performs the scheme specified in the frame of structure chart and/or block diagram and/or flow graph disclosed by the invention or multiple frames.
Those skilled in the art of the present technique are appreciated that in the various operations discussed in the present invention, method, flow Step, measure, scheme can be replaced, changed, combined or deleted.Further, it is each with having been discussed in the present invention Kind operation, method, other steps in flow, measure, scheme can also be replaced, changed, reset, decomposed, combined or deleted. Further, it is of the prior art to have and the step in the various operations disclosed in the present invention, method, flow, measure, scheme It can also be replaced, changed, reset, decomposed, combined or deleted.
Described above is only some embodiments of the present invention, it is noted that for the ordinary skill people of the art For member, under the premise without departing from the principles of the invention, some improvements and modifications can also be made, these improvements and modifications also should It is considered as protection scope of the present invention.

Claims (10)

  1. A kind of 1. method of Memory Allocation, it is characterised in that including:
    When reclaiming the anonymous page, the anonymous page to be recycled is compressed, and is determined corresponding to the anonymous page to be recycled after compression Page, wherein, the page is the memory headroom of default size;
    The anonymous page to be recycled after compression is stored in the page.
  2. 2. according to the method for claim 1, it is characterised in that described to determine corresponding to the anonymous page to be recycled after compressing Page, specifically include:
    Determine to whether there is free space in allocated multiple pages;
    If free space be present, there will be the page of free space to be defined as corresponding to the anonymous page to be recycled after compressing Page;
    If free space is not present, a page is distributed for the anonymous page to be recycled after compression;
    Wherein, a page can store the anonymous page to be recycled after N number of compression, and N is positive integer.
  3. 3. according to the method for claim 2, it is characterised in that described to determine to whether there is in allocated multiple pages Free space, including:
    Allocated multiple pages are traveled through successively, to judge to whether there is free space in allocated multiple pages.
  4. 4. according to the method for claim 3, it is characterised in that including:
    According to the sequencing of distribution time, allocated multiple pages are sequentially connected in the form of chained list.
  5. 5. according to the method for claim 1, it is characterised in that the compression anonymous page to be recycled, specifically include:
    The anonymous page to be recycled is extracted, and the anonymous page to be recycled is compressed by default compression algorithm.
  6. A kind of 6. device of Memory Allocation, it is characterised in that including:
    Compression module, for when reclaiming the anonymous page, compressing the anonymous page to be recycled, and determine to be recycled hideing after compression Page corresponding to the name page, wherein, the page is the memory headroom of default size;
    Memory module, for the anonymous page to be recycled after compression to be stored in into the page.
  7. 7. device according to claim 6, it is characterised in that the compression module specifically includes:
    Judging submodule, for determining to whether there is free space in allocated multiple pages;
    Determination sub-module, for when judging submodule determines to have free space, there will be the determination of the page of free space For page corresponding to the anonymous page to be recycled after compression;When judging submodule determines that free space is not present, for compression The anonymous page to be recycled afterwards distributes a page;Wherein, a page can store the anonymity to be recycled after N number of compression The page, N are positive integer.
  8. 8. device according to claim 7, it is characterised in that the judging submodule is specifically used for traveling through successively having distributed Multiple pages, to judge to whether there is free space in allocated multiple pages.
  9. 9. device according to claim 8, it is characterised in that, will be allocated more according to the sequencing of distribution time Individual page is sequentially connected in the form of chained list.
  10. 10. a kind of terminal device, including memory, processor and storage are on a memory and the calculating that can run on a processor Machine program, it is characterised in that the Memory Allocation described in claim any one of 1-5 is realized during the computing device described program Method.
CN201710914547.6A 2017-09-30 2017-09-30 Memory allocation method and device and terminal equipment Pending CN107704321A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710914547.6A CN107704321A (en) 2017-09-30 2017-09-30 Memory allocation method and device and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710914547.6A CN107704321A (en) 2017-09-30 2017-09-30 Memory allocation method and device and terminal equipment

Publications (1)

Publication Number Publication Date
CN107704321A true CN107704321A (en) 2018-02-16

Family

ID=61174740

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710914547.6A Pending CN107704321A (en) 2017-09-30 2017-09-30 Memory allocation method and device and terminal equipment

Country Status (1)

Country Link
CN (1) CN107704321A (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110008016A (en) * 2019-04-15 2019-07-12 深圳市万普拉斯科技有限公司 Anonymous page management method, device, terminal device and readable storage medium storing program for executing
CN110457235A (en) * 2019-08-20 2019-11-15 Oppo广东移动通信有限公司 Memory compression methods, device, terminal and storage medium
CN110532197A (en) * 2019-08-30 2019-12-03 Oppo(重庆)智能科技有限公司 Method for recovering internal storage and device, electronic equipment, storage medium
CN110888746A (en) * 2019-12-10 2020-03-17 Oppo(重庆)智能科技有限公司 Memory management method and device, storage medium and electronic equipment
CN110908923A (en) * 2018-09-14 2020-03-24 阿里巴巴集团控股有限公司 Memory recovery method and device
CN111352861A (en) * 2020-02-19 2020-06-30 Oppo广东移动通信有限公司 Memory compression method and device and electronic equipment
CN111581119A (en) * 2020-05-07 2020-08-25 Oppo(重庆)智能科技有限公司 Page recovery method and device
CN111880928A (en) * 2020-07-06 2020-11-03 Oppo广东移动通信有限公司 Method for selecting process to release and terminal equipment
CN111949564A (en) * 2020-08-13 2020-11-17 青岛海信传媒网络技术有限公司 Memory exchange method and display device
CN111984374A (en) * 2020-08-20 2020-11-24 海光信息技术有限公司 Method for managing secure memory, system, apparatus and storage medium therefor
CN111984413A (en) * 2020-08-20 2020-11-24 Oppo(重庆)智能科技有限公司 Memory recovery method and device, electronic equipment and storage medium
CN112685371A (en) * 2020-12-30 2021-04-20 江苏达科信息科技有限公司 File storage space distribution method and device based on big data and storage medium
CN113544683A (en) * 2019-03-11 2021-10-22 日本电信电话株式会社 Data generalization device, data generalization method, and program
CN114185494A (en) * 2022-02-16 2022-03-15 荣耀终端有限公司 Memory anonymous page processing method, electronic device and readable storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286878A (en) * 2008-04-22 2008-10-15 中兴通讯股份有限公司 Management method of memory pool for terminal
CN104375899A (en) * 2014-11-21 2015-02-25 北京应用物理与计算数学研究所 Thread for high-performance computer NUMA perception and memory resource optimizing method and system
CN105511798A (en) * 2014-09-24 2016-04-20 中国电信股份有限公司 Method and system for managing virtual machine cache resource
WO2016167948A1 (en) * 2015-04-14 2016-10-20 Microsoft Technology Licensing, Llc Reducing memory commit charge when compressing memory
CN106354562A (en) * 2016-08-25 2017-01-25 上海传英信息技术有限公司 Memory cleaning system and memory cleaning method
CN106844033A (en) * 2017-01-23 2017-06-13 努比亚技术有限公司 One kind application quick start method and terminal
CN106844032A (en) * 2017-01-23 2017-06-13 努比亚技术有限公司 The storage processing method and device of a kind of terminal applies
CN106980541A (en) * 2017-03-10 2017-07-25 浙江大学 A kind of big page memory compression recovery system and method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286878A (en) * 2008-04-22 2008-10-15 中兴通讯股份有限公司 Management method of memory pool for terminal
CN105511798A (en) * 2014-09-24 2016-04-20 中国电信股份有限公司 Method and system for managing virtual machine cache resource
CN104375899A (en) * 2014-11-21 2015-02-25 北京应用物理与计算数学研究所 Thread for high-performance computer NUMA perception and memory resource optimizing method and system
WO2016167948A1 (en) * 2015-04-14 2016-10-20 Microsoft Technology Licensing, Llc Reducing memory commit charge when compressing memory
CN106354562A (en) * 2016-08-25 2017-01-25 上海传英信息技术有限公司 Memory cleaning system and memory cleaning method
CN106844033A (en) * 2017-01-23 2017-06-13 努比亚技术有限公司 One kind application quick start method and terminal
CN106844032A (en) * 2017-01-23 2017-06-13 努比亚技术有限公司 The storage processing method and device of a kind of terminal applies
CN106980541A (en) * 2017-03-10 2017-07-25 浙江大学 A kind of big page memory compression recovery system and method

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110908923A (en) * 2018-09-14 2020-03-24 阿里巴巴集团控股有限公司 Memory recovery method and device
CN110908923B (en) * 2018-09-14 2023-05-02 阿里巴巴集团控股有限公司 Memory recycling method and device
CN113544683B (en) * 2019-03-11 2023-09-29 日本电信电话株式会社 Data generalization device, data generalization method, and program
CN113544683A (en) * 2019-03-11 2021-10-22 日本电信电话株式会社 Data generalization device, data generalization method, and program
CN110008016A (en) * 2019-04-15 2019-07-12 深圳市万普拉斯科技有限公司 Anonymous page management method, device, terminal device and readable storage medium storing program for executing
CN110457235B (en) * 2019-08-20 2021-10-08 Oppo广东移动通信有限公司 Memory compression method, device, terminal and storage medium
CN110457235A (en) * 2019-08-20 2019-11-15 Oppo广东移动通信有限公司 Memory compression methods, device, terminal and storage medium
CN110532197A (en) * 2019-08-30 2019-12-03 Oppo(重庆)智能科技有限公司 Method for recovering internal storage and device, electronic equipment, storage medium
CN110888746A (en) * 2019-12-10 2020-03-17 Oppo(重庆)智能科技有限公司 Memory management method and device, storage medium and electronic equipment
CN110888746B (en) * 2019-12-10 2023-06-02 Oppo(重庆)智能科技有限公司 Memory management method and device, storage medium and electronic equipment
CN111352861A (en) * 2020-02-19 2020-06-30 Oppo广东移动通信有限公司 Memory compression method and device and electronic equipment
CN111352861B (en) * 2020-02-19 2023-09-29 Oppo广东移动通信有限公司 Memory compression method and device and electronic equipment
CN111581119A (en) * 2020-05-07 2020-08-25 Oppo(重庆)智能科技有限公司 Page recovery method and device
CN111880928A (en) * 2020-07-06 2020-11-03 Oppo广东移动通信有限公司 Method for selecting process to release and terminal equipment
CN111880928B (en) * 2020-07-06 2024-04-19 Oppo广东移动通信有限公司 Method for releasing selection process and terminal equipment
CN111949564A (en) * 2020-08-13 2020-11-17 青岛海信传媒网络技术有限公司 Memory exchange method and display device
CN111984413A (en) * 2020-08-20 2020-11-24 Oppo(重庆)智能科技有限公司 Memory recovery method and device, electronic equipment and storage medium
CN111984374A (en) * 2020-08-20 2020-11-24 海光信息技术有限公司 Method for managing secure memory, system, apparatus and storage medium therefor
CN112685371A (en) * 2020-12-30 2021-04-20 江苏达科信息科技有限公司 File storage space distribution method and device based on big data and storage medium
CN114185494A (en) * 2022-02-16 2022-03-15 荣耀终端有限公司 Memory anonymous page processing method, electronic device and readable storage medium

Similar Documents

Publication Publication Date Title
CN107704321A (en) Memory allocation method and device and terminal equipment
CN107368518B (en) Notification message management method, terminal and computer readable storage medium
CN108089977B (en) Application program exception handling method and device and mobile terminal
CN108156508B (en) Barrage information processing method and device, mobile terminal, server and system
CN106022075B (en) A kind of unlocked by fingerprint method and terminal
CN104978115A (en) Content display method and device
CN106127000B (en) A kind of unlocked by fingerprint method and terminal
CN109885574B (en) Data query method and device
CN105912919B (en) A kind of unlocked by fingerprint method and terminal
CN106502824A (en) Data back up method and Cloud Server
CN104699501B (en) A kind of method and device for running application program
CN106022074B (en) A kind of unlocked by fingerprint method and terminal
CN108322897B (en) Card package meal combination method and device
CN107480054B (en) Call chain data processing method and device and computer readable storage medium
CN106569916A (en) Data backup method and mobile terminal
CN112597115A (en) Container mirror image compression method and device, terminal equipment and medium
CN106534288A (en) Data transmission method and mobile terminal
CN112231144A (en) Data processing method and device and electronic equipment
CN110633438A (en) News event processing method, terminal, server and storage medium
CN104901992A (en) Resource transfer method and device
CN106527846A (en) Displaying method, displaying device and terminal equipment
CN107231469B (en) Terminal application management method, terminal and computer readable storage medium
CN111338745A (en) Deployment method and device of virtual machine and intelligent equipment
CN109873901A (en) A kind of screenshot method for managing resource and terminal, computer readable storage medium
CN106815078A (en) A kind of internal memory control method and equipment

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20180216

RJ01 Rejection of invention patent application after publication