[go: up one dir, main page]

CN110532197A - Method for recovering internal storage and device, electronic equipment, storage medium - Google Patents

Method for recovering internal storage and device, electronic equipment, storage medium Download PDF

Info

Publication number
CN110532197A
CN110532197A CN201910815705.1A CN201910815705A CN110532197A CN 110532197 A CN110532197 A CN 110532197A CN 201910815705 A CN201910815705 A CN 201910815705A CN 110532197 A CN110532197 A CN 110532197A
Authority
CN
China
Prior art keywords
memory
target
default
target process
internal storage
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.)
Granted
Application number
CN201910815705.1A
Other languages
Chinese (zh)
Other versions
CN110532197B (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.)
Oppo Chongqing Intelligent Technology Co Ltd
Original Assignee
Oppo Chongqing Intelligent 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 Oppo Chongqing Intelligent Technology Co Ltd filed Critical Oppo Chongqing Intelligent Technology Co Ltd
Priority to CN201910815705.1A priority Critical patent/CN110532197B/en
Publication of CN110532197A publication Critical patent/CN110532197A/en
Application granted granted Critical
Publication of CN110532197B publication Critical patent/CN110532197B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/445Program loading or initiating
    • G06F9/44594Unloading
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Retry When Errors Occur (AREA)

Abstract

The embodiment of the present disclosure is about a kind of method for recovering internal storage and device, electronic equipment, storage medium, it is related to field of computer technology, this method comprises: triggering low memory management service if detecting the Memory Allocation operation failure to default process and carrying out cleaning operation to target process;If detecting, the cleaning operation terminates, and carries out reclaimer operation to the memory pages of the target process, and continue to carry out Memory Allocation operation to the default process by the reclaimer operation.The technical solution of the disclosure can recycle memory in time, alleviate the situation of memory anxiety, improve system performance.

Description

