CN110175075A - Android system Memory Optimize Method and device - Google Patents

Android system Memory Optimize Method and device Download PDF

Info

Publication number
CN110175075A
CN110175075A CN201910425845.8A CN201910425845A CN110175075A CN 110175075 A CN110175075 A CN 110175075A CN 201910425845 A CN201910425845 A CN 201910425845A CN 110175075 A CN110175075 A CN 110175075A
Authority
CN
China
Prior art keywords
memory
heap
zram
size
android
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910425845.8A
Other languages
Chinese (zh)
Inventor
黄鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Junhe Ruitong Technology Co Ltd
Original Assignee
Shenzhen Junhe Ruitong Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Junhe Ruitong Technology Co Ltd filed Critical Shenzhen Junhe Ruitong Technology Co Ltd
Priority to CN201910425845.8A priority Critical patent/CN110175075A/en
Publication of CN110175075A publication Critical patent/CN110175075A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5055Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering software capabilities, i.e. software resources associated or available to the machine

Abstract

The present invention provides a kind of Android system Memory Optimize Methods, the Android system Memory Optimize Method includes the following steps, the heap memory parameter of Android virtual machine is set, and the heap memory parameter includes the limit heap size under the initial size of Heap Allocation, controlled case, the limit heap size in uncontrolled situation, recycling memory maximum value and recycling memory minimum value;The size of ZRAM is arranged between 150-170M;A monitoring service is opened, the utilization rate of ZRAM is monitored, when the utilization rate for monitoring ZRAM is greater than preset value, monitoring service kills background process, retains foreground process and system process, and record foreground process this moment;System is gone out after screen, and monitoring service again kills the foreground process recorded.The present invention, which realizes Android-64 systems, to guarantee that application program severe can use in 512M memory in 512M memory in the case where smooth operation.

Description

