CN110221921A - EMS memory management process, terminal and computer readable storage medium - Google Patents
EMS memory management process, terminal and computer readable storage medium Download PDFInfo
- Publication number
- CN110221921A CN110221921A CN201910512893.0A CN201910512893A CN110221921A CN 110221921 A CN110221921 A CN 110221921A CN 201910512893 A CN201910512893 A CN 201910512893A CN 110221921 A CN110221921 A CN 110221921A
- Authority
- CN
- China
- Prior art keywords
- memory
- application program
- value
- threshold value
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5021—Priority
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephone Function (AREA)
Abstract
The invention discloses a kind of EMS memory management process, this method is ranked up each application program according to use priority, and then the threshold value of system trigger memory management mechanism operation is determined as target program according to the numerical value of the target program committed memory according to the application program of collating sequence acquisition preset quantity;Finally by the size for judging current residual memory and threshold value, if current residual memory is less than the threshold value, running memory administrative mechanism, and rule is discharged according to preset memory, it determines the application program in backstage to killing, and discharges the memory headroom that the application program to killing occupies.The invention also discloses a kind of memory management terminal and computer storage mediums.The present invention realizes terminal can adjust the threshold value of triggering memory management mechanism operation according to the use habit dynamic of user, so that mobile phone free memory is able to satisfy the demand of different user.
Description
Technical field
The present invention relates to smart machine development field more particularly to a kind of EMS memory management process, terminal and computer-readable
Storage medium.
Background technique
As application program (APP) function is stronger and stronger, the application program that user installs on smart phone is increasingly
More, for the convenience used, user usually when switching application program, does not close current application program not instead of directly, leads to
It crosses HOME key and returns to mobile phone main interface, the application program being being currently used is retracted into running background, is then turned on new application
Program.If the application program opened is more, the number of applications that will lead to backstage is larger, and it is empty to occupy more memory
Between.
Android system is provided with LMK mechanism (Low Memory Killer), and LMK mechanism can periodically execute primary inspection, is killed
The low application program of some priority of dying, and then release the occupied memory in part.But current LMK mechanism is to pass through
Fixed threshold values is set to kill the application program on backstage, threshold value is can not to change according to the use habit dynamic of user, is caused
Mobile phone can not be adapted to the user of different memory requirements.For example, if the threshold value of mobile phone to be set to the use for liking playing big game
When family demand is that the threshold value of setting is larger, then will result in mobile phone EMS memory for the user that simple application program is used only
The waste of resource;On the contrary, if the threshold value of mobile phone to be set to the threshold set using only the user demand of simple application program
When being worth smaller, then be easy to causeing the Caton of cell phone system for the user for playing big game.
Summary of the invention
The main purpose of the present invention is to provide a kind of EMS memory management process, it is intended to which solution must not be practised according to the use of user
Used dynamic adjustment threshold size, so that the technical issues of mobile phone can not be adapted to the user of different memory requirements.
To achieve the above object, the present invention provides a kind of EMS memory management process, which includes:
Each application program is ranked up according to use priority, and obtains the application journey of preset quantity according to collating sequence
Sequence is as target program;
The threshold value of system trigger memory management mechanism operation is determined according to the numerical value of the target program committed memory;
Judge whether current residual memory is less than the threshold value;
If so, running memory administrative mechanism, and regular, the corresponding application program of killing is discharged according to preset memory,
To discharge the memory headroom that the application program occupies.
Preferably, each application program is ranked up according to use priority described, and is obtained in advance according to collating sequence
If before the step of application program of quantity is as target program, comprising:
Obtain the use data of the application program and the application program that start in the first preset time, wherein described to make
It include login times, average operation duration and from least one of number for switching to foreground from the background with data;
According to the use priority for calculating the application program using data.
Preferably, the calculation formula of the use priority are as follows:
P=c1×f1+c2×f2,
Wherein, P is the use priority of certain application program, c1For the weight of login times, f1For login times, c2For from
Backstage switches to the weight of the number on foreground, f2For from the number for switching to foreground from the background.
Preferably, the numerical value according to the target program committed memory determines that system trigger memory management mechanism is run
Threshold value the step of, comprising:
Obtain the numerical value of each target program committed memory;
The numerical value is averaging, the average value of the target program committed memory is calculated;
The threshold value of system trigger memory management mechanism operation is determined according to the average value.
Preferably, the calculation formula of the average value for calculating the target program committed memory are as follows:
Wherein, A is the average value of target program committed memory, xnFor the numerical value of n-th of target program committed memory, n is
The number of target program, n are positive integer.
Preferably, it is described judge the step of whether current residual memory is less than the threshold value before, comprising:
The initial adj value of each application program in the second preset time is obtained by AMS.
Preferably, described that rule is discharged according to preset memory, the step of killing corresponding application program, comprising:
The initial adj value of each application program is adjusted according to the use priority, and adj value adjusted is made
For target adj value;
Killing selection target adj value is maximum since currently running application program, until free memory is more than institute
State threshold value;Or
According to the corresponding relationship of preset target adj value and threshold value, answering for the corresponding target adj value of the threshold value will be above
With the maximum beginning killing of EMS memory occupation in program, until free memory is more than the threshold value.
Preferably, described that rule is discharged according to preset memory, the step of killing corresponding application program, further includes:
Killing selecting initial adj value maximum since currently running application program, until free memory is more than institute
State threshold value;Or
According to the corresponding relationship of preset initial adj value and threshold value, answering for the corresponding initial adj value of the threshold value will be above
With the maximum beginning killing of EMS memory occupation in program, until free memory is more than the threshold value.
In addition, to achieve the above object, the present invention also provides a kind of memory management terminal, the memory management terminal packet
It includes: memory, processor and being stored in the storage management that can be run on the memory and on the processor, it is described
The step of EMS memory management process described in any one of above-mentioned steps is realized when storage management is executed by the processor.
In addition, to achieve the above object, the present invention also provides a kind of computer readable storage mediums, it is stored thereon with memory
Management program realizes any EMS memory management process in above-mentioned steps when the storage management is executed by processor
Step.
The present invention obtains present count by being ranked up according to use priority to each application program, and according to collating sequence
Then the application program of amount determines system trigger memory pipe according to the numerical value of the target program committed memory as target program
The threshold value of reason mechanism operation;Finally by the size for judging current residual memory and threshold value, if current residual memory is less than described
When threshold value, then running memory administrative mechanism, and rule is discharged according to preset memory, determine the application journey in backstage to killing
Sequence, and discharge the memory headroom that the application program to killing occupies.By above embodiment, enable terminal according to
The use habit dynamic at family adjusts the threshold value of free memory, and mobile phone free memory is allowed to be able to satisfy the demand of different user.
A kind of EMS memory management process, terminal and the computer readable storage medium that the embodiment of the present invention proposes, by threshold
The dynamic of value adjusts, and realizes threshold value and changes as the high application program of use priority changes, so that terminal is surplus
Remaining memory is able to satisfy the demand of user always.
Detailed description of the invention
Fig. 1 is the structural schematic diagram of memory management terminal first embodiment of the present invention;
Fig. 2 is the flow diagram of EMS memory management process first embodiment of the present invention;
Fig. 3 is the flow diagram of EMS memory management process second embodiment of the present invention;
Fig. 4 is to determine that system trigger memory management mechanism is run according to the numerical value of the target program committed memory in Fig. 2
Threshold value the step of refinement flow diagram;
Fig. 5 is the flow diagram of EMS memory management process 3rd embodiment of the present invention;
Fig. 6 is the flow diagram of EMS memory management process fourth embodiment of the present invention;
Fig. 7 is the flow diagram of the 5th embodiment of EMS memory management process of the present invention.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The primary solutions of the embodiment of the present invention are: being ranked up according to use priority to each application program, and root
The application program of preset quantity is obtained as target program according to collating sequence;Numerical value according to the target program committed memory is true
Determine the threshold value of system trigger memory management mechanism operation;Judge whether current residual memory is less than the threshold value;If so, operation
Memory management mechanism, and rule is discharged according to preset memory, the corresponding application program of killing is accounted for discharging the application program
Memory headroom.
Due to current memory management mechanism (Low Memory Killer referred to as: LMK) be by the fixed threshold values of setting come
The application program on backstage is killed, threshold value is can not to change according to the use habit dynamic of user, causes mobile phone that can not be adapted to difference
The user of memory requirements.
The present invention provides a solution, and terminal is enabled to adjust triggering memory pipe according to the use habit dynamic of user
The threshold value of reason mechanism operation, allows mobile phone free memory to be able to satisfy the demand of different user.
As shown in Figure 1, Fig. 1 is the terminal structure schematic diagram of memory management terminal of the present invention.
The terminal of that embodiment of the invention can be smart phone, be also possible to television set, PC, tablet computer, e-book reading
Device, MP3 (Moving Picture Experts Group Audio Layer III, dynamic image expert's compression standard audio
Level 3) player, MP4 (Moving Picture Experts Group Audio Layer IV, dynamic image expert compression
Standard audio level 4) terminal devices such as player, portable computer.
As shown in Figure 1, the terminal may include: processor 1001, such as CPU, communication bus 1002, user interface
1003, network interface 1004, memory 1005.Wherein, communication bus 1002 is for realizing the connection communication between these components.
User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard), optional user interface
1003 can also include standard wireline interface and wireless interface.Network interface 1004 optionally may include that the wired of standard connects
Mouth, wireless interface (such as WI-FI interface).Memory 1005 can be high speed RAM memory, be also possible to stable memory
(non-volatile memory), such as magnetic disk storage.Memory 1005 optionally can also be independently of aforementioned processor
1001 storage device.
Optionally, terminal can also include camera, RF (Radio Frequency, radio frequency) circuit, sensor, audio
Circuit, WiFi module etc..Wherein, sensor such as optical sensor, motion sensor and other sensors.Specifically, light
Sensor may include ambient light sensor and proximity sensor, wherein ambient light sensor can according to the light and shade of ambient light come
The brightness of display screen is adjusted, proximity sensor can close display screen and/or backlight when mobile terminal is moved in one's ear.As
One kind of motion sensor, gravity accelerometer can detect the size of (generally three axis) acceleration in all directions, quiet
Size and the direction that can detect that gravity when only, the application that can be used to identify mobile terminal posture are (such as horizontal/vertical screen switching, related
Game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap) etc.;Certainly, mobile terminal can also match
The other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor are set, details are not described herein.
It will be understood by those skilled in the art that the restriction of the not structure paired terminal of terminal structure shown in Fig. 1, can wrap
It includes than illustrating more or fewer components, perhaps combines certain components or different component layouts.
As shown in Figure 1, as may include that operating system, network are logical in a kind of memory 1005 of computer storage medium
Believe module, Subscriber Interface Module SIM and storage management.
In terminal shown in Fig. 1, network interface 1004 is mainly used for connecting background server, carries out with background server
Data communication;User interface 1003 is mainly used for connecting client (user terminal), carries out data communication with client;And processor
1001 can be used for calling the storage management stored in memory 1005, and execute following operation:
Each application program is ranked up according to use priority, and obtains the application journey of preset quantity according to collating sequence
Sequence is as target program;
The threshold value of system trigger memory management mechanism operation is determined according to the numerical value of the target program committed memory;
Judge whether current residual memory is less than the threshold value;
If so, running memory administrative mechanism, and regular, the corresponding application program of killing is discharged according to preset memory,
To discharge the memory headroom that the application program occupies.
Further, processor 1001 can call the network operation stored in memory 1005 to control application program, also
Execute following operation:
Obtain the use data of the application program and the application program that start in the first preset time, wherein described to make
It include login times, average operation duration and from least one of number for switching to foreground from the background with data;
According to the use priority for calculating the application program using data.
Further, processor 1001 can call the network operation stored in memory 1005 to control application program, also
Execute following operation:
The calculation formula of the use priority are as follows:
P=c1×f1+c2×f2,
Wherein, P is the use priority of certain application program, c1For the weight of login times, f1For login times, c2For from
Backstage switches to the weight of the number on foreground, f2For from the number for switching to foreground from the background.
Further, processor 1001 can call the network operation stored in memory 1005 to control application program, also
Execute following operation:
Obtain the numerical value of each target program committed memory;
The numerical value is averaging, the average value of the target program committed memory is calculated;
The threshold value of system trigger memory management mechanism operation is determined according to the average value.
Further, processor 1001 can call the network operation stored in memory 1005 to control application program, also
Execute following operation:
The calculation formula of the average value for calculating the target program committed memory are as follows:
Wherein, A is the average value of target program committed memory, xnFor the numerical value of n-th of target program committed memory, n is
The number of target program, n are positive integer.
Further, processor 1001 can call the network operation stored in memory 1005 to control application program, also
Execute following operation:
The initial adj value of each application program in the second preset time is obtained by AMS.
Further, processor 1001 can call the network operation stored in memory 1005 to control application program, also
Execute following operation:
The initial adj value of each application program is adjusted according to the use priority, and adj value adjusted is made
For target adj value;
Killing selection target adj value is maximum since currently running application program, until free memory is more than institute
State threshold value;Or
According to the corresponding relationship of preset target adj value and threshold value, answering for the corresponding target adj value of the threshold value will be above
With the maximum beginning killing of EMS memory occupation in program, until free memory is more than the threshold value.
Further, processor 1001 can call the network operation stored in memory 1005 to control application program, also
Execute following operation:
Killing selecting initial adj value maximum since currently running application program, until free memory is more than institute
State threshold value;Or
According to the corresponding relationship of preset initial adj value and threshold value, answering for the corresponding initial adj value of the threshold value will be above
With the maximum beginning killing of EMS memory occupation in program, until free memory is more than the threshold value.
The specific embodiment of memory management terminal of the present invention and each embodiment of following EMS memory management process are essentially identical, herein
It does not repeat.
It is the flow diagram of the first embodiment of EMS memory management process of the present invention, the EMS memory management process referring to Fig. 2
Include:
Step S10 is ranked up each application program according to use priority, and obtains preset quantity according to collating sequence
Application program as target program.
The terminal of that embodiment of the invention can be smart phone, be also possible to television set, PC, tablet computer, e-book reading
Device, MP3 (Moving Picture Experts Group Audio Layer III, dynamic image expert's compression standard audio
Level 3) player, MP4 (Moving Picture Experts Group Audio Layer IV, dynamic image expert compression
Standard audio level 4) terminal devices such as player, portable computer.Following all examples of the invention is with smart phone
For, by the use data of each application program in acquisition smart phone, the use priority of each application program is calculated, into
And the use priority of each application program is ranked up, the highest application program of use priority for choosing preset quantity is made
For target program.Wherein, described using data includes login times, average operation duration and from the number for switching to foreground from the background
At least one of, it is known that user to the service condition of each application program using data by the way that acquisition is described.It needs
Bright, first preset time can be preset in smart phone, such as one day, two days or one week etc., user
Also other durations be can be set according to actual needs into, the present invention is with no restrictions.By obtaining each in the first preset time answer
With the use data of program, it is known that the use habit of terminal user, for example, if a few money video playings in smart phone
The use priority highest of software, the then it is known that user likes watching video the proximal segment time;If several in smart phone
Money browser use priority highest, the then it is known that user has the habit using mobile phone browsing webpage recently;If intelligence
A few money Games Software use priority highests of mobile phone, the then it is known that user likes playing game etc..In order to meet difference
To the difference of memory requirements, this is just needed several maximum applications of use priority in smart phone the user of use habit
Program is analyzed as target program, and to the numerical value of the EMS memory occupation of these target programs, enables smart phone real-time
Reserve corresponding free memory.
Step S20 determines the operation of system trigger memory management mechanism according to the numerical value of the target program committed memory
Threshold value.
Target program is several highest application programs of use priority in smart phone, is occupied according to target program
The numerical value of memory, it is known that demand size of the user to memory headroom, therefore the present embodiment is occupied according to the target program
Threshold value of the average value of memory as smart phone triggering memory management mechanism operation.Due to different mobile phones target program not
Together, therefore the threshold value of setting is also just different, for example, the smart phone through normally open big game, the threshold value of setting will compare
It greatly, is only merely the smart phone for opening applet, the threshold value of setting will be smaller.
Step S30, judges whether current residual memory is less than the threshold value.
The size of real-time monitoring smart phone free memory, and the free memory monitored is compared with threshold value, if
When current residual memory is less than the threshold value, S40 is thened follow the steps.If current residual memory is more than or equal to the threshold value
When, then continue to execute step S30.
Step S40, running memory administrative mechanism, and regular, the corresponding application program of killing is discharged according to preset memory,
To discharge the memory headroom that the application program occupies.
Application process is divided into five major class by Android, respectively Forground class, Visible class, Service class,
Background class and Empty class, different according to the type of application program, AMS (Activity Manager Service) can
To calculate the initial adj value of each application program.The use priority obtained further according to step S10 is to the initial of each application program
Adj value is adjusted, specifically, the application program high for use priority reduces its initial adj value, for use priority
Low application improves its initial adj value, enables each application program according to user's use habit, to the initial of application program
Adj value rearranges, the corresponding target adj value of the program that is applied.Rule is discharged according to preset memory, from currently running
The maximum beginning killing of selection target adj value in application program, until free memory is more than the threshold value;Or according to preset
The corresponding relationship of target adj value and threshold value will be above in the application program of the corresponding target adj value of the threshold value EMS memory occupation most
Big beginning killing, until free memory is more than the threshold value.
Smart phone is by being ranked up each application program according to use priority in the present embodiment, and according to sequence
Sequence obtains the application program of preset quantity as target program, determines further according to the numerical value of the target program committed memory
The threshold value of system trigger memory management mechanism operation, the size of real-time monitoring smart phone current residual memory, and judge current
Whether free memory is less than the threshold value, if so, running memory administrative mechanism, and rule is discharged according to preset memory, it looks into
Corresponding application program is killed, to discharge the memory headroom that the application program occupies.By above embodiment, so that intelligent hand
Function adjusts the threshold value of triggering memory management mechanism operation according to user's use habit come dynamic, and the free memory of mobile phone is allowed to meet
The demand of different user.
It further, is the flow diagram of the second embodiment of EMS memory management process of the present invention, based on upper referring to Fig. 3
Embodiment shown in Fig. 2 is stated, before the highest application program of use priority that the step S10 obtains preset quantity, packet
It includes:
Step S101 obtains the use data of the application program and the application program that start in the first preset time,
In, described using data includes login times, average operation duration and from least one of number for switching to foreground from the background.
Since the use habit of different user is different, the service condition of application program is not also just identical on smart phone, leads to
The use data for obtaining smart phone each application program in the first preset time are crossed, and according to using data to calculate each answer
With the use priority of program, and then the use priority of each application program is ranked up, chooses the use of preset quantity
The application program of highest priority is as target program.Wherein, described using data includes application program when first is default
In login times, average operation duration and from number for switching to foreground from the background etc., can be known by described using data
Service condition of the road user to each application program.
It is understood that the time span of above-mentioned first preset time can be configured according to actual needs, herein
It does not do and further limits.Preferably, first preset time can be for one day or two days or one week etc., and user can be with
It is configured according to actual needs.
By getting the use data of each application program in the first preset time, it is known that terminal user's makes
With habit, for example, if in smart phone a few money video jukebox softwares use priority highest, it is known that the user
The proximal segment time likes watching video;If a few money browser use priority highests in smart phone, it is known that the use
Like browsing webpage recently in family;If a few money Games Software use priority highests of smart phone, it is known that the user
Like playing game etc..
Step S102, according to the use priority for calculating the application program using data.
In the present invention using data be login times, average operation duration and from the number for switching to foreground from the background to
Few one kind, therefore, the present invention can choose login times, average operation duration and from the number for switching to foreground from the background it is any
A kind of data, which are used as, uses data, also can choose login times, average operation duration and from the number for switching to foreground from the background
In any two kinds of data be used as and use data, be also possible to select login times, average operation duration and before switching to from the background
The number of platform is all used as and uses data.
Preferably, the present embodiment is using login times and from the number on foreground is switched to from the background as using data instance, root
Use priority is calculated according to following formula:
P=c1×f1+c2×f2,
Wherein, P is the use priority of certain application program, c1For the weight of login times, f1For login times, c2For from
Backstage switches to the weight of the number on foreground, f2For from the number for switching to foreground from the background, and c1+c2=1.
As another embodiment, naturally it is also possible to login times, average operation duration and before switching to from the background
The number of platform as data are used, calculates use priority simultaneously according to the following formula:
P=c1×f1+c2×f2+c3×f3,
Wherein, P is the use priority of certain application program, c1For the weight of login times, f1For login times, c2For from
Backstage switches to the weight of the number on foreground, f2For from the number for switching to foreground from the background, c3For the weight of average operation duration,
f3For average operation duration, and c1+c2+c3=1.
It will be understood by those skilled in the art that above-described embodiment does not constitute the restriction to data are used, it may include ratio
More or fewer reference factors in above-described embodiment, the principle for calculating use priority is identical, does not just repeat one by one herein.
In the present embodiment by the use of the application program and the application program that start in the first preset time of acquisition
Data, and intelligence is got by above embodiment according to the use priority for calculating the application program using data
The most used application program occupies to be subsequent according to target program to recognize the use habit of user in energy mobile phone
Amount of ram threshold value is prepared.
Referring to Fig. 4, it is based on above-mentioned embodiment shown in Fig. 2, the step S20 is according to the target program committed memory
Numerical value determines the threshold value of system trigger memory management mechanism operation, comprising:
Step S201 obtains the numerical value of each target program committed memory.
Step S202 is averaging the numerical value, calculates the average value of the target program committed memory.
According to the size of each target program committed memory, computational intelligence mobile phone needs to account for when running these target programs
Memory.The present invention can choose several highest application programs of use priority as target program, can be one,
Two, three or four etc., in the present embodiment, highest three application programs of use priority are chosen as target journey
Sequence, and these three application programs are averaging, calculate the average value of these three target program committed memories.Wherein, it calculates
The calculation formula of the average value of these three target program committed memories is as follows:
Wherein, A is the average value of target program committed memory, xnFor the numerical value of n-th of target program committed memory, n is
The number of target program, n are positive integer.
Step S203 determines the threshold value of system trigger memory management mechanism operation according to the average value.
After calculating average value, using the average value as the threshold value of triggering memory management mechanism operation, so that often
The smart phone for opening the big application program of EMS memory occupation amount can reserve biggish free memory, small through normally open EMS memory occupation amount
The smart phone of application program can reserve lesser free memory.Triggering memory management is being determined according to the average value of target program
Mechanism operation threshold value when, rule of thumb threshold value can be arranged it is multiple, and each threshold value corresponded to according to alert level it is different
Target adj value establishes the corresponding relationship of threshold value Yu target adj value.
The present embodiment is big come threshold value according to the average value of target program committed memory when target program is multiple
It is small, it, can be directly using the numerical value of the target program committed memory as threshold value when target program is one.Therefore as another
Kind of embodiment, using that highest application program of use priority as target program, and by the target program committed memory
Numerical value is as threshold value.It will be understood to those skilled in the art that restriction of the above-described embodiment not as target program, target program
Quantity can be determined according to the actual situation.
The present embodiment come the size of threshold value, allows smart phone root according to the size of target program committed memory
It is accustomed to dynamic adjustment threshold value according to user, mobile phone free memory is made to be able to satisfy the demand of different user.
Referring to Fig. 5, the flow diagram of the 3rd embodiment of EMS memory management process of the present invention, based on above-mentioned shown in Fig. 2
Embodiment, before the step S30 judges whether current residual memory is less than the threshold value, comprising:
Step S301 obtains the initial adj value of each application program in the second preset time by AMS.
Since the starting of each application program is required by AMS (Activity Manager Service abbreviation: AMS)
Management, so AMS can be actuated for collection monitoring to application program in each life cycle, and according to the category of application program
Property calculates the initial adj value of each application program, is finally regularly updated using proc file system.Specifically, Android will answer
It is divided into five major class, respectively foreground process (Forground) class, visible process (Visible) class, service processes with process
(Service) class, background process (Background) class and null process (Empty) class, it is different according to the type of application program,
AMS calculates the initial adj value of each application program.For example, current smart phone is currently running a browser, when browser circle
When foreground is shown, browser belongs to foreground process (foreground) in face, and initial adj value is 0, but once by pressing home
Key returns to main interface, which has reformed into background program (background), and initial adj value just will increase, if be
255, when smart phone is in low internal storage warning, the application program of running background will be preferentially killed, and initial adj value is got over
Greatly, easier by killing.Wherein, second preset time can be configured according to actual needs, can be 10 minutes, 30
Minute or 1 hour etc., in order that can be updated to the initial adj value of application program every the second preset duration.
The present embodiment is known that according to initial adj value using journey by obtaining the initial adj value of each application program
The importance of sequence so that system is in killing background application, can by the preferential killing of inessential application program and
Retain the high application program of importance.
Referring to Fig. 6, the flow diagram of the fourth embodiment of EMS memory management process of the present invention, the step S40 is according to pre-
If memory discharge rule, the corresponding application program of killing, comprising:
Step S401 adjusts the initial adj value of each application program according to the use priority, and will be after adjustment
Adj value as target adj value.
On the basis of initial adj value, it can be adjusted according to adj value of the use priority to application program, specifically
, the application program high for use priority reduces its adj value, the application program low for use priority improves it
Adj value, and using adj value adjusted as target adj value.The adj value combination user of application program is enabled to use habit in this way
It is used to resequence, so that the corresponding adj value of application program that user frequently uses is reduced, in background application killing
When, it is not easy to it is killed.Specifically, in background application killing, step S402 is executed from currently running and applies journey
The maximum beginning killing of selection target adj value in sequence, until free memory is more than the threshold value;Or execute step S403 according to
The corresponding relationship of preset target adj value and threshold value will be above memory in the application program of the corresponding target adj value of the threshold value
Maximum beginning killing is occupied, until free memory is more than the threshold value.
Step S402, killing selection target adj value is maximum since currently running application program, until in residue
Depositing is more than the threshold value.
Since target adj value is bigger, corresponding application program is more inessential, in background application killing, is easiest to
It is killed, so the present embodiment can carry out killing according to the size of target adj value, and is selected from currently running application program
The maximum beginning killing of target adj value is selected, until free memory is more than the threshold value.
Step S403 will be above the corresponding target of the threshold value according to the corresponding relationship of preset target adj value and threshold value
The maximum beginning killing of EMS memory occupation in the application program of adj value, until free memory is more than the threshold value.
According to the value range of the target adj value of the application program of backstage hang-up, the value range is passed through several
Threshold value is divided, and the corresponding relationship of target adj value and threshold value is established.For example, the target adj for the application program that backstage is hung up
The value range of value is divided with 6 threshold values, is configured respectively from low to high from target adj value, and preceding 3 threshold values are arranged to
The lesser fixed value of numerical value, rear 3 threshold values be respectively the average value of target program committed memory, target program committed memory it is flat
2 times of mean value, 3 times of the average value of target program committed memory.According to the corresponding relationship of preset target adj value and threshold value,
It will be above the maximum beginning killing of EMS memory occupation in the application program of the corresponding target adj value of the threshold value, until free memory
More than the threshold value.I.e. when free memory is less than the 4th threshold value, it is high to choose the corresponding target adj value of than the 4th threshold value
The maximum beginning killing of EMS memory occupation in application program, until free memory is greater than or equal to the 4th threshold size;Work as residue
When memory is lower than the 5th threshold value, EMS memory occupation is chosen in the high application program of the corresponding target adj value of than the 5th threshold value most
Big beginning killing, until free memory is greater than or equal to the 5th threshold size.
According to the size of target adj value and the corresponding relationship of target adj value and threshold value in the present embodiment, to target adj value
High application program carries out killing, to release memory headroom, it is interior to realize that smart phone can discharge automatically in low memory
The effect deposited.
Referring to Fig. 7, the flow diagram of the 5th embodiment of EMS memory management process of the present invention, as the step S40's
Another embodiment, the step include:
Step S404, killing selecting initial adj value maximum since currently running application program, until in residue
Depositing is more than the threshold value.
Be different from above-mentioned fourth embodiment, be in the present embodiment using initial adj value as the foundation of application program killing,
Since initial adj value is bigger, corresponding application program is more inessential, in background application killing, is easiest to be killed, institute
Killing can be carried out according to the size of initial adj value with the present embodiment, and select initial adj from currently running application program
It is worth maximum beginning killing, until free memory is more than the threshold value.
It is corresponding initial to will be above the threshold value according to the corresponding relationship of preset initial adj value and threshold value by step S405
The maximum beginning killing of EMS memory occupation in the application program of adj value, until free memory is more than the threshold value.
The corresponding relationship of initial adj value and threshold value is pre-established, and is closed according to preset target adj value is corresponding with threshold value
System, will be above the maximum beginning killing of EMS memory occupation in the application program of the corresponding target adj value of the threshold value, until in residue
Depositing is more than the threshold value.I.e. when free memory is less than the 4th threshold value, it is high to choose the corresponding initial adj value of than the 4th threshold value
Application program in the maximum beginning killing of EMS memory occupation, until free memory be greater than or equal to the 4th threshold size;When surplus
When remaining memory is lower than the 5th threshold value, EMS memory occupation in the high application program of the corresponding initial adj value of than the 5th threshold value is chosen
Maximum beginning killing, until free memory is greater than or equal to the 5th threshold size.
It will be understood by those skilled in the art that in this embodiment it is possible to being to execute above-mentioned steps S404 or S405, originally
Embodiment is not particularly limited.
Corresponding relationship in the present embodiment according to the size of initial adj value and initial adj value and threshold value, to initial adj value
High application program carries out killing, to release memory headroom, it is interior to realize that smart phone can discharge automatically in low memory
The effect deposited.
In addition, the embodiment of the present invention also proposes a kind of computer readable storage medium, the computer readable storage medium
On be stored with storage management, realized when the storage management is executed by processor in described in any one of above-mentioned steps
The step of depositing management method.
The specific embodiment of computer readable storage medium of the present invention and the basic phase of each embodiment of above-mentioned EMS memory management process
Together, therefore not to repeat here.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row
His property includes, so that the process, method, article or the system that include a series of elements not only include those elements, and
And further include other elements that are not explicitly listed, or further include for this process, method, article or system institute it is intrinsic
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do
There is also other identical elements in the process, method of element, article or system.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art
The part contributed out can be embodied in the form of software products, which is stored in one as described above
In storage medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that terminal device (it can be mobile phone,
Computer, server, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.
Claims (10)
1. a kind of EMS memory management process, which comprises the following steps:
Each application program is ranked up according to use priority, and is made according to the application program that collating sequence obtains preset quantity
For target program;
The threshold value of system trigger memory management mechanism operation is determined according to the numerical value of the target program committed memory;
Judge whether current residual memory is less than the threshold value;
If so, running memory administrative mechanism, and rule, the corresponding application program of killing, to release are discharged according to preset memory
Put the memory headroom that the application program occupies.
2. EMS memory management process as described in claim 1, which is characterized in that apply journey to each according to use priority described
Sequence is ranked up, and according to collating sequence obtain preset quantity application program as target program the step of before, comprising:
Obtain the use data of the application program and the application program that start in the first preset time, wherein described to use number
According to including login times, average operation duration and from least one of number for switching to foreground from the background;
According to the use priority for calculating the application program using data.
3. EMS memory management process as claimed in claim 2, which is characterized in that the calculation formula of the use priority are as follows:
P=c1×f1+c2×f2,
Wherein, P is the use priority of certain application program, c1For the weight of login times, f1For login times, c2For from from the background
Switch to the weight of the number on foreground, f2For from the number for switching to foreground from the background.
4. EMS memory management process as described in claim 1, which is characterized in that described according to the target program committed memory
Numerical value determines the step of threshold value of system trigger memory management mechanism operation, comprising:
Obtain the numerical value of each target program committed memory;
The numerical value is averaging, the average value of the target program committed memory is calculated;
The threshold value of system trigger memory management mechanism operation is determined according to the average value.
5. EMS memory management process as claimed in claim 4, which is characterized in that the calculating target program committed memory
The calculation formula of average value are as follows:
Wherein, A is the average value of target program committed memory, xnFor the numerical value of n-th of target program committed memory, n is target journey
The number of sequence, n are positive integer.
6. EMS memory management process as described in claim 1, which is characterized in that judge whether current residual memory is less than described
Before the step of threshold value, comprising:
The initial adj value of each application program in the second preset time is obtained by AMS.
7. EMS memory management process as claimed in claim 6, which is characterized in that it is described that rule is discharged according to preset memory, it looks into
The step of killing corresponding application program, comprising:
The initial adj value of each application program is adjusted according to the use priority, and using adj value adjusted as mesh
Mark adj value;
Killing selection target adj value is maximum since currently running application program, until free memory is more than the threshold
Value;Or
According to the corresponding relationship of preset target adj value and threshold value, the application journey of the corresponding target adj value of the threshold value will be above
The maximum beginning killing of EMS memory occupation in sequence, until free memory is more than the threshold value.
8. EMS memory management process as claimed in claim 6, which is characterized in that it is described that rule is discharged according to preset memory, it looks into
The step of killing corresponding application program, further includes:
Killing selecting initial adj value maximum since currently running application program, until free memory is more than the threshold
Value;Or
According to the corresponding relationship of preset initial adj value and threshold value, the application journey of the corresponding initial adj value of the threshold value will be above
The maximum beginning killing of EMS memory occupation in sequence, until free memory is more than the threshold value.
9. a kind of memory management terminal, which is characterized in that the memory management terminal includes: memory, processor and is stored in
On the memory and the storage management that can run on the processor, the storage management is by the processor
It is realized when execution as described in any one of claims 1 to 8 the step of EMS memory management process.
10. a kind of computer readable storage medium, is stored thereon with storage management, which is characterized in that the memory management
The EMS memory management process as described in any in claim 1 to 8 is realized when program is executed by processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910512893.0A CN110221921A (en) | 2019-06-13 | 2019-06-13 | EMS memory management process, terminal and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910512893.0A CN110221921A (en) | 2019-06-13 | 2019-06-13 | EMS memory management process, terminal and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110221921A true CN110221921A (en) | 2019-09-10 |
Family
ID=67816994
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910512893.0A Pending CN110221921A (en) | 2019-06-13 | 2019-06-13 | EMS memory management process, terminal and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110221921A (en) |
Cited By (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110673955A (en) * | 2019-09-20 | 2020-01-10 | 北京字节跳动网络技术有限公司 | Method, device, system, terminal and storage medium for optimizing memory |
CN111124668A (en) * | 2019-11-28 | 2020-05-08 | 宇龙计算机通信科技(深圳)有限公司 | Memory release method and device, storage medium and terminal |
CN111158910A (en) * | 2019-12-27 | 2020-05-15 | Oppo广东移动通信有限公司 | Memory management method and device, storage medium and electronic equipment |
CN111209114A (en) * | 2019-12-31 | 2020-05-29 | 深圳Tcl新技术有限公司 | System memory releasing method, device and storage medium |
CN111414254A (en) * | 2020-03-19 | 2020-07-14 | Oppo广东移动通信有限公司 | Device management method, device, storage medium and electronic device |
CN111666153A (en) * | 2020-05-25 | 2020-09-15 | 深圳Tcl新技术有限公司 | Cache task management method, terminal device and storage medium |
CN111880928A (en) * | 2020-07-06 | 2020-11-03 | Oppo广东移动通信有限公司 | Method for selecting process to release and terminal equipment |
CN112000470A (en) * | 2020-08-07 | 2020-11-27 | 杭州安恒信息技术股份有限公司 | Memory data processing method, system and device |
CN112685088A (en) * | 2019-10-17 | 2021-04-20 | 成都鼎桥通信技术有限公司 | Method, device and equipment for protecting application operation and readable storage medium |
CN112835689A (en) * | 2019-11-25 | 2021-05-25 | 航天信息股份有限公司 | Method and device for controlling application process |
CN113076193A (en) * | 2021-03-26 | 2021-07-06 | 北京车和家信息技术有限公司 | Memory optimization method and device and computer readable storage medium |
CN113127180A (en) * | 2019-12-30 | 2021-07-16 | 深圳Tcl新技术有限公司 | Memory optimization method, intelligent terminal and storage medium |
CN113407300A (en) * | 2021-05-21 | 2021-09-17 | 荣耀终端有限公司 | Application false killing evaluation method and related equipment |
CN113434288A (en) * | 2021-06-16 | 2021-09-24 | 荣耀终端有限公司 | Memory management method and electronic equipment |
WO2022037497A1 (en) * | 2020-08-18 | 2022-02-24 | 深圳市万普拉斯科技有限公司 | Call record data processing method and apparatus, and communication device and storage medium |
WO2022057754A1 (en) * | 2020-09-21 | 2022-03-24 | 华为技术有限公司 | Memory control method and device |
CN115048155A (en) * | 2022-08-11 | 2022-09-13 | 成都智暄科技有限责任公司 | Method and system for loading dynamic library, computer readable storage medium and device |
CN115437783A (en) * | 2022-08-17 | 2022-12-06 | 荣耀终端有限公司 | Searching and killing method, electronic equipment and readable storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109213539A (en) * | 2016-09-27 | 2019-01-15 | 华为技术有限公司 | A kind of method for recovering internal storage and device |
CN109656722A (en) * | 2019-01-04 | 2019-04-19 | Oppo广东移动通信有限公司 | Memory Optimize Method, device, mobile terminal and storage medium |
CN109857544A (en) * | 2018-12-27 | 2019-06-07 | 努比亚技术有限公司 | Resource reclaim control method, terminal and computer readable storage medium |
-
2019
- 2019-06-13 CN CN201910512893.0A patent/CN110221921A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109213539A (en) * | 2016-09-27 | 2019-01-15 | 华为技术有限公司 | A kind of method for recovering internal storage and device |
CN109857544A (en) * | 2018-12-27 | 2019-06-07 | 努比亚技术有限公司 | Resource reclaim control method, terminal and computer readable storage medium |
CN109656722A (en) * | 2019-01-04 | 2019-04-19 | Oppo广东移动通信有限公司 | Memory Optimize Method, device, mobile terminal and storage medium |
Cited By (26)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110673955A (en) * | 2019-09-20 | 2020-01-10 | 北京字节跳动网络技术有限公司 | Method, device, system, terminal and storage medium for optimizing memory |
CN110673955B (en) * | 2019-09-20 | 2022-07-12 | 北京字节跳动网络技术有限公司 | Method, device, system, terminal and storage medium for optimizing memory |
CN112685088A (en) * | 2019-10-17 | 2021-04-20 | 成都鼎桥通信技术有限公司 | Method, device and equipment for protecting application operation and readable storage medium |
CN112835689A (en) * | 2019-11-25 | 2021-05-25 | 航天信息股份有限公司 | Method and device for controlling application process |
CN111124668A (en) * | 2019-11-28 | 2020-05-08 | 宇龙计算机通信科技(深圳)有限公司 | Memory release method and device, storage medium and terminal |
CN111124668B (en) * | 2019-11-28 | 2023-09-15 | 宇龙计算机通信科技(深圳)有限公司 | Memory release method, memory release device, storage medium and terminal |
CN111158910A (en) * | 2019-12-27 | 2020-05-15 | Oppo广东移动通信有限公司 | Memory management method and device, storage medium and electronic equipment |
CN111158910B (en) * | 2019-12-27 | 2024-01-12 | Oppo广东移动通信有限公司 | Memory management method and device, storage medium and electronic equipment |
CN113127180A (en) * | 2019-12-30 | 2021-07-16 | 深圳Tcl新技术有限公司 | Memory optimization method, intelligent terminal and storage medium |
CN111209114A (en) * | 2019-12-31 | 2020-05-29 | 深圳Tcl新技术有限公司 | System memory releasing method, device and storage medium |
CN111414254A (en) * | 2020-03-19 | 2020-07-14 | Oppo广东移动通信有限公司 | Device management method, device, storage medium and electronic device |
CN111666153A (en) * | 2020-05-25 | 2020-09-15 | 深圳Tcl新技术有限公司 | Cache task management method, terminal device and storage medium |
CN111880928A (en) * | 2020-07-06 | 2020-11-03 | Oppo广东移动通信有限公司 | Method for selecting process to release and terminal equipment |
CN111880928B (en) * | 2020-07-06 | 2024-04-19 | Oppo广东移动通信有限公司 | Method for releasing selection process and terminal equipment |
CN112000470A (en) * | 2020-08-07 | 2020-11-27 | 杭州安恒信息技术股份有限公司 | Memory data processing method, system and device |
CN112000470B (en) * | 2020-08-07 | 2024-04-09 | 杭州安恒信息技术股份有限公司 | Memory data processing method, system and device |
WO2022037497A1 (en) * | 2020-08-18 | 2022-02-24 | 深圳市万普拉斯科技有限公司 | Call record data processing method and apparatus, and communication device and storage medium |
WO2022057754A1 (en) * | 2020-09-21 | 2022-03-24 | 华为技术有限公司 | Memory control method and device |
CN113076193B (en) * | 2021-03-26 | 2024-03-26 | 北京车和家信息技术有限公司 | Memory optimization method, device and computer readable storage medium |
CN113076193A (en) * | 2021-03-26 | 2021-07-06 | 北京车和家信息技术有限公司 | Memory optimization method and device and computer readable storage medium |
CN113407300A (en) * | 2021-05-21 | 2021-09-17 | 荣耀终端有限公司 | Application false killing evaluation method and related equipment |
EP4145286A4 (en) * | 2021-06-16 | 2023-11-15 | Honor Device Co., Ltd. | Memory management method and electronic device |
CN113434288A (en) * | 2021-06-16 | 2021-09-24 | 荣耀终端有限公司 | Memory management method and electronic equipment |
CN115048155A (en) * | 2022-08-11 | 2022-09-13 | 成都智暄科技有限责任公司 | Method and system for loading dynamic library, computer readable storage medium and device |
CN115437783B (en) * | 2022-08-17 | 2023-08-04 | 荣耀终端有限公司 | Searching and killing method, electronic equipment and readable storage medium |
CN115437783A (en) * | 2022-08-17 | 2022-12-06 | 荣耀终端有限公司 | Searching and killing method, electronic equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110221921A (en) | EMS memory management process, terminal and computer readable storage medium | |
CN109213539B (en) | Memory recovery method and device | |
US20210389973A1 (en) | Electronic device and method for operating the same | |
US20160062423A1 (en) | Method for managing heat generation in electronic device and electronic device therefor | |
CN109388220A (en) | A kind of method for managing power supply and mobile terminal | |
CN106776036A (en) | A kind of resource allocation methods and device | |
KR102642689B1 (en) | Electronic Apparatus and the Method for Controlling Traffic thereof | |
CN106293445A (en) | Application program uses the acquisition methods of data, device and terminal unit | |
CN103164269A (en) | Method and terminal achieving multi-window display of application programs | |
CN107463437B (en) | Application control method and device, storage medium and electronic equipment | |
CN107943372A (en) | A kind of interface display method, device and computer-readable recording medium | |
CN107450709B (en) | Application processing method, device, storage medium and electronic equipment | |
CN109614176A (en) | A kind of application interface layout method, terminal and computer readable storage medium | |
CN109521925A (en) | Icon arrangement method, mobile terminal and computer readable storage medium | |
CN107402808B (en) | Process management method, device, storage medium and electronic equipment | |
CN108205408A (en) | Message display method and device | |
CN109743724A (en) | A kind of management method and mobile terminal of embedded SIM card | |
CN109548117A (en) | A kind of network selecting method and mobile terminal | |
CN108052390A (en) | Memory method for cleaning, mobile terminal and readable storage medium storing program for executing based on thread block | |
CN108449404A (en) | Reporting terminal information approach, terminal, concentrator and computer readable storage medium | |
CN108959064A (en) | The pop-up processing method and processing device of automatic test | |
CN108696445A (en) | Flow control methods, mobile terminal and computer readable storage medium | |
CN109408080A (en) | A kind of method and terminal of application upgrade | |
CN107967177A (en) | Memory Optimize Method, mobile terminal and readable storage medium storing program for executing based on kernel process | |
CN110032439A (en) | Method for managing resource, device, mobile terminal and computer readable storage medium |
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 |