Method for recovering internal storage and device, electronic equipment, storage medium
Technical field
This disclosure relates to field of computer technology, in particular to a kind of method for recovering internal storage, Memory recycle device, Electronic equipment and computer readable storage medium.
Background technique
Android mobile phone memory headroom is limited, and mobile phone in use for some time, can accumulate more process from the background, therefore Certain memory headroom can be occupied.If Installed System Memory is nervous, the Memory Allocation request of application currently in use is unable to get full Foot, will do it Memory recycle, if Memory recycle is not still able to satisfy and free memory is lower than preset value, will start low memory pipe The process that services selection is not used recently is managed to clear up.
In the related technology, self EMS memory can be discharged when process exits destruction after low memory management service clean up process to account for With.But under some scenes, process needs certain resources before exiting destruction, which may be relatively slow or even process can not exit.On State in mode, memory release efficiency is lower and memory release reliability is low, and will not alleviate the situation of memory anxiety, influence be System stability.
It should be noted that information is only used for reinforcing the reason to the background of the disclosure disclosed in above-mentioned background technology part Solution, therefore may include the information not constituted to the prior art known to persons of ordinary skill in the art.
Summary of the invention
The disclosure is designed to provide a kind of method for recovering internal storage and device, electronic equipment, storage medium, and then at least Overcome the problems, such as that memory can not be recycled caused by the limitation and defect due to the relevant technologies to a certain extent.
Other characteristics and advantages of the disclosure will be apparent from by the following detailed description, or partially by the disclosure Practice and acquistion.
According to one aspect of the disclosure, a kind of method for recovering internal storage is provided, comprising: if detecting to default process Memory Allocation operation failure then triggers low memory management service and carries out cleaning operation to target process;If detecting the cleaning Operation terminates, then carries out reclaimer operation to the memory pages of the target process, and continue to described by the reclaimer operation Default process carries out Memory Allocation operation.
According to one aspect of the disclosure, a kind of Memory recycle device is provided, comprising: process cleaning modul, if for examining The Memory Allocation operation failure to default process is measured, then triggers low memory management service and cleaning operation is carried out to target process; Page recycling module, if being recycled for detecting that the cleaning operation terminates to the memory pages of the target process Operation, and continue to carry out Memory Allocation operation to the default process by the reclaimer operation.
According to one aspect of the disclosure, a kind of electronic equipment is provided, comprising: processor;And memory, for storing The executable instruction of the processor;Wherein, the processor is configured to above-mentioned to execute via the executable instruction is executed Method for recovering internal storage described in any one.
According to one aspect of the disclosure, a kind of computer readable storage medium is provided, computer program is stored thereon with, The computer program realizes method for recovering internal storage described in above-mentioned any one when being executed by processor.
The method for recovering internal storage that is there is provided in the embodiment of the present disclosure, Memory recycle device, electronic equipment and computer-readable In storage medium, in the Memory Allocation operation failure to default process, by carrying out cleaning operation to target process, and clear The memory pages of target process are recycled at the end of reason operation.On the one hand, due to withouting waiting for the money in default process Source information discharges automatically, but is recycled by the memory pages to target process so that target process automatically exits from, in turn To preset process storage allocation, completes and exit target process and to preset the operation of process storage allocation, avoid default The case where process and target process form endless loop and can not recycle memory caused by mutually waiting and limit, improves memory The efficiency of recycling and Memory Allocation increases the validity of Memory recycle and the reliability of memory release.On the other hand, due to straight It connected and reclaimer operation is carried out to the memory pages of target process, and continued to carry out memory to default process according to reclaimer operation Distribution, can accurately determine the process to be cleared up during carrying out Memory Allocation, improve the accuracy of internal memory optimization. In another aspect, since target process can be cleared up in time and to preset process storage allocation space, it being capable of rapid recovery The situation of memory anxiety improves system stability.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not The disclosure can be limited.
Detailed description of the invention
The drawings herein are incorporated into the specification and forms part of this specification, and shows the implementation for meeting the disclosure Example, and together with specification for explaining the principles of this disclosure.It should be evident that the accompanying drawings in the following description is only the disclosure Some embodiments for those of ordinary skill in the art without creative efforts, can also basis These attached drawings obtain other attached drawings.
Fig. 1 schematically shows a kind of schematic diagram of method for recovering internal storage in the embodiment of the present disclosure.
Fig. 2 schematically shows in the embodiment of the present disclosure and carries out showing for the process of reclaimer operation to the memory pages of target process It is intended to.
Fig. 3 schematically shows in the embodiment of the present disclosure and carries out the process of reclaimer operation according to association process and candidate process Schematic diagram.
Fig. 4 schematically shows the block diagram of Memory recycle device in the embodiment of the present disclosure.
Fig. 5 schematically shows the block diagram of a kind of electronic equipment in the embodiment of the present disclosure.
Specific embodiment
Example embodiment is described more fully with reference to the drawings.However, example embodiment can be with a variety of shapes Formula is implemented, and is not understood as limited to example set forth herein;On the contrary, thesing embodiments are provided so that the disclosure will more Fully and completely, and by the design of example embodiment comprehensively it is communicated to those skilled in the art.Described feature, knot Structure or characteristic can be incorporated in any suitable manner in one or more embodiments.In the following description, it provides perhaps More details fully understand embodiment of the present disclosure to provide.It will be appreciated, however, by one skilled in the art that can It is omitted with technical solution of the disclosure one or more in the specific detail, or others side can be used Method, constituent element, device, step etc..In other cases, be not shown in detail or describe known solution to avoid a presumptuous guest usurps the role of the host and So that all aspects of this disclosure thicken.
In addition, attached drawing is only the schematic illustrations of the disclosure, it is not necessarily drawn to scale.Identical attached drawing mark in figure Note indicates same or similar part, thus will omit repetition thereof.Some block diagrams shown in the drawings are function Energy entity, not necessarily must be corresponding with physically or logically independent entity.These function can be realized using software form Energy entity, or these functional entitys are realized in one or more hardware modules or integrated circuit, or at heterogeneous networks and/or place These functional entitys are realized in reason device device and/or microcontroller device.
The inventors discovered that process exits before destruction due to having resource waiting, process under some scenes The process exited may even result in process more slowly and can not exit.For example, process 1 executes the certain operations of file system and needs Some memories are distributed, Memory Allocation unsuccessfully enters Memory recycle and finally starts low memory management service clean up process 2, process 2 The operation of some file system is had to carry out when thoroughly exiting, these operations can be applied locking A.If process 1 holds this just A is locked, is mutually waited here, deadlock is formed, final process 2 cannot exit therefore can not discharge memory, and 1 Memory Allocation of process encounters Memory anxiety cannot also alleviate well.
In order to solve the above-mentioned technical problem, a kind of method for recovering internal storage, Ke Yiying are provided firstly in the embodiment of the present disclosure The application scenarios for being discharged and being optimized for the memory to terminal, terminal herein include any electricity for being equipped with Android system Sub- product, such as mobile phone, tablet computer etc..With reference to shown in Fig. 1, which may include step S110 and step Rapid S120, in which:
In step s 110, if detecting the Memory Allocation operation failure to default process, low memory management clothes are triggered Business carries out cleaning operation to target process;
In the step s 120, if detecting, the cleaning operation terminates, and carries out to the memory pages of the target process Reclaimer operation, and continue to carry out Memory Allocation operation to the default process by the reclaimer operation.
In the method for recovering internal storage provided in the embodiment of the present disclosure, on the one hand, due to withouting waiting in default process Resource information discharges automatically, but is recycled by the memory pages to target process so that target process automatically exits from, into And it is default process storage allocation, it completes and exits target process and to preset the operation of process storage allocation, avoid pre- If the case where process and target process form endless loop caused by mutually waiting and limit, improves Memory recycle and memory point The efficiency matched.On the other hand, it due to directly carrying out reclaimer operation by the memory pages to target process, and is grasped according to recycling Work continues to carry out Memory Allocation to default process, therefore can accurately determine to be cleared up during carrying out Memory Allocation Process improves the accuracy and relevance of internal memory optimization.In another aspect, due to that can clear up in time target process and be Default process storage allocation space, therefore it is capable of the situation of rapid recovery memory anxiety, improve system stability.
Next, the method for recovering internal storage in the embodiment of the present disclosure is specifically described referring to figs. 1 to Fig. 3.
In step s 110, if detecting the Memory Allocation operation failure to default process, low memory management clothes are triggered Business carries out cleaning operation to target process.
In the embodiment of the present disclosure, default process can be any process either launching process, this sentences launching process and is Example is illustrated.Launching process can be process, or file storage etc. needs the operation of storage allocation, this sentences process For be illustrated.In the embodiment of the present disclosure, launching process, which is specifically as follows, to be not yet in operating status but will start to transport Capable process, such as the process newly opened.Launching process can be various types of processes, and can be in response to the operation of user And it opens.For example, launching process can be the biggish games A of a committed memory.Memory Allocation operation refers to open The method of dynamic process distribution memory space.Memory Allocation operation has static memory distribution and two kinds of dynamic memory distribution.Memory point It can once be executed with operation, or it is performed a plurality of times, and the memory of Memory Allocation operation distribution can be identical every time, it can also With difference, herein without limitation.For example, the preset threshold of system setting is 200MB, and the free memory of current system is 210M (does not trigger low memory management service), starts a big game program at this time, saves as the interior of 200MB in distribution It deposits.
If current free memory is greater than the committed memory of default process in system, Memory Allocation operation can be at Function;If current free memory is less than the committed memory of default process in system, the Memory Allocation of default process is operated It may will fail.
In the embodiment of the present disclosure, if the currently available memory of system be less than default process needed for committed memory, can be with Think the Memory Allocation operation failure to default process.In addition to this, due to Memory Allocation failure caused by other reasons Within the protection scope of the embodiment of the present disclosure.In the case where memory batch operation failure, if to be embodied as default process The purpose of storage allocation then can carry out cleaning operation to the process in system.It should be noted that process herein refers to The process being currently running in system.Android system is provided with the process of following classification: foreground process, visible process, secondary clothes Business, background process, content provider and null process.The priority of above-mentioned process of all categories is successively from high to low, and all kinds of The process of type is provided with corresponding memory threshold in advance.Based on this, for that can be for the process of low memory management service cleaning The whole processes run in system either Partial Process.Partial Process can be either different excellent for the process of equal priority The process of first grade, is not construed as limiting herein.
When judging the Memory Allocation operation failure of default process, target process can be cleared up.Target process can With associated with resource information, can not also be associated with.The quantity of target process can be one, or it is multiple, and target The quantity of process can be determined according to the committed memory of default process and the free memory of system.Believe in target process and resource In the associated situation of manner of breathing, target process can be process, that is, association process associated with default process, and target process can be with It is identical as the type of default process, it can also be different, be not construed as limiting herein.Target process may be association process and any The process of type, is not construed as limiting herein.
Wherein, target process is associated to default process refers to that default process is related by resource information to target process Connection.Resource information can be exist only in default process (process of memory to be allocated), and resource information be target process (to Recycle memory process) needed for resource, such as can by be present in default process but target process exit when it is required Resource.Resource information can be for example lock either other kinds of resource, this is illustrated for sentencing lock.Lock is concurrent One of process synchronization mechanism.For lock other than allowing critical zone mutual exclusion to execute, the thread that release can also be allowed to lock is same to obtaining The thread of a lock sends message etc., to avoid conflicting with each other between process, prevents multiple processes from reading while write in a certain piece Deposit region.In the case where target process is not associated with resource information, target process can be any appropriate process.The disclosure In embodiment, the technical issues that need to address an are as follows: process possesses lock but only Memory Allocation success could discharge lock, separately It could be process storage allocation space that one process, which exits needs and locks, thus target process can by resource information with preset into Journey is associated.Based on this, by target process include with default process by the corresponding association process of resource information for carry out Explanation.
In the embodiment of the present disclosure, in the case where memory batch operation failure, then low memory management service can be activated.In After activating low memory management memory, it can be cleared up by the process in low memory management service acquisition system.It is general and Speech, for low memory management service, according to the priority of process and the size of committed memory to determine whether the process of kill. That is, the priority according to each process selects from low to high, in the case where All factors being equal, preference will be give to grade, the maximum process of EMS memory occupation is selected It kills.Method in the embodiment of the present disclosure directly carries out cleaning operation to target process, can reduce the model of the process to be cleared up It encloses, improves the accuracy rate of determining clean up process.
On this basis, in this example embodiment, however, it is determined that gone out target process, then can have been taken by low memory management It is engaged in executing cleaning operation to determining target process.Cleaning operation herein refers to stopping either closing target process, with So that it is no longer on operating status or target process is allowed to be in background operation state.Cleaning operation is being executed to target process Afterwards, the occupied memory headroom of the target process can be discharged, thus the situation of rapid recovery Installed System Memory anxiety, in order to It is default process storage allocation space in the case where cleaning target process.
In the step s 120, if detecting, the cleaning operation terminates, and carries out to the memory pages of the target process Reclaimer operation, and continue to carry out Memory Allocation operation to the default process by the reclaimer operation.
In the embodiment of the present disclosure, if detecting terminates the cleaning operation of target process, in target process and preset Process passes through in the associated situation of resource information, can memory pages directly to target process carry out reclaimer operation.Herein The memory pages of target process refer to the page quickly exited for controlling target process.Pass through the memory to target process The page carries out reclaimer operation, target process can be made quickly to exit, and just moves back after discharging resource information without waiting for default process Out, improve target process exits efficiency, avoids prolonged waiting process between default process and target process, improves The efficiency of Memory Allocation and the efficiency of Memory recycle, and the Memory recycle being completed at the same time between the different processes of mutual restriction And Memory Allocation.
Specifically, memory pages can be anonymous page, or file page, this is illustrated for sentencing anonymous page. Wherein, anonymous page refers to the memory distributed by dynamic memory distribution function, and anonymous page can be with the occupancy of target process Memory is consistent.Anonymous page belongs to the anonymous linear zone of some process, is mainly used for page exchange.For example, the User space heap of process and All pages in storehouse are anonymous page.There is the page of background document to be known as anonymous page, such as heap, stack, data segment be not with file There are pages for form, therefore can not exchange with disk file, but can be by dividing additional exchange partition on hard disk or making It is swapped with swap file.File page refers to the memory distributed when reading and writing of files.
When memory pages are anonymous page, the detailed process for carrying out reclaimer operation to the memory pages of target process includes: Judge whether the memory information of the default process meets preset condition, and according to judging result to described in the target process Anonymous page carries out the reclaimer operation.The stream that the memory pages of target process are carried out with reclaimer operation is diagrammatically illustrated in Fig. 2 Cheng Tu mainly includes step S210 to step S230 with reference to shown in Fig. 2, in which:
In step S210, judge whether the memory information of the default process meets preset condition.If so, going to step Rapid S220;If it is not, then going to step S230.
In this step, preset condition is for indicating whether the size of memory is enough.The memory information of default process can wrap Include the committed memory of default process and the free memory of system.The memory information of default process meets preset condition and is understood that The committed memory of the enough and default process of low free memory for system is little, specifically can with the committed memory of default process with And size between the free memory of system indicates.For example, if the committed memory of default process is greater than the free memory of system, And the part for being greater than the free memory of system is less than threshold value, then it is assumed that meets preset condition.If the committed memory of default process is big In the free memory of system, and it is greater than the partially larger than threshold value of the free memory of system, then it is assumed that be unsatisfactory for preset condition.Its In, threshold value can be lesser a numerical value, such as 20M etc..
In step S220, if the committed memory of the default process and the free memory of system meet the default item The corresponding association process of the default process is then determined as target process, and carried out to the anonymous page of the target process by part The reclaimer operation.
In this step, if the committed memory of default process is greater than the free memory of system, but in the occupancy of default process The part for depositing the free memory greater than system is less than threshold value 20M, then it is assumed that meets preset condition.The quantity of target process can at this time Think one, and the corresponding association process of default process can be determined as target process.For example, the occupancy of process 1 Inside saving as 200M, the free memory of system is 190M, although the free memory of system is less than the committed memory of process 1, two Difference between person is less than 20M.Therefore it can choose corresponding as its by the associated association process of resource information with process 1 Target process.For example, process 2 must use the resource information in process 1 when exiting, thus can by process 2 as target into Journey, and reclaimer operation is carried out to the anonymous page of process 2, so that process 2 exits.
It should be noted that since the free memory of the committed memory and system of presetting process meets the feelings of preset condition Under condition, need completely to exit target process, so that it is no longer on operating status.Therefore it needs the anonymous page of target process All recycling, in order to which target process exits.
In step S230, if the committed memory of the default process and the free memory of system are unsatisfactory for described preset Condition then carries out reclaimer operation to the anonymous page of candidate process and association process.
In this step, if the committed memory of default process is greater than the free memory of system, but in the occupancy of default process That deposits the free memory greater than system is partially larger than 20M, then it is assumed that is unsatisfactory for preset condition.When being unsatisfactory for preset condition, mesh The quantity of mark process can be one or more.Specifically, the quantity of target process can according to the free memory of system with The comparing result of difference and threshold value between the committed memory of default process and determine.The degree that difference is greater than threshold value is higher, mesh The quantity of mark process is more.Such as it is the first estate (20M < A < 50M), the quantity of target process that difference, which is greater than the part A of threshold value, It can be 1;If the part A that difference is greater than threshold value is the second grade (50M < A < 100M), the quantity of target process can be with It is 2;The part A that difference is greater than threshold value is the tertiary gradient (100M < A < 200M), and the quantity of target process can be 3;Difference Part A greater than threshold value is the fourth estate (200M < A), and the quantity of target process can be 5.When the quantity of target process is At one, the corresponding association process of default process can be determined as to target process, in specific implementation and step S220 Step is identical, and details are not described herein again.When the quantity of target process is multiple, target process may include that default process is corresponding Association process can also include candidate process.Candidate process can be default other corresponding association process of process, can also be with For any process, it is not construed as limiting herein.
For example, the committed memory of process 1 is 260M, and the free memory of system is 190M, although system is available interior Deposit the committed memory less than process 1, but difference between the two is greater than 20M and is inferior grade, the quantity of target process can be with It is 2.One of process can be for, by the associated association process of resource information, another process can be with process 1 Candidate process.On this basis, the anonymous page of the association process for including in target process and candidate process can be returned It brings drill to an end work, so that target process exits.
The flow chart that reclaimer operation is carried out according to association process and candidate process is diagrammatically illustrated in Fig. 3, with reference in Fig. 3 It is shown, it mainly include step S310 to step S330, in which:
In step s310, if the committed memory of the default process and the free memory of system are unsatisfactory for described preset Condition then determines candidate's process from multiple processes;
In step s 320, institute is determined according to the default corresponding association process of process and the candidate process jointly State target process;
In step S330, reclaimer operation is carried out to the anonymous page of the target process.
In the embodiment of the present disclosure, candidate process can according to preset rules from except carry out reclaimer operation association process it The process chosen in outer multiple processes.Preset rules include the priority of process is minimum, committed memory of process is maximum, Process includes that resource information and process are at least one of queue for clearance.Wherein, process includes what resource information referred to It is that process exits and needs resource information.Process is in queue for clearance and refers to that process is in list for clearance, and successively Process in the list is cleared up.For example, committed memory can be selected maximum from the minimum process of priority Process is as candidate process.After determining candidate process, association process and candidate process can be determined as target process jointly.
The process that candidate process can either exit completely for the process of running background.When candidate process is running background Process when, the process for carrying out reclaimer operation to the anonymous page of the candidate process in target process can be with are as follows: to it is described it is candidate into Part anonymity page in journey carries out reclaimer operation by compress mode.It specifically, can be by recent (for example, one day, one week etc.) Using being stored after less anonymous page compression, for example, becoming 50M after the anonymous page compression of 150M, when having use demand a next time into Row decompression.When candidate process is the process to be cleared up (process to be killed either the process to be terminated), to target into The process that the anonymous page of candidate process in journey carries out reclaimer operation can be with are as follows: recycles to all anonymous pages of candidate process Operation.
After step s 130, the method for recovering internal storage further include: according to the reclaimer operation effect the target into The anonymous page of journey determines target memory, and the target memory is distributed to the default process.For example, if recycling The all anonymous page 100M of process 2, has in addition to this also recycled the part anonymity page of process 3, such as 20M, then target memory is The sum of anonymous page and the anonymous page of process 3 of recycling of the process 2 of recycling, i.e. 120M may further be by target memory 120M Distribute to default process.
Technical solution in Fig. 3 carries out reclaimer operation by anonymous page to target process, enable to target process and When exit and releasing memory, in order to be default process storage allocation space, improve the efficiency of Memory recycle and Memory Allocation.
By the technical solution in the embodiment of the present disclosure, for preset the failure of process storage allocation (i.e. system it is available in When depositing the committed memory for being less than default process), low memory management service can be activated to carry out cleaning operation to target process in time, And reclaimer operation is carried out to the memory pages of target process at the end of cleaning operation, since target process can not continue to execute page Exchange, so that target process be made to automatically exit from, avoiding target process must can just move back by the resource information in default process Out the problem of, caused by also avoiding default process and can not being exited due to target process can not storage allocation space the problem of, Avoid mutual restriction and the mutual restriction relation between default process and target process so that default process and target process it Between no longer interdepend, improve independence.In addition, target process can be made quick by the memory pages of recycling target process It exits, and then can be quickly default process storage allocation space, improve the efficiency of Memory Allocation and Memory recycle.Again, Since the memory pages by recycling target process can realize the function of Memory recycle by timely clean up process, improves and be The stability of system.
The Memory recycle device in the embodiment of the present disclosure is shown in Fig. 4, refering to what is shown in Fig. 4, the Memory recycle device 400 It mainly include process cleaning modul 401 and page recycling module 402, in which:
Process cleaning modul 401, if triggering low memory for detecting to the Memory Allocation operation failure of default process Management service carries out cleaning operation to target process;
Page recycling module 402, if for detecting that the cleaning operation terminates, to the page of the target process Face carries out reclaimer operation, and continues to carry out Memory Allocation operation to the default process by the reclaimer operation.
In a kind of exemplary embodiment of the disclosure, page recycling module includes: anonymous page recycling module, for institute The anonymous page for stating target process carries out the reclaimer operation, in order to carry out Memory recycle to the target process.
In a kind of exemplary embodiment of the disclosure, anonymous page recycling module includes: recycling control module, for judging Whether the memory information of the default process meets preset condition, and the anonymity according to judging result to the target process Page carries out the reclaimer operation.
In a kind of exemplary embodiment of the disclosure, recycling control module includes: the first recycling module, if for described The committed memory of default process and the free memory of system meet the preset condition, then by the corresponding pass of the default process Connection process is determined as target process, and carries out the reclaimer operation to the anonymous page of the target process.
In a kind of exemplary embodiment of the disclosure, described device further include: candidate process determining module, if being used for institute The free memory of the committed memory and system of stating default process is unsatisfactory for the preset condition, then determines and wait from multiple processes Select process;Target process determining module, for total according to the default corresponding association process of process and the candidate process With the determining target process;Second recycling module carries out reclaimer operation for the anonymous page to the target process.
In a kind of exemplary embodiment of the disclosure, candidate process determining module is configured as: true according to preset rules The fixed candidate process;Wherein, the preset rules include process priority it is minimum, committed memory of process is maximum, process At least one of queue for clearance is in comprising resource information and process.
In a kind of exemplary embodiment of the disclosure, page recycling module includes: memory allocating module, for according to institute The anonymous page for stating the target process of reclaimer operation effect determines target memory, and by the target memory distribute to it is described preset into Journey.
It should be noted that the detail of each module is in corresponding Memory recycle side in above-mentioned Memory recycle device It is described in detail in method, therefore details are not described herein again.
It should be noted that although being referred to several modules or list for acting the equipment executed in the above detailed description Member, but this division is not enforceable.In fact, according to embodiment of the present disclosure, it is above-described two or more Module or the feature and function of unit can embody in a module or unit.Conversely, an above-described mould The feature and function of block or unit can be to be embodied by multiple modules or unit with further division.
In addition, although describing each step of method in the disclosure in the accompanying drawings with particular order, this does not really want These steps must be executed in this particular order by asking or implying, or having to carry out step shown in whole could realize Desired result.Additional or alternative, it is convenient to omit multiple steps are merged into a step and executed by certain steps, and/ Or a step is decomposed into execution of multiple steps etc..
In embodiment of the disclosure, a kind of electronic equipment that can be realized the above method is additionally provided.
Person of ordinary skill in the field it is understood that various aspects of the disclosure can be implemented as system, method or Program product.Therefore, various aspects of the disclosure can be with specific implementation is as follows, it may be assumed that complete hardware embodiment, complete The embodiment combined in terms of full Software Implementation (including firmware, microcode etc.) or hardware and software, can unite here Referred to as circuit, " module " or " system ".
The electronic equipment 500 of this embodiment according to the disclosure is described referring to Fig. 5.The electronics that Fig. 5 is shown Equipment 500 is only an example, should not function to the embodiment of the present disclosure and use scope bring any restrictions.
As shown in figure 5, electronic equipment 500 is showed in the form of universal computing device.The component of electronic equipment 500 can wrap It includes but is not limited to: at least one above-mentioned processing unit 510, at least one above-mentioned storage unit 520, the different system components of connection The bus 550 of (including storage unit 520 and processing unit 510).
Wherein, the storage unit is stored with program code, and said program code can be held by the processing unit 510 Row, so that various according to the disclosure described in the execution of the processing unit 510 above-mentioned " illustrative methods " part of this specification The step of illustrative embodiments.For example, the processing unit 510 can execute step as shown in fig. 1: in step S110 In, if detecting the Memory Allocation operation failure to default process, triggers low memory management service and target process is carried out clearly Reason operation;In the step s 120, if detecting, the cleaning operation terminates, and returns to the memory pages of the target process It brings drill to an end work, and continues to carry out Memory Allocation operation to the default process by the reclaimer operation.
Storage unit 520 may include the readable medium of volatile memory cell form, such as Random Access Storage Unit (RAM) 5201 and/or cache memory unit 5202, it can further include read-only memory unit (ROM) 5203.
Storage unit 520 can also include program/utility with one group of (at least one) program module 5205 5204, such program module 5205 includes but is not limited to: operating system, one or more application program, other program moulds It may include the realization of network environment in block and program data, each of these examples or certain combination.
Bus 530 can be to indicate one of a few class bus structures or a variety of, including storage unit bus or storage Cell controller, peripheral bus, graphic accelerating interface, processing unit use any bus structures in a variety of bus structures Local bus.
Electronic equipment 500 can also be with one or more external equipments 600 (such as keyboard, sensing equipment, bluetooth equipment Deng) communication, can also be enabled a user to one or more equipment interact with the electronic equipment 500 communicate, and/or with make Any equipment (such as the router, modulation /demodulation that the electronic equipment 500 can be communicated with one or more of the other calculating equipment Device etc.) communication.This communication can be carried out by input/output (I/O) interface 550.Also, electronic equipment 500 can be with By network adapter 560 and one or more network (such as local area network (LAN), wide area network (WAN) and/or public network, Such as internet) communication.As shown, network adapter 560 is communicated by bus 530 with other modules of electronic equipment 500. It should be understood that although not shown in the drawings, other hardware and/or software module can not used in conjunction with electronic equipment 500, including but not Be limited to: microcode, device driver, redundant processing unit, external disk drive array, RAID system, tape drive and Data backup storage system etc..
In embodiment of the disclosure, a kind of computer readable storage medium is additionally provided, being stored thereon with can be realized The program product of this specification above method.In some possible embodiments, various aspects of the disclosure can also be realized For a kind of form of program product comprising program code, when described program product is run on the terminal device, described program Code is various according to the disclosure described in above-mentioned " illustrative methods " part of this specification for executing the terminal device The step of illustrative embodiments.
According to the program product for realizing the above method of embodiment of the present disclosure, Portable, compact can be used Disk read-only memory (CD-ROM) and including program code, and can be run on terminal device, such as PC.However, The program product of the disclosure is without being limited thereto, and in this document, readable storage medium storing program for executing, which can be, any includes or storage program has Shape medium, the program can be commanded execution system, device or device use or in connection.
Described program product can be using any combination of one or more readable mediums.Readable medium can be readable letter Number medium or readable storage medium storing program for executing.Readable storage medium storing program for executing for example can be but be not limited to electricity, magnetic, optical, electromagnetic, infrared ray or System, device or the device of semiconductor, or any above combination.The more specific example of readable storage medium storing program for executing is (non exhaustive List) include: electrical connection with one or more conducting wires, portable disc, hard disk, random access memory (RAM), read-only Memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read only memory (CD-ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, In carry readable program code.The data-signal of this propagation can take various forms, including but not limited to electromagnetic signal, Optical signal or above-mentioned any appropriate combination.Readable signal medium can also be any readable Jie other than readable storage medium storing program for executing Matter, the readable medium can send, propagate or transmit for by instruction execution system, device or device use or and its The program of combined use.
The program code for including on readable medium can transmit with any suitable medium, including but not limited to wirelessly, have Line, optical cable, RF etc. or above-mentioned any appropriate combination.
Can with any combination of one or more programming languages come write for execute the disclosure operation program Code, described program design language include object oriented program language-Java, C++ etc., further include conventional Procedural programming language-such as " C " language or similar programming language.Program code can be fully in user It calculates and executes in equipment, partly executes on a user device, being executed as an independent software package, partially in user's calculating Upper side point is executed on a remote computing or is executed in remote computing device or server completely.It is being related to far Journey calculates in the situation of equipment, and remote computing device can pass through the network of any kind, including local area network (LAN) or wide area network (WAN), it is connected to user calculating equipment, or, it may be connected to external computing device (such as utilize ISP To be connected by internet).
In addition, above-mentioned attached drawing is only schematically illustrating for the processing according to included by the method for the embodiment of the present disclosure, without It is limitation purpose.It can be readily appreciated that above-mentioned processing shown in the drawings does not indicate or limits the time sequencing of these processing.In addition, It is also easy to understand, these processing, which can be, for example either synchronously or asynchronously to be executed in multiple modules.
Those skilled in the art after considering the specification and implementing the invention disclosed here, will readily occur to its of the disclosure His embodiment.This application is intended to cover any variations, uses, or adaptations of the disclosure, these modifications, purposes or Adaptive change follow the general principles of this disclosure and including the undocumented common knowledge in the art of the disclosure or Conventional techniques.The description and examples are only to be considered as illustrative, and the true scope and spirit of the disclosure are by claim It points out.

Claims (10)

1. a kind of method for recovering internal storage characterized by comprising
If detecting the Memory Allocation operation failure to default process, triggers low memory management service and target process is carried out clearly Reason operation;
If detecting, the cleaning operation terminates, and carries out reclaimer operation to the memory pages of the target process, and pass through institute Reclaimer operation is stated to continue to carry out Memory Allocation operation to the default process.
2. method for recovering internal storage according to claim 1, which is characterized in that carried out to the memory pages of the target process Reclaimer operation includes:
The reclaimer operation is carried out to the anonymous page of the target process, in order to carry out Memory recycle to the target process.
3. method for recovering internal storage according to claim 2, which is characterized in that carry out institute to the anonymous page of the target process Stating reclaimer operation includes:
Judge whether the memory information of the default process meets preset condition, and according to judging result to the target process The anonymity page carries out the reclaimer operation.
4. method for recovering internal storage according to claim 3, which is characterized in that according to judging result to the target process The anonymity page carries out the reclaimer operation and includes:
If the committed memory of the default process and the free memory of system meet the preset condition, by it is described preset into The corresponding association process of journey is determined as target process, and carries out the reclaimer operation to the anonymous page of the target process.
5. method for recovering internal storage according to claim 4, which is characterized in that the method also includes:
If the committed memory of the default process and the free memory of system are unsatisfactory for the preset condition, from multiple processes Middle determining candidate process;
The target process is determined jointly according to the default corresponding association process of process and the candidate process;
Reclaimer operation is carried out to the anonymous page of the target process.
6. method for recovering internal storage according to claim 5, which is characterized in that determine candidate's process packet from multiple processes It includes:
The candidate process is determined according to preset rules;
Wherein, the preset rules include process priority it is minimum, committed memory of process is maximum, process includes resource information And process is at least one of queue for clearance.
7. method for recovering internal storage according to claim 2, which is characterized in that continued by the reclaimer operation to described pre- If process carries out Memory Allocation, operation includes:
Target memory is determined according to the anonymous page of the target process of reclaimer operation effect, and the target memory is distributed to The default process.
8. a kind of Memory recycle device characterized by comprising
Process cleaning modul, if triggering low memory management clothes for detecting the Memory Allocation operation failure to default process Business carries out cleaning operation to target process;
Page recycling module, if being carried out for detecting that the cleaning operation terminates to the memory pages of the target process Reclaimer operation, and continue to carry out Memory Allocation operation to the default process by the reclaimer operation.
9. a kind of electronic equipment characterized by comprising
Processor;And
Memory, for storing the executable instruction of the processor;
Wherein, the processor is configured to come described in perform claim requirement 1-7 any one via the execution executable instruction Method for recovering internal storage.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program Method for recovering internal storage described in claim 1-7 any one is realized when being executed by processor.
CN201910815705.1A 2019-08-30 2019-08-30 Memory recovery method and device, electronic equipment and storage medium Active CN110532197B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910815705.1A CN110532197B (en) 2019-08-30 2019-08-30 Memory recovery method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910815705.1A CN110532197B (en) 2019-08-30 2019-08-30 Memory recovery method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110532197A true CN110532197A (en) 2019-12-03
CN110532197B CN110532197B (en) 2022-03-01

Family

ID=68665593

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910815705.1A Active CN110532197B (en) 2019-08-30 2019-08-30 Memory recovery method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110532197B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111580980A (en) * 2020-05-15 2020-08-25 北京小米松果电子有限公司 Memory management method and device
CN111679914A (en) * 2020-06-12 2020-09-18 北京字节跳动网络技术有限公司 Memory management method, system, computer equipment and storage medium
CN111722903A (en) * 2020-06-16 2020-09-29 北京达佳互联信息技术有限公司 A data processing method, device, electronic device and storage medium
CN111831444A (en) * 2020-07-01 2020-10-27 Oppo广东移动通信有限公司 Memory recovery method, device, storage medium and electronic device
CN111831441A (en) * 2020-07-01 2020-10-27 Oppo广东移动通信有限公司 Memory recovery method, device, storage medium and electronic device
CN112363841A (en) * 2020-11-27 2021-02-12 Oppo(重庆)智能科技有限公司 Application process searching and killing method and device, electronic equipment and storage medium
CN113391926A (en) * 2021-06-28 2021-09-14 京东方科技集团股份有限公司 Data playing method and device and electronic equipment
WO2022089452A1 (en) * 2020-10-31 2022-05-05 华为终端有限公司 Memory management method and apparatus, and electronic device and computer-readable storage medium
CN115617529A (en) * 2022-11-17 2023-01-17 中国人民解放军国防科技大学 Method and device for process management in mobile application compatible operating environment
CN116244067A (en) * 2021-06-10 2023-06-09 荣耀终端有限公司 Virtual memory management method and electronic device
WO2024109076A1 (en) * 2022-11-22 2024-05-30 中兴通讯股份有限公司 Memory management method, computer device and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080162612A1 (en) * 2006-12-28 2008-07-03 Andrew Tomlin Method for block relinking
CN104239147A (en) * 2014-10-20 2014-12-24 浪潮(北京)电子信息产业有限公司 Method and system for processing deadlock cycle
CN106354562A (en) * 2016-08-25 2017-01-25 上海传英信息技术有限公司 Memory cleaning system and memory cleaning method
CN107704321A (en) * 2017-09-30 2018-02-16 北京元心科技有限公司 Memory allocation method and device and terminal equipment
CN108958911A (en) * 2018-05-30 2018-12-07 北京小米移动软件有限公司 The control method and device of process
CN109213539A (en) * 2016-09-27 2019-01-15 华为技术有限公司 A kind of method for recovering internal storage and device
CN109376002A (en) * 2018-08-14 2019-02-22 广东格兰仕集团有限公司 A kind of internal memory optimization control method based on oven control system
CN109857556A (en) * 2019-01-15 2019-06-07 Oppo广东移动通信有限公司 Method for recovering internal storage and device, storage medium and electronic equipment
CN110008016A (en) * 2019-04-15 2019-07-12 深圳市万普拉斯科技有限公司 Anonymous page management method, device, terminal device and readable storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080162612A1 (en) * 2006-12-28 2008-07-03 Andrew Tomlin Method for block relinking
CN104239147A (en) * 2014-10-20 2014-12-24 浪潮(北京)电子信息产业有限公司 Method and system for processing deadlock cycle
CN106354562A (en) * 2016-08-25 2017-01-25 上海传英信息技术有限公司 Memory cleaning system and memory cleaning method
CN109213539A (en) * 2016-09-27 2019-01-15 华为技术有限公司 A kind of method for recovering internal storage and device
CN107704321A (en) * 2017-09-30 2018-02-16 北京元心科技有限公司 Memory allocation method and device and terminal equipment
CN108958911A (en) * 2018-05-30 2018-12-07 北京小米移动软件有限公司 The control method and device of process
CN109376002A (en) * 2018-08-14 2019-02-22 广东格兰仕集团有限公司 A kind of internal memory optimization control method based on oven control system
CN109857556A (en) * 2019-01-15 2019-06-07 Oppo广东移动通信有限公司 Method for recovering internal storage and device, storage medium and electronic equipment
CN110008016A (en) * 2019-04-15 2019-07-12 深圳市万普拉斯科技有限公司 Anonymous page management method, device, terminal device and readable storage medium

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111580980A (en) * 2020-05-15 2020-08-25 北京小米松果电子有限公司 Memory management method and device
CN111580980B (en) * 2020-05-15 2024-01-30 北京小米松果电子有限公司 Memory management method and device
CN111679914A (en) * 2020-06-12 2020-09-18 北京字节跳动网络技术有限公司 Memory management method, system, computer equipment and storage medium
CN111722903A (en) * 2020-06-16 2020-09-29 北京达佳互联信息技术有限公司 A data processing method, device, electronic device and storage medium
CN111831444A (en) * 2020-07-01 2020-10-27 Oppo广东移动通信有限公司 Memory recovery method, device, storage medium and electronic device
CN111831441A (en) * 2020-07-01 2020-10-27 Oppo广东移动通信有限公司 Memory recovery method, device, storage medium and electronic device
US12242389B2 (en) 2020-10-31 2025-03-04 Huawei Device Co., Ltd. Application-level memory control group memory reclamation
WO2022089452A1 (en) * 2020-10-31 2022-05-05 华为终端有限公司 Memory management method and apparatus, and electronic device and computer-readable storage medium
CN112363841A (en) * 2020-11-27 2021-02-12 Oppo(重庆)智能科技有限公司 Application process searching and killing method and device, electronic equipment and storage medium
CN116244067A (en) * 2021-06-10 2023-06-09 荣耀终端有限公司 Virtual memory management method and electronic device
CN116244067B (en) * 2021-06-10 2024-05-03 荣耀终端有限公司 Virtual memory management method and electronic equipment
CN113391926A (en) * 2021-06-28 2021-09-14 京东方科技集团股份有限公司 Data playing method and device and electronic equipment
CN115617529A (en) * 2022-11-17 2023-01-17 中国人民解放军国防科技大学 Method and device for process management in mobile application compatible operating environment
WO2024109076A1 (en) * 2022-11-22 2024-05-30 中兴通讯股份有限公司 Memory management method, computer device and storage medium

Also Published As

Publication number Publication date
CN110532197B (en) 2022-03-01

Similar Documents

Publication Publication Date Title
CN110532197A (en) Method for recovering internal storage and device, electronic equipment, storage medium
US10574545B2 (en) Techniques for analytics-driven hybrid concurrency control in clouds
CN111052149B (en) Method and apparatus for determining memory requirements in a network
CN109710405B (en) Block chain intelligent contract management method and device, electronic equipment and storage medium
US7747750B1 (en) Method for reserving resources in a storage area network with selective capabilities
CN103080903A (en) Scheduler, multi-core processor system, and scheduling method
WO2016039963A2 (en) Resource sharing between two resource allocation systems
CN109857556A (en) Method for recovering internal storage and device, storage medium and electronic equipment
CN104216767A (en) Method and device for accessing shared data among multiple threads
US11842218B2 (en) Computing resource allocation for virtual network functions
US9882973B2 (en) Breadth-first resource allocation system and methods
CN114168271A (en) Task scheduling method, electronic device and storage medium
CN116450328A (en) Memory allocation method, memory allocation device, computer equipment and storage medium
US20140143788A1 (en) Assignment method and multi-core processor system
CN112214321B (en) A new micro-service node selection method, device and micro-service management platform
US20170024245A1 (en) Workload-aware shared processing of map-reduce jobs
CN107291371B (en) Method and device for implementing a read-write lock
CN113254223B (en) Resource allocation method, system and related components after system restart
CN103778003A (en) Tiered locking of resources
CN101135995A (en) Method and equipment for removing alias addresses from an alias address pool
CN103703449A (en) Memory coalescing computer-implemented method, system and apparatus
CN110874189B (en) Storage system and storage control method
CN112363828A (en) Memory fragment management method and device, vehicle-mounted system and vehicle
CN115658295A (en) Resource scheduling method and device, electronic equipment and storage medium
CN115934354A (en) Online storage method and device

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