CN108984295A - Method for recovering internal storage, computer installation and computer readable storage medium - Google Patents
Method for recovering internal storage, computer installation and computer readable storage medium Download PDFInfo
- Publication number
- CN108984295A CN108984295A CN201810631223.6A CN201810631223A CN108984295A CN 108984295 A CN108984295 A CN 108984295A CN 201810631223 A CN201810631223 A CN 201810631223A CN 108984295 A CN108984295 A CN 108984295A
- Authority
- CN
- China
- Prior art keywords
- memory
- target buffer
- structured data
- buffer
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation 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/5016—Allocation 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation 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/5022—Mechanisms to release resources
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
- Storage Device Security (AREA)
Abstract
The present invention discloses a kind of method for recovering internal storage, computer installation and computer readable storage medium and obtains the information of the corresponding target buffer of abnormal application heap when this method includes that confirmation RAM leakage occurs;Structured data corresponding with target buffer is searched in isolated memory chained list, and judges whether the leakage number in the corresponding structured data of target buffer reaches preset number, if so, memory corresponding to release target buffer.The present invention also provides the computer installations and computer readable storage medium of realizing the above method.The present invention can effectively determine the case where RAM leakage occur, and when there is RAM leakage, the recycling of memory can be realized by effective method, and can effectively avoid the problem that wrong releasing memory.
Description
Technical field
The present invention relates to the memory process field of computer more particularly to a kind of method for recovering internal storage, realize this method
Computer installation and computer readable storage medium.
Background technique
The terminal devices such as smart phone, tablet computer become the most frequently used electronic equipment in people's daily life, people
Like that various application programs are installed on intelligent electronic device, and on the terminal device simultaneously run largely apply journey
Sequence.In addition, the various intelligent box products based on Android operation system are generally also configured with such as HD video playout software, by
Certain memory source is all occupied in each application program, after terminal device runs a large amount of application program, will be used a large amount of
Memory source, especially application programs such as high definition playout software generally require continuous by memory management mechanism application
The physical memory of bulk.
Process using before memory needs that committed memory is filed an application and started to system, after having used memory again and
Shi Huishou memory.Since the memory of terminal device is limited, in order to avoid because system caused by Memory Allocation is insufficient it is different
Often, operating system introduces the reclaim mechanism to memory.For example, system can close some background process when low memory
Recycle the memory of its occupancy.
However, as the design and development of the application program of terminal device is increasingly complicated, when application programming, occurs wrong
It is accidentally unavoidable, if there is mistake in the programming of application program, it is possible to cause application program to dynamically distribute interior in the presence of use
After fail timely to discharge, as a result cause application program to occupy the memory headroom always, until EP (end of program), such case
Referred to as memory overflow.
Once being easy because application program, which is abnormal, occurs the leakage of bulk contiguous memory for the terminal device of low memory
It, what is more can be because of the feelings for applying causing video that can not play less than bulk memory because memory Caton phenomenon occurs using anxiety
Condition.Therefore, it is necessary to distinguish whether application program the case where memory overflow occurs by effective method, and once discovery application
When memory overflow occurs in program, need that closing application program is persistently timely occupied a large amount of memory to avoid application program
Resource and cause operating system to be collapsed.
For example, application No. is the Chinese invention patent applications of CN201410857700.2 to disclose a kind of Memory recycle side
Method, this method be by memory peak value used in currently running application program as judging benchmark, by currently making
Memory is compared with memory peak value used in application program the past period, judges whether RAM leakage occur
Situation, and recycle the memory of the application program when there is the case where RAM leakage determining.
However, this method is by the foundation to memory peak value used in application program as judgement, due to applying journey
When sequence operates normally, it is also possible to occupy biggish memory because operational data amount is big, it is easy to appear memories to let out for existing method
The case where dew judges incorrectly, once misjudgment, will lead to the occupied memory of application program and is discharged by mistake, will lead to
Application program moment exits, that is, the case where " sudden strain of a muscle is moved back " occurs, is unfavorable for the work of terminal device.
Summary of the invention
The main object of the present invention, which is to provide one kind, can effectively judge whether RAM leakage occur and internally deposit into row
The method for recovering internal storage of recycling.
It is a further object of the present invention to provide a kind of computer installations that can be realized above-mentioned method for recovering internal storage.
Another object of the present invention is to provide a kind of computer-readable storage medium that can be realized above-mentioned method for recovering internal storage
Matter.
In order to realize above-mentioned main purpose, method for recovering internal storage provided by the invention includes that confirmation RAM leakage occurs
When, obtain the information of the corresponding target buffer of abnormal application heap;It is searched in isolated memory chained list corresponding with target buffer
Structured data, and it is preset time to judge whether the leakage number in the corresponding structured data of target buffer reaches
Number, if so, memory corresponding to release target buffer.
By above scheme as it can be seen that method of the invention is by one isolated memory chained list of creation and in isolated memory chain
The corresponding structured data of the corresponding target buffer of recording exceptional application heap in table, by the leakage time in structured data
Number is to judge whether the application heap meets the requirement of Memory recycle, if meeting the requirement of Memory recycle, such as reveals number and reaches
Preset number then discharges the corresponding memory of target buffer.In this way, due to by repeatedly sentencing to same target buffer
It is disconnected, it can greatly reduce and the generation of the case where RAM leakage misjudgment occur, effectively avoid making the application program of normal operation
At influence.
Also, judged by the structured data repeatedly to same target buffer, it can be to meeting Memory recycle
The application heap of condition is recycled, that is, the corresponding memory of release target buffer, and application program is effectively avoided to account for for a long time
It with memory but does not use, so that it is guaranteed that the memory of terminal device is effectively recycled, it is ensured that the normal fortune of terminal device
Row.
One Preferable scheme is that, as determined, the leakage number in the corresponding structured data of target buffer is not up to pre-
If number, then leakage number in the corresponding structured data of target buffer increases primary, and does not discharge target buffer
Corresponding memory.
It can be seen that for the application heap for not meeting Memory recycle requirement, the scheme of the invention is not discharging phase temporarily
The application heap answered guarantees the application program operated normally so that the memory to application program normal use of mistake be avoided to discharge
Operation.
Further embodiment is, confirmation occur RAM leakage include: when system free memory is lower than default memory threshold,
The corresponding buffer of used application heap is scanned, and the buffer that the process usage quantity of judging whether there is is zero,
If so, there is RAM leakage in confirmation.
As it can be seen that by being scanned to the corresponding buffer of application heap, and the process usage quantity of finding out be zero it is slow
Device is rushed, these buffers are exactly the corresponding target buffer of abnormal application heap.The number of processes as used in these application heaps
It is zero, that is, uses these memories without process, thus may determine that these application heaps are abnormal application heap, and determines hair
The case where raw RAM leakage.
Further scheme is, before searching structured data corresponding with target buffer in isolated memory chained list,
It also executes: obtaining a structured data in isolated memory chained list, and confirm corresponding to the structured data currently obtained
The process usage quantity of target buffer whether be zero, be such as not zero, then by the structured data currently obtained out of isolated
It deposits in chained list and deletes, and do not discharge memory corresponding to the target buffer.
It can be seen that for the buffer that process usage quantity is not zero, indicate these buffers it is corresponding in have into
Journey is used, then it represents that these memories are not abnormal memories, it is therefore desirable to delete, but will not release from isolated memory chained list
Corresponding memory is put, the normal operation for influencing application program is avoided.
Further scheme is, after discharging memory corresponding to target buffer, also executes: target buffer is corresponding
Structured data deleted from chained list.
It can be seen that after the corresponding memory of release target buffer, it is also necessary to by corresponding structured data from chain
It is deleted in table, avoids the releasing memory for causing mistake because continuing to use the structured data.
Further scheme is, after searching structured data corresponding with target buffer in isolated memory chained list,
It also executes: judging that the corresponding structured data of target buffer whether there is in isolated memory chained list, be such as not present, create mesh
After the corresponding structured data of mark buffer and it is added in isolated memory chained list.
It can be seen that the structured data in the corresponding target buffer of abnormal application heap is not present in isolated memory chained list
When, by creating the structured data of addition target buffer in chained list, it may insure that each abnormal application heap is corresponding in this way
The structured data of buffer be present in isolated memory chained list.
Further scheme is, after discharging memory corresponding to target buffer, also executes: judging whether to receive and ask
The solicited message using the corresponding memory of target buffer is sought, is asked if so, obtaining the identical one section of memory of amount of capacity and providing
Ask the sender of information.
Further scheme is to obtain the identical one section of memory of amount of capacity and provide sender's packet of solicited message
It includes: after obtaining the identical one section of memory of amount of capacity, memory address being converted into virtual address, and the transmission to solicited message
Side provides the information of virtual address.
It can be seen that when application program uses this section of memory, then passing through recovery after a certain application heap is released
The operation of memory provides memory to application program, such as by obtaining the equal new application heap of one section of amount of capacity, and will
The virtual address of new application heap is supplied to application program, so that it is guaranteed that the normal operation of application program.
In order to realize above-mentioned another object, the present invention also provides computer installation include processor and memory,
Memory is stored with computer program, and each step of above-mentioned method for recovering internal storage is realized when computer program is executed by processor
Suddenly.
In order to realize above-mentioned a further object, the present invention also provides computer readable storage medium on be stored with computer
Program, the computer program realize each step of above-mentioned method for recovering internal storage when being executed by processor.
Detailed description of the invention
Fig. 1 is the flow chart that RAM leakage is judged in method for recovering internal storage embodiment of the present invention.
Fig. 2 is the flow chart of method for recovering internal storage embodiment of the present invention.
Fig. 3 is the flow chart for restoring releasing memory in method for recovering internal storage embodiment of the present invention.
The invention will be further described with reference to the accompanying drawings and embodiments.
Specific embodiment
Method for recovering internal storage of the invention is applied on various electronic equipments, such as is applied in videos such as intelligent boxes
Playing terminal equipment, or apply on the portable electronic devices such as smart phone, tablet computer.Computer of the invention
Device can be above-mentioned electronic equipment, and computer readable storage medium can be Jie of the various storages with data storage function
The nonvolatile memories such as matter, including but not limited to FLASH, EEPROM.
Method for recovering internal storage embodiment:
There are operating system, such as Android operation system using operation on the terminal device of the method for recovering internal storage of the present embodiment.By
Be both provided with the memory management mechanism of itself in the operating system of existing terminal device, for manage each application program or
Memory used in process, therefore, the present embodiment are the memory management mechanism based on existing operating system, judge terminal device
Whether there is the case where RAM leakage, and timely recycle memory when there is RAM leakage, avoids terminal device operation different
Often.
Therefore, the method for the present embodiment is joined firstly the need of judging whether terminal device the case where RAM leakage currently occurs
See Fig. 1, step S1 is first carried out, determines the thread of system trigger low memory, such as the kswap thread of triggering system.Due to
When linux system is run, once there is the lower situation of free memory, linux system is by automatic starting kswap thread and passes through
Kswap thread, which is internally deposited, to be adjusted, such as forcibly closes certain processes with releasing memory.Therefore, the scheme of the application can be with
It is to trigger the recycling to memory after os starting kswap thread.
After determining system trigger kswap thread, step S2 is executed, the continuously available memory of terminal device is swept
It retouches, for example, calling memory scan procedure by operating system, the surplus of the available contiguous memory of current system is scanned by the process
Then surplus executes step S3, judges whether currently available contiguous memory is lower than preset threshold value.Due to step S2 by pair
The continuously available memory of system is scanned, and can determine that currently also how many continuous memory is not used system, thus
Determine the amount of the currently available remaining contiguous memory of system.
In step S3, the amount of the currently available contiguous memory of system is compared with preset threshold value, judges that system is worked as
Whether the amount of preceding available contiguous memory is lower than the preset threshold value, for example whether it is lower than 100M, if being lower than preset threshold value,
It indicates that currently available amount of ram is insufficient, the operation of Memory recycle is needed to be implemented, if the judging result of step S3 is no, table
Show that the currently available free memory of system is still sufficient, does not need the operation for executing Memory recycle.
If the judging result of step S3 be it is yes, all application heaps of system are scanned, and determine occur it is different
Normal application heap.Under a linux operating system, each section of application heap all has oneself corresponding buffer, the buffer
The information such as start-stop address, memory size for storing this section of application heap, therefore, it is corresponding that step S4 obtains one section of application heap first
Buffer.In the present embodiment, buffer corresponding to each section of application heap is referred to as ion_buffer, also, the buffer
Also record has number of processes used in corresponding application heap, i.e. the application heap is used in how many process.
Then, step S5 is executed, judges whether the process usage quantity of current acquired application heap is zero.For example, obtaining
After taking current buffer ion_buffer, the ION CMA heap service condition of the buffer currently obtained is obtained, is such as obtained
The number of processes of the corresponding application heap of the currently used buffer.If some process application is corresponding interior using the buffer
When depositing section, the corresponding parameter handle_count of the buffer will increase by 1, for example, the corresponding parameter of some buffer
When handle_count is 2, indicate that currently there are two processes to use the corresponding application heap of the buffer.If some buffer
Corresponding handle_count be 0 when, indicate that the case where memory overflow occurs in the corresponding application heap of current buffer, need into
The operation of row Memory recycle.
Therefore, step S5 is exactly whether the current acquired corresponding handle_count of buffer of judgement is zero, if
It is zero, thens follow the steps S6, record the corresponding target buffer ion_buffer of the application heap, and confirms that memory occurred lets out
The phenomenon that dew, also, application heap corresponding to target buffer is abnormal application heap, that is, thinks that this section of application heap is that occur
One section of memory of RAM leakage.
Finally, executing step S7, judge whether current acquired buffer is scanned final stage application heap pair
The buffer answered, if it is not, then the corresponding buffer of next section of application heap is obtained, until last one section of application heap pair is arrived in scanning
Until the buffer answered.In this way, all process usage quantities can be found out by carrying out single pass to all application heaps
The application heap for being zero, so that it is determined that the application heap of RAM leakage may occur.
It is appreciated that the process usage quantity if there is multistage application heap is zero, it is determined that multistage application heap is all abnormal
Therefore application heap will record each section in step S6 and abnormal inner segment, therefore, the number of target buffer ion_buffer occur
Amount may be one, it is also possible to and it is multiple, if there is exception occurs in multistage memory, then record the letter of each target buffer
Breath.
After there is RAM leakage in determination, current embodiment require that the application heap for RAM leakage occur is recycled,
Exactly discharge the application heap that process usage quantity is zero.Referring to fig. 2, step S11 is first carried out, the feelings of RAM leakage occurs in confirmation
Step S6 is performed in condition, that is, Fig. 1, while recording the corresponding Target buffer of application heap that all process usage quantities are zero
Device ion_buffer.
In order to be managed and inquire to target buffer, the present embodiment creates an isolated memory chained list cma_
Shrink_orphaned_list, which records target buffer all after the step S6 of Fig. 1, that is, records
The information of the corresponding target buffer of all exception application heaps.It is thus identified that executing step after there is the case where RAM leakage
S12 judges whether isolated memory chained list cma_shrink_orphaned_list is empty, that is, judges whether do not have in the chained list
There are any data, if so, thening follow the steps S13, create structured data, otherwise, execute step S14, scans isolated memory chain
Table.
If the judging result of step S12 is yes, then it represents that isolated memory chained list does not have any data, then needs step
The corresponding data for the target buffer that S6 is recorded is added in isolated memory chained list.In the present embodiment, it is added to isolated memory
The data of chained list are a kind of structured datas, such as create the structured data of cma_shrinker_t_count a kind of, and
The parameter of definition structure volume data, for example, this structured data includes multiple parameters, such as mark of corresponding target buffer
The address of random, corresponding application heap can also include several variables, such as corresponding application heap size, further include the knot
The corresponding target buffer of structure volume data is found the number try_time for occurring leaking, and in the present embodiment, is found to let out
The number try_time of leakage is a variable, and the initial value being arranged is 0, and can only monotonic increase.
Therefore, step S13 is exactly the structured data for creating a cma_shrinker_t_count, then executes step
The data of the step S6 abnormal application heap recorded are added in structured data by S16, are formed one and are corresponded to Target buffer
The structured data of device.It is appreciated that an abnormal application heap will correspond to a target buffer in the present embodiment, and
It is corresponding with a structured data.After the corresponding structured data of creation target buffer, the structural body number that will be created
According to being added in isolated memory chained list, become a member in isolated memory chained list.
If the judging result of step S12 be it is no, indicate to have had existed structured data in isolated memory chained list, then hold
Row step S14 is scanned isolated memory chained list, that is, traverses each structured data in isolated memory chained list, and
And step S15 is executed, the corresponding target buffer of abnormal application heap that judgment step S6 is recorded whether there is in isolated memory
In chained list, if it does not exist, then executing step S16, a new structured data is formed according to the information of target buffer, and
And structured data will be formed by and be added among isolated memory chained list.
If the judging result of step S15 is yes, the corresponding structured data of one target buffer of acquisition, and is held
Row step S17 judges whether the use number of processes of the corresponding application heap of current target buffer is zero, that is, judges mesh
Mark whether the corresponding handle_count of buffer ion_buffer is 0, if not being zero, expression currently has process to make
With this section of application heap, indicating this section of application heap, there is a situation where RAM leakages, then step S18 are needed to be implemented, by the mesh
The corresponding structured data of mark buffer is removed from isolated memory chained list, and does not discharge the corresponding memory of target buffer.
As it can be seen that the present embodiment is will not to discharge the application heap for there is process application heap currently in use, avoid because of mistake
The case where process collapse of the memory is used in releasing memory and causing, and application program is prevented to be unable to operate normally.
If the judging result of step S17 is yes, then it represents that there is no any for the corresponding application heap of current target buffer device
Process is used, and thens follow the steps S19, judges the leakage number try_ being recorded in current acquired structured data
Whether time is more than or equal to preset number.In the present embodiment, a preset times are preset, such as 3 times or 5 times
Deng.If the leakage number try_time being recorded is not greater than or is equal to preset number, S20 is thened follow the steps, is remembered
The leakage number try_time of record increases by 1 time.For example, the initial value of try_time is zero, then passes through when creation structured data
It crosses after step S20, the numerical value of try_time is 1, is so analogized.
If the judging result of step S19 be it is yes, confirm the corresponding application heap of the target buffer meet memory release
Condition, execute step S21, the corresponding structured data of the target buffer is removed from isolated memory chained list, and releases
Put corresponding application heap.At this point, the application heap discharged, which becomes other processes or thread, can apply for the application heap used,
Exactly become the memory that system can be used.
Finally, executing step S22, judge whether the structured data currently obtained is the last one in isolated memory chained list
Otherwise structured data, executes step S23 if so, then terminating process, obtain next structural body number in isolated memory chained list
According to, and return to step S17, judge the application heap use of the corresponding target buffer of structured data currently obtained into
Whether number of passes amount is zero.
As it can be seen that the present embodiment is by the way that each member in isolated memory chained list, i.e. each structured data carries out one
Secondary traversal finds out the corresponding structured data of all application heaps for meeting memory release conditions, and discharges these structural bodies
Application heap corresponding to data realizes recycling of the terminal device to memory.
Since the present embodiment is not to recycle to the corresponding application heap of all target buffers, but be directed to and be found
It reveals number and is greater than preset number, when such as 3 times or 5 times, this section of application heap can be just recycled, to avoid in certain time period
Interior, mistake is released a certain application heap due to not having process use, can lead to process in this way to avoid because of wrong releasing memory
The case where collapse, occurs.
It should be noted that just will start and judge whether when the present embodiment only has each system trigger such as kswap process
There is the judgement process of RAM leakage, that is, execute the process of Fig. 1, and after RAM leakage occurs in determination, can just hold
Row traversal executes the process of Fig. 2 to the process of isolated memory chained list, at this point, the number try_time for being found leakage just may be used
1 can be will increase.That is, only continuous 3 times or 5 times trigger kswap process, and when each scanning buffer device, all
It it was found that the use number of processes of same section of application heap is zero, can just be released, can effectively ensure discharged application heap in this way
Really it is in leak condition, thus the case where avoiding wrong releasing memory to greatest extent generation.
Certainly, if wrong releasing memory once occurs, it is possible that originally using the process weight of this section of application heap
The case where new application is using this section of memory, therefore, the present embodiment provides the operations that memory restores.Referring to Fig. 3, step is first carried out
S31 judges whether that receiving request uses the information of the memory discharged.For example, a certain application heap has been released, this
When, which may be used by other processes, should if originally used at this time using the process requested of the application heap
Application heap then issues the information using the application heap.
Since the application heap that the present embodiment is discharged all is physical memory, that is, each section of application heap all has oneself
Physical address, and process does not receive physical address, but virtual address is received, that is, process only issues request and uses certain
The request of one section of virtual address, rather than issue the request using a certain section of physical address.
If the judging result of step S31 be it is yes, then follow the steps S32, obtain one section of memory size it is equal-sized in
Deposit section, it should be noted that application heap acquired in step S32 is one section of physical memory, with the physical address of oneself, but
Do not map to virtual address.Then, step S33 is executed, by the physical address map of acquired application heap to virtual address,
Such as the corresponding virtual address of the physical address is obtained according to the mapping relations of memory address.Finally, step S34 is executed, to asking
Seek the information using virtual address acquired in the process return step S33 of releasing memory.In this way, issue solicited message into
Journey will acquire one section of memory size size another section memory equal with releasing memory amount of capacity, and only memory is physically
Location changes, but has no effect on process use.
It preferably, usually include the virtual address for being used memory when process issues request using a certain memory
Information therefore, can be by acquired physical memory mappings to the virtual address, in this way, step S34 is returned in step S33
The virtual address returned is exactly the information that the process requests the virtual address used.By aforesaid operations, void used in process
Quasi- address does not change, but physical memory pointed by virtual address is not but identical, therefore, for request using
For process through the memory discharged, the operation that memory restores is transparent, that is, the process is detectable in used
The physical address deposited has occurred and that variation, in this way, will not influence the work of the process.
As it can be seen that the present embodiment is in the case where system trigger low memory, by internally depositing, to be scanned acquisition abnormal interior
Section is deposited, and the application heap for being recorded generation RAM leakage is recycled by way of creating isolated memory chained list, thus
Quickly and effectively recycle abnormal application heap.In addition, the present embodiment is also recorded leakage number by setting to limit Memory recycle
The execution of operation avoids the releasing memory of mistake, it is ensured that the work of application program or process.
Computer installation embodiment:
The computer installation of the present embodiment includes processor, memory and storage in memory and can transport on a processor
Capable computer program, such as the message handling program for realizing above- mentioned information processing method.Processor executes computer journey
Each step of above-mentioned method for recovering internal storage is realized when sequence.
For example, computer program can be divided into one or more modules, one or more module, which is stored in, is deposited
It in reservoir, and is executed by processor, to complete modules of the invention.One or more modules can be can complete it is specific
The series of computation machine program instruction section of function, the instruction segment is for describing execution of the computer program in terminal device
Journey.
It should be noted that terminal device can be desktop PC, notebook, palm PC and cloud server etc.
Calculate equipment.Terminal device may include, but be not limited only to, processor, memory.It will be understood by those skilled in the art that this hair
Bright schematic diagram is only the example of terminal device, does not constitute the restriction to terminal device, may include than illustrate it is more or
Less component perhaps combines certain components or different components, such as terminal device can also be set including input and output
Standby, network access equipment, bus etc..
Processor alleged by the present invention can be central processing unit (Central Processing Unit, CPU), may be used also
To be other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic device
Part, discrete hardware components etc..General processor can be microprocessor or the processor is also possible to any conventional processing
Device etc., processor are the control centres of terminal device, utilize the various pieces of various interfaces and the entire terminal device of connection.
Memory can be used for storing computer program and/or module, and processor is stored in memory by operation or execution
Interior computer program and/or module, and the data being stored in memory are called, realize the various functions of terminal device.
Memory can mainly include storing program area and storage data area, wherein storing program area can storage program area, at least one
Application program needed for function (such as sound-playing function, image player function etc.) etc.;Storage data area can be stored according to hand
Machine uses created data (such as audio data, phone directory etc.) etc..In addition, memory may include high random access
Memory can also include nonvolatile memory, such as hard disk, memory, plug-in type hard disk, intelligent memory card (Smart
Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card), at least one magnetic
Disk storage device, flush memory device or other volatile solid-state parts.
Computer readable storage medium:
If the integrated module of terminal device is realized in the form of SFU software functional unit and sells or use as independent product
When, it can store in a computer readable storage medium.Based on this understanding, the present invention realizes above-described embodiment side
All or part of the process in method can also instruct relevant hardware to complete, the computer program by computer program
It can be stored in a computer readable storage medium, the computer program is when being executed by processor, it can be achieved that above-mentioned each interior
It is stored back to each step of receiving method.
Wherein, computer program includes computer program code, and computer program code can be source code form, object
Code form, executable file or certain intermediate forms etc..Computer-readable medium may include: that can carry computer program
Any entity or device of code, recording medium, USB flash disk, mobile hard disk, magnetic disk, CD, computer storage, read-only memory
(ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, electricity
Believe signal and software distribution medium etc..It should be noted that the content that computer-readable medium includes can be managed according to the administration of justice
Local legislation and the requirement of patent practice carry out increase and decrease appropriate, such as in certain jurisdictions, according to legislation and patent
Practice, computer-readable medium does not include electric carrier signal and telecommunication signal.
Certainly, above-mentioned scheme is the preferred embodiment of the invention, and practical application is that can also have more variations,
For example, parameter set in structured data can change according to actual request, alternatively, determining that the condition of RAM leakage can be with
Other conditions are changed to, such as system can be lower than a certain preset value for a long time with free memory, these changes do not affect this hair
Bright implementation also should include within the scope of the present invention.
Claims (10)
1. method for recovering internal storage characterized by comprising
When RAM leakage occurs in confirmation, the information of the corresponding target buffer of abnormal application heap is obtained;
Structured data corresponding with the target buffer is searched in isolated memory chained list, and judges the target cache
Whether the leakage number in the corresponding structured data of device reaches preset number, if so, it is right to discharge the target buffer institute
The memory answered.
2. method for recovering internal storage according to claim 1, it is characterised in that:
Leakage number as described in determining in the corresponding structured data of target buffer is not up to preset number, then the mesh
The leakage number marked in the corresponding structured data of buffer increases once, and does not discharge interior corresponding to the target buffer
It deposits.
3. method for recovering internal storage according to claim 1 or 2, it is characterised in that:
It includes: when system free memory is lower than default memory threshold, to used memory that RAM leakage, which occurs, in the confirmation
The corresponding buffer of section is scanned, and the buffer that the process usage quantity of judging whether there is is zero, if so, in confirmation appearance
Deposit leakage.
4. method for recovering internal storage according to claim 3, it is characterised in that:
Before searching structured data corresponding with the target buffer in the isolated memory chained list, also execute:
A structured data in the isolated memory chained list is obtained, and is confirmed corresponding to the structured data currently obtained
The process usage quantity of target buffer whether be zero, be such as not zero, then by the structured data currently obtained from the orphan
It is deleted in vertical memory chained list, and does not discharge memory corresponding to the target buffer.
5. method for recovering internal storage according to claim 1 or 2, it is characterised in that:
After discharging memory corresponding to the target buffer, also execute: by the corresponding structured data of the target buffer
It is deleted from the isolated memory chained list.
6. method for recovering internal storage according to claim 1 or 2, it is characterised in that:
After searching structured data corresponding with the target buffer in the isolated memory chained list, also executes: judging institute
Stating the corresponding structured data of target buffer whether there is in the isolated memory chained list, is such as not present, creates the mesh
After the corresponding structured data of mark buffer and it is added in the isolated memory chained list.
7. method for recovering internal storage according to claim 1 or 2, it is characterised in that:
After discharging memory corresponding to the target buffer, also execute:
Judge whether to receive request using the solicited message of the corresponding memory of the target buffer, if so, it is big to obtain capacity
Small identical one section of memory simultaneously provides the sender of solicited message.
8. method for recovering internal storage according to claim 7, it is characterised in that:
Obtaining the identical one section of memory of amount of capacity and providing the sender of solicited message includes: to obtain amount of capacity identical one
After section memory, the memory address is converted into virtual address, and provide virtual address to the sender of the solicited message
Information.
9. computer installation, which is characterized in that including processor and memory, the memory is stored with computer program,
When the computer program is executed by processor realize as described in any one of claim 1 to 8 method for recovering internal storage it is each
A step.
10. computer readable storage medium is stored thereon with computer program, it is characterised in that: the computer program is located
Manage each step that the method for recovering internal storage as described in any one of claim 1 to 8 is realized when device executes.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810631223.6A CN108984295B (en) | 2018-06-19 | 2018-06-19 | Memory recovery method, computer device and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810631223.6A CN108984295B (en) | 2018-06-19 | 2018-06-19 | Memory recovery method, computer device and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108984295A true CN108984295A (en) | 2018-12-11 |
CN108984295B CN108984295B (en) | 2020-08-07 |
Family
ID=64540741
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810631223.6A Active CN108984295B (en) | 2018-06-19 | 2018-06-19 | Memory recovery method, computer device and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108984295B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110532198A (en) * | 2019-09-09 | 2019-12-03 | 成都西山居互动娱乐科技有限公司 | A kind of method and device of memory allocation |
CN111782560A (en) * | 2020-07-10 | 2020-10-16 | Oppo广东移动通信有限公司 | Memory recovery method and device, terminal equipment and storage medium |
CN111966603A (en) * | 2020-09-04 | 2020-11-20 | 网易(杭州)网络有限公司 | Memory leak detection method and device, readable storage medium and electronic equipment |
CN112423104A (en) * | 2020-09-02 | 2021-02-26 | 上海幻电信息科技有限公司 | Audio mixing method and system for multi-channel audio in live scene |
CN113986559A (en) * | 2021-12-24 | 2022-01-28 | 荣耀终端有限公司 | Memory management method and related device |
Citations (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO1994004976A1 (en) * | 1992-08-14 | 1994-03-03 | Noblenet, Inc. | Client-side memory management process and system for client-server computing |
US7398369B2 (en) * | 2004-10-28 | 2008-07-08 | International Business Machines Corporation | Memory leakage management |
CN101908018A (en) * | 2010-07-20 | 2010-12-08 | 北京海泰方圆科技有限公司 | System and method for judging memory leak |
CN102053868A (en) * | 2009-11-04 | 2011-05-11 | 突触计算机系统(上海)有限公司 | Memory leak detection method and device |
US8881164B2 (en) * | 2011-10-18 | 2014-11-04 | Hewlett-Packard Development Company, L.P. | Computer process with utilization reduction |
CN104182320A (en) * | 2013-05-23 | 2014-12-03 | 联想(北京)有限公司 | Method and device for monitoring leakage of memory |
CN106547617A (en) * | 2015-09-18 | 2017-03-29 | 李鹤 | A kind of EMS memory management process and system using analysis-feedback-tuning pattern |
CN106610892A (en) * | 2015-10-23 | 2017-05-03 | 腾讯科技(深圳)有限公司 | Memory leak detecting method and device |
CN106844159A (en) * | 2017-02-03 | 2017-06-13 | 广东欧珀移动通信有限公司 | A kind of information acquisition method, device and intelligent terminal |
CN106844216A (en) * | 2017-01-25 | 2017-06-13 | 深圳怡化电脑股份有限公司 | The localization method and system of a kind of RAM leakage |
CN107145447A (en) * | 2017-05-09 | 2017-09-08 | 网易(杭州)网络有限公司 | Detect method, device and the electronic equipment of memory overflow |
CN107609199A (en) * | 2017-10-24 | 2018-01-19 | 网易无尾熊(杭州)科技有限公司 | A kind of method, equipment and storage medium for handling and recovering the page |
CN107957950A (en) * | 2017-12-08 | 2018-04-24 | 锐捷网络股份有限公司 | A kind of detection method and device of system resource leakage |
CN108073439A (en) * | 2016-11-11 | 2018-05-25 | 深圳业拓讯通信科技有限公司 | A kind of JVM RAM leakages automatic testing method and system |
-
2018
- 2018-06-19 CN CN201810631223.6A patent/CN108984295B/en active Active
Patent Citations (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO1994004976A1 (en) * | 1992-08-14 | 1994-03-03 | Noblenet, Inc. | Client-side memory management process and system for client-server computing |
US7398369B2 (en) * | 2004-10-28 | 2008-07-08 | International Business Machines Corporation | Memory leakage management |
CN102053868A (en) * | 2009-11-04 | 2011-05-11 | 突触计算机系统(上海)有限公司 | Memory leak detection method and device |
CN101908018A (en) * | 2010-07-20 | 2010-12-08 | 北京海泰方圆科技有限公司 | System and method for judging memory leak |
US8881164B2 (en) * | 2011-10-18 | 2014-11-04 | Hewlett-Packard Development Company, L.P. | Computer process with utilization reduction |
CN104182320A (en) * | 2013-05-23 | 2014-12-03 | 联想(北京)有限公司 | Method and device for monitoring leakage of memory |
CN106547617A (en) * | 2015-09-18 | 2017-03-29 | 李鹤 | A kind of EMS memory management process and system using analysis-feedback-tuning pattern |
CN106610892A (en) * | 2015-10-23 | 2017-05-03 | 腾讯科技(深圳)有限公司 | Memory leak detecting method and device |
CN108073439A (en) * | 2016-11-11 | 2018-05-25 | 深圳业拓讯通信科技有限公司 | A kind of JVM RAM leakages automatic testing method and system |
CN106844216A (en) * | 2017-01-25 | 2017-06-13 | 深圳怡化电脑股份有限公司 | The localization method and system of a kind of RAM leakage |
CN106844159A (en) * | 2017-02-03 | 2017-06-13 | 广东欧珀移动通信有限公司 | A kind of information acquisition method, device and intelligent terminal |
CN107145447A (en) * | 2017-05-09 | 2017-09-08 | 网易(杭州)网络有限公司 | Detect method, device and the electronic equipment of memory overflow |
CN107609199A (en) * | 2017-10-24 | 2018-01-19 | 网易无尾熊(杭州)科技有限公司 | A kind of method, equipment and storage medium for handling and recovering the page |
CN107957950A (en) * | 2017-12-08 | 2018-04-24 | 锐捷网络股份有限公司 | A kind of detection method and device of system resource leakage |
Non-Patent Citations (2)
Title |
---|
H. CHO等: "Effect of Heat-treatment Time on Performance Recovery of Ti-50.4at%Ni Shape Memory Alloy", 《EFFECT OF HEAT-TREATMENT TIME ON PERFORMANCE RECOVERY OF TI-50.4AT%NI SHAPE MEMORY ALLOY》 * |
史玉良等: "面向隐私保护的数据块调整机制", 《计算机学报》 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110532198A (en) * | 2019-09-09 | 2019-12-03 | 成都西山居互动娱乐科技有限公司 | A kind of method and device of memory allocation |
CN110532198B (en) * | 2019-09-09 | 2023-08-08 | 成都西山居互动娱乐科技有限公司 | Storage space allocation method and device |
CN111782560A (en) * | 2020-07-10 | 2020-10-16 | Oppo广东移动通信有限公司 | Memory recovery method and device, terminal equipment and storage medium |
CN112423104A (en) * | 2020-09-02 | 2021-02-26 | 上海幻电信息科技有限公司 | Audio mixing method and system for multi-channel audio in live scene |
CN111966603A (en) * | 2020-09-04 | 2020-11-20 | 网易(杭州)网络有限公司 | Memory leak detection method and device, readable storage medium and electronic equipment |
CN111966603B (en) * | 2020-09-04 | 2024-01-19 | 网易(杭州)网络有限公司 | Memory leakage detection method and device, readable storage medium and electronic equipment |
CN113986559A (en) * | 2021-12-24 | 2022-01-28 | 荣耀终端有限公司 | Memory management method and related device |
Also Published As
Publication number | Publication date |
---|---|
CN108984295B (en) | 2020-08-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108984295A (en) | Method for recovering internal storage, computer installation and computer readable storage medium | |
CN108495195B (en) | Network live broadcast ranking list generation method, device, equipment and storage medium | |
CN111159436B (en) | Method, device and computing equipment for recommending multimedia content | |
CN107832100B (en) | APK plug-in loading method and terminal thereof | |
CN100511156C (en) | Apparatus for compulsively terminating thread blocked on input/output operation and method for the same | |
CN105760199B (en) | A kind of application resource loading method and its equipment | |
CN109857548A (en) | Memory space optimization method, device, computer equipment and storage medium | |
CN104657380A (en) | Picture loading method and device | |
CN106302632A (en) | The method for down loading of a kind of foundation image and management node | |
CN108459898A (en) | A kind of recovery method as resource and device | |
CN110162328B (en) | Method and device for upgrading intelligent card operating system | |
CN111522659B (en) | Space use method and device | |
CN103645950A (en) | Computer acceleration method and device | |
US20130290666A1 (en) | Demand-Based Memory Management of Non-pagable Data Storage | |
CN109857612A (en) | A kind of monitoring method and its terminal of data write operation | |
CN102946413A (en) | Method and system for resource preprocessing in dispatching and deployment performing process of virtual machine | |
CN106598737A (en) | Method and device for implementing hardware resource allocation | |
CN109067562B (en) | Dynamic configuration updating method and system based on intelligent pointer, server and medium | |
CN110674052A (en) | Memory management method, server and readable storage medium | |
CN107943423A (en) | The management method and computer-readable recording medium of storage resource in cloud system | |
CN108536609A (en) | Memory fragmentation manages system and method | |
CN108170505A (en) | A kind of driven management method and host | |
CN112799588A (en) | Data storage method for loading container cluster application data by using external storage | |
CN109408222A (en) | Intelligent terminal and its space management, the device with store function | |
CN109274991B (en) | Memory management method and system of smart television |
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 |