android onLowMemory

ActivityThread.collectComponentCallbacksLocked 收集onLowMemory


ActivityThread.handleLowMemory
  ActivityThread.h.handleMessage (LOW_MEMORY)
    ActivityThread.scheduleLowMemory
      ActivityManagerService.performAppGcLocked
        ActivityManagerService.performAppGcsLocked
 ActivityManagerService.performAppGcsIfAppropriateLocked
   ActivityManagerService.mHandler.handleMessage (GC_BACKGROUND_PROCESSES_MSG)
     ActivityManagerService.scheduleAppGcsLocked

1, ActivityManagerService.appDiedLocked 
2, ActivityRecord.windowVisible
WindowManagerService.H.handleMessage (REPORT_APPLICATION_TOKEN_WINDOWS)

WindowManagerService.updateReportedVisibilityLocked

3, other ...


调用流程

com.david.bitmapapp.BitmapAppActivity.onLowMemory(BitmapAppActivity.java:66)
 android.app.ActivityThread.handleLowMemory(ActivityThread.java:4089)
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:2119)
 android.os.Handler.dispatchMessage(Handler.java:99)
 android.os.Looper.loop(Looper.java:123)
 android.app.ActivityThread.main(ActivityThread.java:4627)
 java.lang.reflect.Method.invokeNative(Native Method)
 java.lang.reflect.Method.invoke(Method.java:521)
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
 dalvik.system.NativeStart.main(Native Method)

 

备注:onLowMemory是在background process等可结束进程都结束后,当前进程才调用的。

例子:http://download.csdn.net/download/imyfriend/4110687

log:

04-10 03:06:44.844: I/ActivityManager(59): Process android.process.acore (pid 151) has died.
04-10 03:06:45.284: I/ActivityManager(59): Process com.android.alarmclock (pid 157) has died.
04-10 03:06:45.384: I/ActivityManager(59): Process com.android.settings (pid 135) has died.
04-10 03:06:46.634: I/ActivityManager(59): Process com.android.mms (pid 206) has died.
04-10 03:06:47.144: I/ActivityManager(59): Process com.android.email (pid 222) has died.
04-10 03:06:48.254: I/ActivityManager(59): Process com.android.protips (pid 185) has died.
04-10 03:06:48.574: I/ActivityManager(59): Process com.android.music (pid 169) has died.
04-10 03:06:48.974: I/ActivityManager(59): Process com.android.quicksearchbox (pid 176) has died.
04-10 03:06:54.224: I/ActivityManager(59): Process android.process.media (pid 194) has died.
04-10 03:06:55.064: I/ActivityManager(59): Process com.android.defcontainer (pid 258) has died.
04-10 03:06:55.414: I/ActivityManager(59): Process com.svox.pico (pid 268) has died.
04-10 03:06:55.424: I/ActivityManager(59): Low Memory: No more background processes.
04-10 03:06:56.344: I/ActivityManager(59): Process com.android.launcher (pid 118) has died.
04-10 03:06:56.543: I/WindowManager(59): WIN DEATH: Window{45065120 com.android.launcher/com.android.launcher2.Launcher paused=false}
04-10 03:06:56.754: I/ActivityManager(59): Low Memory: No more background processes.
04-10 03:07:06.164: D/skia(112): purging 6K from font cache [1 entries]
04-10 03:07:06.794: D/dalvikvm(112): GC_EXPLICIT freed 9133 objects / 438256 bytes in 414ms
04-10 03:07:10.869: I/BitmapAppActivity(284): SecondActivity.onLowMemory
04-10 03:07:10.869: I/BitmapAppActivity(284): BitmapAppActivity.onLowMemory
04-10 03:07:10.874: I/BitmapAppActivity(284): BitmapApplication.onLowMemory
04-10 03:07:10.907: D/skia(284): purging 50K from font cache [6 entries]
04-10 03:07:11.096: D/dalvikvm(284): GC_EXPLICIT freed 2142 objects / 120200 bytes in 181ms
04-10 03:07:15.886: D/skia(59): purging 302K from font cache [26 entries]
04-10 03:07:16.025: D/dalvikvm(59): GC_EXPLICIT freed 19727 objects / 832480 bytes in 132ms


参考:http://www.apkbus.com/android-20374-1-1.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值