Android system Memory Optimize Method and device
Technical field
The present invention relates to a kind of Memory Optimize Method and device, a kind of Android system Memory Optimize Method and dress are referred in particular to It sets.
Background technique
Android-64 system needs of the prior art are run in the memory environment of 1G, cause hardware cost height, It is not dominant in current fierce market competition.The cost declining from hardware is the necessary means for improving product competitiveness.In 512M Android-64 systems are run in memory is the important measures of hardware cost declining, but Android-64 systems to be made to exist Smoothness is run in 512M memory, needs to optimize Android system memory.
Summary of the invention
The technical problems to be solved by the present invention are: providing a kind of Android system Memory Optimize Method and device, it is intended to real Existing Android-64 systems can guarantee that application program can be in 512M memory in 512M memory in the case where smooth operation Middle severe uses.
In order to solve the above-mentioned technical problem, the technical solution adopted by the present invention are as follows: a kind of Android system Memory Optimize Method, The Android system Memory Optimize Method includes the following steps,
S10, be arranged Android virtual machine heap memory parameter, the heap memory parameter include Heap Allocation initial size, by The limit heap size under limit heap size, uncontrolled situation, recycling memory maximum value and recycling memory minimum value in the case of control;
S20, the size of ZRAM is arranged between 150-170M;
S30, a monitoring service is opened, the utilization rate of ZRAM is monitored, when the utilization rate for monitoring ZRAM is greater than When preset value, monitoring service kills background process, retains foreground process and system process, and record foreground this moment into Journey;
S40, system are gone out after screen, and monitoring service again kills the foreground process recorded.
Further, the step S10 is specifically included,
The initial value of Heap Allocation is set as 8M, the limit heap under controlled case is sized to 54M, the pole in uncontrolled situation Limit heap is sized to 64M, and recycling memory maximum value is set as 2M, and recycling memory minimum value is set as 512K.
Further, in the step S30, when the utilization rate for monitoring ZRAM is greater than 90%, monitoring service will backstage Process kills, and retains foreground process and system process.
Further, in the step S20, the size of ZRAM is arranged in 160M.
In order to solve the above-mentioned technical problem, another technical solution used in the present invention are as follows: a kind of Android system memory is excellent Makeup is set, and the Android system internal memory optimization device includes,
Heap memory parameter setting module, for the heap memory parameter of Android virtual machine to be arranged, the heap memory parameter includes The initial size of Heap Allocation, the limit heap size under controlled case, the limit heap size in uncontrolled situation, recycling memory are maximum Value and recycling memory minimum value;
ZRAM setup module, for being arranged the size of ZRAM between 150-170M;
Background process management module is monitored the utilization rate of ZRAM, for opening a monitoring service when monitoring When the utilization rate of ZRAM is greater than preset value, monitoring service kills background process, retains foreground process and system process, and record Under foreground process this moment;
Foreground process management module is gone out after screen for system, and monitoring service again kills the foreground process recorded.
Further, the heap memory parameter setting module is specifically used for,
The initial value of Heap Allocation is set as 8M, the limit heap under controlled case is sized to 54M, the pole in uncontrolled situation Limit heap is sized to 64M, and recycling memory maximum value is set as 2M, and recycling memory minimum value is set as 512K.
Further, the background process management module is also used to when the utilization rate for monitoring ZRAM is greater than 90%, prison Control service kills background process, retains foreground process and system process.
Further, the ZRAM setup module is also used to for the size of ZRAM being arranged in 160M.
The technical effects of the invention are that: the heap memory parameter of setting Android virtual machine, so that the memory of application is limited System guarantees that Android system smooth on the memory of 512M can be run, by the size setting of ZRAM between 150-170M, so that Application program can be run glibly;By opening a monitoring service, the size of ZRAM is monitored, when monitoring ZRAM Utilization rate when being greater than preset value, monitoring service kills background process, retains foreground process and system process, and record this The foreground process at quarter allows the application to carry out severe use in the Android device of 512M memory;It goes out screen in system Afterwards, monitoring service again kills the foreground process recorded, so that system power consumption is less;Use the memory of 512M, Neng Gouyou Effect reduces hardware cost.
Detailed description of the invention
Specific structure of the invention is described in detail with reference to the accompanying drawing.
Fig. 1 is the Android system Memory Optimize Method flow chart of a specific embodiment of the invention;
Fig. 2 is the Android system internal memory optimization apparatus module block diagram of a specific embodiment of the invention.
Specific embodiment
In order to describe the technical content, the structural feature, the achieved object and the effect of this invention in detail, below in conjunction with embodiment And attached drawing is cooperated to be explained in detail.
As shown in Figure 1, a specific embodiment of the invention are as follows: a kind of Android system Memory Optimize Method, the Android system System Memory Optimize Method include the following steps,
S10, be arranged Android virtual machine heap memory parameter, the heap memory parameter include Heap Allocation initial size, by The limit heap size under limit heap size, uncontrolled situation, recycling memory maximum value and recycling memory minimum value in the case of control;
S20, the size of ZRAM is arranged between 150-170M;
S30, a monitoring service is opened, the utilization rate of ZRAM is monitored, when the utilization rate for monitoring ZRAM is greater than When preset value, monitoring service kills background process, retains foreground process and system process, and record foreground this moment into Journey;
S40, system are gone out after screen, and monitoring service again kills the foreground process recorded.
Preferably, the step S10 is specifically included,
The initial value of Heap Allocation is set as 8M, the limit heap under controlled case is sized to 54M, the pole in uncontrolled situation Limit heap is sized to 64M, and recycling memory maximum value is set as 2M, and recycling memory minimum value is set as 512K.
Preferably, in the step S30, when monitor ZRAM utilization rate be greater than 90% when, monitoring service will backstage into Journey kills, and retains foreground process and system process.
Preferably, in the step S20, the size of ZRAM is arranged in 160M.
In the present embodiment, realize that Android-64 systems being capable of the smooth operation in 512M memory;On the basis of above Realize specific application smooth operation in 512M memory;Guarantee that specific application can be in 512M memory the case where severe uses Smoothness operation.
One, realize that Android-64 systems being capable of the smooth operation in 512M memory
Android-64 systems target of smooth operation in 512M memory is allowed to be exactly that the system core of Android is allowed to take Business and relevant JAVA application can be run.Due to related to JAVA, so the dalvik for needing to be arranged android system is virtual The relevant parameter of machine.
1, the relative theory of Android memory management:
1) android system realizes shared drive by following several ways:
Android application process be all be called from one Zygote process fork come out.Zygote process is being System starting, and be loaded into general framework code and resource later start to start.In order to start a new program into Journey, system meeting fork Zygote process generate a new process, then load in new process and run application program Code.This allows for most of RAM pages and is used to distribute to the code of framework, while promoting RAM resource can It is shared between all processes of application.
The data of most of static are by mmapped a to process.This not only allow same data can into It is shared, and is allowed it to when needed by paged out between journey.Common static data include Dalvik Code, app resources, so file etc..
In most cases, Android by explicit distribution shared drive region (such as: ashmem or gralloc) To realize that dynamic ram region can carry out shared mechanism between different processes.For example, Window Surface App with Using shared memory between Screen Compositor, Cursor Buffers is in Content Provider and Clients Between shared drive.
2) distribution and recycling memory:
The Dalvik Heap of each process reflects the occupancy range using memory.Here it is usual logical meanings On the Dalvik Heap Size that mentions, it can be with being increased, but it is it that growth behavior, which has a system, Set the upper limit.
The memory size used in Heap Size logically and actual physical meaning be it is not reciprocity, Proportional Set Size (PSS) has recorded application program itself and occupies and carry out shared memory with other processes.
Android system can't do defragmentation to region of memory idle in Heap.System only can be in new memory Judge whether the tail end remaining space of Heap is enough before distribution, if space can not enough trigger GC operation, to vacate more Idle memory headroom.There is a Generational Heap for the space Heap inside the advanced system version of Android The model of Memory, the object distributed recently can be stored in the region Young Generation.When this object stops in the region The time stayed reaches a certain level, it can be moved to Old Generation, finally accumulates certain time and moves again to The region Permanent Generation.System can execute respectively different GC behaviour according to memory datatype different in memory Make.
3) memory of limitation application:
In order to which the Memory control of whole system needs, android system is that a hardness is arranged in each application program Dalvik Heap Size maximum threshold limit, this threshold value can respectively have on different devices because RAM is of different sizes Difference.If your application committed memory space is already close to this threshold value, if reattempting storage allocation at this time, it is easy to draw Send out OutOfMemoryError mistake.
ActivityManager.getMemoryClass () can be used to inquire the Heap Size threshold value of current application, This method can return to an integer, show that the Heap Size threshold value of application is how many MB (Megabates).
4) application switching operates:
Android system can't execute exchange memory operation when user switches and applies.Android can be those Application process not comprising Foreground component is put into LRU Cache.For example, when user start starting one in application, System can create a process for it.But when user leaves this application, process will not be destroyed immediately, but is placed to system Cache in.If user switches back to this application again later, this process can completely be restored at once, thus Realize being switched fast for application.
If having a buffered process in your application, this process can occupy certain memory headroom, its meeting pair The overall performance of system has an impact.Therefore, when system initially enters the state of Low Memory, it can be by system according to LRU Rule and the priority of application, decide whether to be killed after the influence comprehensive assessments of EMS memory occupation situation and other factors Fall.
2, memory model when Android application operation:
Android it is primary exploitation based on Java, and java applet be all operate in it is on Java Virtual Machine (JVM) and Memory full powers give virtual machine and go to manage, and the run-time memory model of that virtual machine includes heap and stack, but this is thick to memory A kind of division slightly, wherein the Java heap of " heap " corresponding memory model;" stack " then refers to virtual machine stack, but actually Java is transported Memory model is more complicated mostly than this when row, and in the Java Virtual Machine specification that SUN is formulated, run-time memory model is divided into thread Private and shared data field two major classes, wherein the privately owned data field of thread includes program counter, virtual machine stack, nation method Area, the shared data field of all threads includes Java heap, (also known as static storage area, there are one normal in method area in method area Measure pond), the relevant parameter of setting Dalvik virtual machine Heap (heap) is the core for limiting Android application memory and using.
3, the important parameter of dalvik virtual machine Heap (heap):
1) dalvik.vm.heapstartsize, the initial size of Heap Allocation adjust the stream that this value influences whether application Smooth property and overall memory consumption.This value is smaller, and Installed System Memory consumption is slower, but since initial value is smaller, it is some biggish Using needing to expand this heap, to cause the strategy of garbage reclamation (GC) and heap adjustment, application response can be allowed slower.On the contrary, This value is bigger, and Installed System Memory consumption is faster, but program is more smooth.
2) dalvik.vm.heapgrowthlimit, the limit heap under controlled case (only for dalvik heap, do not wrap Include native heap) size, dalvik heap can increase, but the size of Dalvik Heap is will not to surpass under normal circumstances Cross the value of dalvik.vm.heapgrowthlimit.This value controls the limit heap size of those controlled applications, if controlled It is more than the value using Dalvik Heap Size, then will causes oom (out of memory).
3) dalvik.vm.heapsize, the limit heap size in uncontrolled situation, this is exactly the maximum value of heap.Regardless of It is controlled.This value will affect the Dalvik Heap Size of uncontrolled application.Once Dalvik Heap Size More than this value, directly initiation oom (out of memory).
4) dalvik.vm.heapmaxfree has an impact to the frequency of virtual machine garbage reclamation.
4, by largely testing, in the case where 512M memory, the virtual machine parameter of Android-64 systems is as follows:
[dalvik_512m]
Dalvik.vm.heapsize=64m;
Dalvik.vm.heapstartsize=8m;
Dalvik.vm.heaptargetutilization=0.85;
Dalvik.vm.heapminfree=512k;
Dalvik.vm.heapmaxfree=2m;
Dalvik.vm.heapgrowthlimit=54m;
Dalvik.vm.dex2oat-flags=--no-watch-dog;
Dalvik.vm.jit.codecachesize=0;
Two, specific application smooth operation in 512M memory is realized
Major measure is: the size of zRAM is arranged
1, relative theory:
Android system is the operating system based on Linux platform, and Android application essence is to operate in Linux user The program in space is generally divided into code segment, file resource and data segment in memory.For Linux, code segment and text Memory pages where part resource are referred to as the page for having background document, and the memory pages where data segment are referred to as no file The page of background, also referred to as anonymous page.
When memory anxiety, Linux can abandon the page of application code section, the related pages of file resource It is written back into storage equipment and recycles the page, the relevant anonymous page of data segment enters exchange partition (Swap Partition) and discharges Memory.Exchange partition has different existing ways in different equipment.In computer, exchange partition is exactly one section on hard disk Region;On the mobile phone and plate of android system, exchange partition is then a panel region of memory, this region of memory is referred to as For zram.
Zram (also referred to as ZRAM is formerly known as compcache) is a Xiang Gongneng of linux kernel, it is possible to provide in virtual Deposit compression.Zram is by paging on the compression block device in RAM, until the swapace on hard disk must be used, to avoid Paging is carried out on disk, to improve performance.Swapace is provided since zram can substitute hard disk with memory for system Function, zram can allow Linux more preferably to utilize RAM when needing exchange/paging, on the less old computer of physical memory especially So.
Zram is still conducive to embedded device, net book and other similar low-level hardware equipment.These equipment usually make With solid-state storage, their restricted lifetimes due to its intrinsic property, thus avoids providing swapace with it and can prevent it rapidly Abrasion.In addition, can also be significantly reduced using zRAM linux system for exchange I/O.
2, zram is configured:
1) linux kernel is configured;
It needs to configure in the config file of kernel:
CONFIG_SWAP
CONFIG_CGROUP_MEM_RES_CTLR
CONFIG_CGROUP_MEM_RES_CTLR_SWAP
CONFIG_ZRAM
2) it is modified in fstab. [project_name] file;
/ dev/block/zram0none swap defaults zramsize=167772160;
3) it is added in init. [project_name] .rc file
on early-fs
swapon_all/fstab.[project_name]
3, test verifying:
By largely testing, 160M is arranged in the size of zram, specific application can behave glibly.
Three, guarantee that specific application being capable of the smooth operation in 512M memory the case where severe uses
(1) android system LowMemoryKiller mechanism
Such as the following table 1, each process of user's space corresponds to an oom_adj, oom_adj in android system 16 grades are divided into, value from -17 to 16.Adj value is bigger, and priority is lower, and the process of adj < 0 is all system process.
Table 1:
The parameter of the Android device LowMemoryKiller of 512M memory is as follows:
Table 2:
oom_adj oom_score_adj Free memory
15 1000 141M
9 529 104M
3 176 68M
2 117 54M
1 58 43M
0 0 8M
Shown in table 2 as above, method lowmem_oom_adj_to_oom_ is passed through for oom_adj and oom_score_adj Score_adj () foundation has certain mapping relations:
Work as oom_adj=15, then oom_score_adj=1000;
When oom_adj < 15, then oom_score_adj=oom_adj*1000/17;
According to upper table 2, it will thus be seen that
As memory residue 141M, system can kill oom_adj >=15 process;
As memory residue 104M, system can kill oom_adj >=9 process;
As memory residue 68M, system can kill oom_adj >=3 process;
As memory residue 54M, system can kill oom_adj >=2 process;
As memory residue 43M, system can kill oom_adj >=1 process;
As memory residue 8M, system can kill oom_adj >=0 process.
It can be seen that:
The general 3 class process of 1.Android system administration:
1) system process (process of oom_adj < 0), system process cannot kill, and killing system process will lead to whole system Restart;
2) foreground process (process of oom_adj=0), foreground process are usually user's application currently in use;
3) background process (process of oom_adj > 0), kills background process, and user can not perceive
2.oom_adj is dynamic change
For example user is playing wechat, then the oom_adj of wechat is just 0 at this time;User is not desired to play wechat, runs to see Top news, then top-line oom_adj is just 0, the oom_adj of wechat is greater than 0.
(2) to the supplement of LowMemorykiller
It, can will temporarily not in specific application by severe in use, android system can operate normally for specific application The anonymous page used is recycled into zram, zram can reach the upper limit at leisure.If specific application continues severe use at this time, we It can find that zram has exhausted, whole system performance sharply declines.
Have a very interesting phenomenon at this time, it is remaining it is interior there are 100M or more, do not reach triggering android system LowMemoryKiller kills oom_adj >=1 process condition.So needing a new mechanism by memory from zram It releases.
It is found by a large number of experiments, when zram exhausts, we kill the process for occupying zram, and release process is occupied The space of zram.As long as the recycling that zram has enough spaces to carry out anonymous page, system can operate normally.
Then we according to the actual situation, have formulated following strategy:
A new service is opened in system process (system_server), which monitors the use of zram in real time Situation.
1, when the utilization rate of ZRAM be greater than 90%, actually need to kill foreground and background process in addition to system process. But foreground process at this time cannot kill, because user is used.So background process can only be killed at this time, and Record foreground process this moment.
2, after system goes out screen, illustrate user without using terminal equipment.If the foreground recorded in 1 into Journey has arrived backstage, then monitoring service can directly kill the process;If the foreground process recorded in 1 is still preceding Specific Android desktop (Launcher) can be switched to foreground by platform, monitoring service, then by the foreground process recorded in 1 (by In Android desktop on foreground, which is not foreground process at this time) it kills.
(3) test verifying
By largely automating pressure test, specific application can carry out severe in the Android device of 512M memory It uses.
As shown in Fig. 2, another specific embodiment of the invention are as follows: a kind of Android system internal memory optimization device, the Android Installed System Memory optimizes device,
Heap memory parameter setting module, for the heap memory parameter of Android virtual machine to be arranged, the heap memory parameter includes The initial size of Heap Allocation, the limit heap size under controlled case, the limit heap size in uncontrolled situation, recycling memory are maximum Value and recycling memory minimum value;
ZRAM setup module, for being arranged the size of ZRAM between 150-170M;
Background process management module is monitored the utilization rate of ZRAM, for opening a monitoring service when monitoring When the utilization rate of ZRAM is greater than preset value, monitoring service kills background process, retains foreground process and system process, and record Under foreground process this moment;
Foreground process management module is gone out after screen for system, and monitoring service again kills the foreground process recorded.
Preferably, the heap memory parameter setting module is specifically used for,
The initial value of Heap Allocation is set as 8M, the limit heap under controlled case is sized to 54M, the pole in uncontrolled situation Limit heap is sized to 64M, and recycling memory maximum value is set as 2M, and recycling memory minimum value is set as 512K.
Preferably, the background process management module is also used to the monitoring when the utilization rate for monitoring ZRAM is greater than 90% Service kills background process, retains foreground process and system process.
Preferably, the ZRAM setup module is also used to for the size of ZRAM being arranged in 160M.
The device of the invention embodiment includes the full content of embodiment of the method, has technology identical with embodiment of the method Effect, therefore no longer this is repeated.
In conclusion the technical effects of the invention are that: the heap memory parameter of setting Android virtual machine, so that application is interior It deposits and is limited, guarantee that Android system smooth on the memory of 512M can be run, the size of ZRAM is arranged in 150-170M Between, it is preferable that the size of ZRAM is arranged in 160M, allows the application to run glibly;By opening a prison Control service, the size of ZRAM is monitored, when monitor ZRAM utilization rate be greater than preset value when, monitoring service will backstage into Journey kills, and retains foreground process and system process, and record foreground process this moment, allows the application in 512M Severe use is carried out in the Android device deposited;After system goes out screen, monitoring service again kills the foreground process recorded, So that system power consumption is less;Using the memory of 512M, hardware cost can be effectively reduced.
Herein first, second ... only represents the differentiation of its title, not representing their significance level and position has what It is different.
Herein, up, down, left, right, before and after only represents its relative position without indicating its absolute position.
The above description is only an 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 (8)

