大贤者
精华
|
战斗力 鹅
|
回帖 0
注册时间 2007-11-24
|
AutoKiller Memory Optimizer 的网站上有对安卓的Linux核心退出机制的介绍,作者认为“比市场上任何一款进程管理都智能得多”(it is much smarter than any of the taskkillers we see in the Market)
http://andrs.w3pla.net/autokiller/details
简单说就是安卓会有一个LRU(最近使用)列表,并且关闭其中最旧的无用进程
(As far as I understood android keeps a LRU (last recently used) list and starts killing the oldest unneeded process.)
系统会给每个应用设置oom_adj值 (out of memory 内存不足),当前活动应用是0,一旦切出就开始增大。
当内存低于某个阈值时,就会自动清除大于某个oom_adj值的某类应用,来释放内存。
其对应用类型做如下分类FOREGROUND_APP:
// This is the process running the current foreground app. We'd really
// rather not kill it! Value set in system/rootdir/init.rc on startup.
VISIBLE_APP:
// This is a process only hosting activities that are visible to the
// user, so we'd prefer they don't disappear. Value set in
// system/rootdir/init.rc on startup.
SECONDARY_SERVER:
// This is a process holding a secondary server -- killing it will not
// have much of an impact as far as the user is concerned. Value set in
// system/rootdir/init.rc on startup.
HIDDEN_APP:
// This is a process only hosting activities that are not visible,
// so it can be killed without any disruption. Value set in
// system/rootdir/init.rc on startup.
CONTENT_PROVIDER:
// This is a process with a content provider that does not have any clients
// attached to it. If it did have any clients, its adjustment would be the
// one for the highest-priority of those processes.
EMPTY_APP:
// This is a process without anything currently running in it. Definitely
// the first to go! Value set in system/rootdir/init.rc on startup.
// This value is initalized in the constructor, careful when refering to
// this static variable externally.
AutoKiller 的功能就是让用户自己调整设定值,我也刚上手不久 |
|