Wednesday, May 23, 2012

Android Low Memory Killer

http://www.androidcentral.com/multitasking-htc-one-x-isnt-broken-its-customized
http://blog.sina.com.cn/s/blog_4d66a3cb0100prfe.html
http://loda.hala01.com/2011/01/android%E7%AD%86%E8%A8%98/
http://www.drakaz.com/2010/04/30/android-memory-thresholds/


/sys/module/lowmemorykiller/parameters/adj
/sys/module/lowmemorykiller/parameters/minfree



Lowmeme_adj中各项数值代表阈值的警戒级数,lowmem_minfree代表对应级数的剩余内存。
也就是说,当系统的剩余内存为小于6MB时候,警戒级数为0,当系统内存剩余小于8M而大于
6M的时候,警戒级数为1,当内存小于64M大于16MB的时候,警戒级数为12.
Low memory killer 的规则就是根据当前系统的剩余内存多少来获取当前的警戒级数,如果进程的oom_adj大于警戒级数并且最大,进程将会被杀死(相同omm_adj的,则杀死占用内存较多的)。Omm_adj越小,代表进程越重要。一些前台的进程,oom_adj会比较小,而后台的服务,omm_adj会比较大,所以当内存不足的时候,Low memory killer 杀掉的必然先杀掉的是后台服务而不是前台的进程。


Thresholds

FOREGROUND_APP_MEM : below this threshold, internal task killer will kill foreground applications
VISIBLE_APP_MEM : belowthis threshold, internal task killer will kill second plan applications
SECONDARY_SERVER_MEM : below this thresholds, internal task killer will kill daemon applications
HOME_APP_MEM : below this thresholds, internal task killer will kill the home
HIDDEN_APP_MEM : below this thresholds, internal task killer will kill unvisible applications
CONTENT_PROVIDER_MEM : below this thresholds, internal task killer will kill unvisible content provider
EMPTY_APP_MEM : below this thresholds, internal task killer will kill ghosts application

[Note] lmk

No comments:

Related Posts Plugin for WordPress, Blogger...