1. a kind of Android system Memory Optimize Method, it is characterised in that: the Android system Memory Optimize Method includes following step Suddenly,
S10, the heap memory parameter that Android virtual machine is arranged, the heap memory parameter includes the initial size of Heap Allocation, controlled feelings The limit heap size under limit heap size, uncontrolled situation, recycling memory maximum value and recycling memory minimum value under condition;
S20, the size of ZRAM is arranged between 150-170M;
S30, a monitoring service is opened, the utilization rate of ZRAM is monitored, preset when the utilization rate for monitoring ZRAM is greater than When value, monitoring service kills background process, retains foreground process and system process, and record foreground process this moment;
S40, system are gone out after screen, and monitoring service again kills the foreground process recorded.
2. Android system Memory Optimize Method as described in claim 1, it is characterised in that: the step S10 is specifically included,
The initial value of Heap Allocation is set as 8M, the limit heap under controlled case is sized to 54M, the limit heap in uncontrolled situation It is sized to 64M, recycling memory maximum value is set as 2M, and recycling memory minimum value is set as 512K.
3. Android system Memory Optimize Method as described in claim 1, it is characterised in that: in the step S30, when monitoring When the utilization rate of ZRAM is greater than 90%, monitoring service kills background process, retains foreground process and system process.
4. Android system Memory Optimize Method as described in claim 1, it is characterised in that: in the step S20, by ZRAM's Size is arranged in 160M.
5. a kind of Android system internal memory optimization device, it is characterised in that: the Android system internal memory optimization device includes,
Heap memory parameter setting module, for the heap memory parameter of Android virtual machine to be arranged, the heap memory parameter includes heap point The initial size matched, the limit heap size under controlled case, the limit heap size in uncontrolled situation, recycling memory maximum value and Recycle memory minimum value;
ZRAM setup module, for being arranged the size of ZRAM between 150-170M;
Background process management module is monitored the utilization rate of ZRAM, for opening a monitoring service when monitoring ZRAM Utilization rate when being greater than preset value, monitoring service kills background process, retains foreground process and system process, and record this The foreground process at quarter;
Foreground process management module is gone out after screen for system, and monitoring service again kills the foreground process recorded.
6. Android system internal memory optimization device as claimed in claim 5, it is characterised in that: the heap memory parameter setting module It is specifically used for,
The initial value of Heap Allocation is set as 8M, the limit heap under controlled case is sized to 54M, the limit heap in uncontrolled situation It is sized to 64M, recycling memory maximum value is set as 2M, and recycling memory minimum value is set as 512K.
7. Android system internal memory optimization device as claimed in claim 5, it is characterised in that: the background process management module, It is also used to when the utilization rate for monitoring ZRAM is greater than 90%, monitoring service kills background process, retains foreground process and is System process.
8. Android system internal memory optimization device as claimed in claim 5, it is characterised in that: the ZRAM setup module is also used It is arranged in by the size of ZRAM in 160M.
CN201910425845.8A 2019-05-21 2019-05-21 Android system Memory Optimize Method and device Pending CN110175075A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910425845.8A CN110175075A (en) 2019-05-21 2019-05-21 Android system Memory Optimize Method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910425845.8A CN110175075A (en) 2019-05-21 2019-05-21 Android system Memory Optimize Method and device

Publications (1)

Publication Number Publication Date
CN110175075A true CN110175075A (en) 2019-08-27

Family

ID=67691801

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910425845.8A Pending CN110175075A (en) 2019-05-21 2019-05-21 Android system Memory Optimize Method and device

Country Status (1)

Country Link
CN (1) CN110175075A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110908771A (en) * 2019-11-14 2020-03-24 杭州趣链科技有限公司 Memory management method of intelligent contract based on JAVA
CN113626203A (en) * 2021-08-27 2021-11-09 广东九联科技股份有限公司 Memory environment real-time optimization method and system for android system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140108700A1 (en) * 2012-10-11 2014-04-17 Industrial Technology Research Institute Method and computer system for memory management on virtual machine
CN104503740A (en) * 2014-12-01 2015-04-08 小米科技有限责任公司 Memory management method and device
CN107912063A (en) * 2016-04-27 2018-04-13 华为技术有限公司 A kind of method for recovering internal storage and device
CN109313604A (en) * 2016-06-27 2019-02-05 英特尔公司 Compress the dynamic configuration of virtual memory

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140108700A1 (en) * 2012-10-11 2014-04-17 Industrial Technology Research Institute Method and computer system for memory management on virtual machine
CN104503740A (en) * 2014-12-01 2015-04-08 小米科技有限责任公司 Memory management method and device
CN107912063A (en) * 2016-04-27 2018-04-13 华为技术有限公司 A kind of method for recovering internal storage and device
CN109313604A (en) * 2016-06-27 2019-02-05 英特尔公司 Compress the dynamic configuration of virtual memory

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
坐在云端看灰机: "通过调节虚拟堆大小提升运行效率", 《HTTP://WWW.APPCHINA.COM/GROUP/COMMENT/2446750/1》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110908771A (en) * 2019-11-14 2020-03-24 杭州趣链科技有限公司 Memory management method of intelligent contract based on JAVA
CN113626203A (en) * 2021-08-27 2021-11-09 广东九联科技股份有限公司 Memory environment real-time optimization method and system for android system
CN113626203B (en) * 2021-08-27 2024-02-13 广东九联科技股份有限公司 Memory environment real-time optimization method and system for android system

Similar Documents

Publication Publication Date Title
CN101971146B (en) System and method to improve memory usage in virtual machines running as hypervisor guests
CN103092678B (en) A kind of many incremental virtual machine internal storage management system and method
US9256532B2 (en) Method and computer system for memory management on virtual machine
JP3933027B2 (en) Cache memory partition management method in disk array system
JP6138774B2 (en) Computer-implemented method and computer system
CN101763226B (en) Cache method for virtual storage devices
DE112012000635T5 (en) Dynamic storage management in a virtualized computing environment
CN102222014A (en) Dynamic memory management system based on memory hot plug for virtual machine
WO2021072716A1 (en) Memory management method and apparatus, electronic device and computer-readable medium
CN102193814A (en) Method and system for dynamically distributing embedded virtual memory
CN104583979A (en) Techniques for dynamic physical memory partitioning
CN104679594B (en) A kind of middleware distributed computing method
JP2014517434A (en) Computer-implemented method and computer system
CN110175075A (en) Android system Memory Optimize Method and device
CA2810782A1 (en) Managing memory across a network of cloned virtual machines
US20110087901A1 (en) Fast speed computer system power-on &amp; power-off method
US20160062691A1 (en) Method for controlling memory device to achieve more power saving and related apparatus thereof
CN113778662B (en) Memory recovery method and device
JP2014523022A (en) Computer-implemented method and computer system
Min et al. Vmmb: Virtual machine memory balancing for unmodified operating systems
CN114207571A (en) Computing device and method of operating the same
TWI399637B (en) Fast switch machine method
Cao et al. Dynamic and transparent memory sharing for accelerating big data analytics workloads in virtualized cloud
CN111522659B (en) Space use method and device
CN110109677B (en) Dynamic object cache pool allocation method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20190827

RJ01 Rejection of invention patent application after publication