2011-04-20 53 views
1

這是我的問題,如果我想操作系統來處理屏幕旋轉,我的堆棧跟蹤告訴我在兩三次旋轉後內存不足,然後應用程序崩潰,沒有任何異常或任何真正的痕跡。顯然,我的記憶力不足,但我不知道泄漏的位置。我怎麼解決這個問題?應用程序啓動得很好,運行完美(並且很快),直到我旋轉它。我怎樣才能看到我的記憶被分配在哪裏?

任何建議或線索?

謝謝〜Aedon

107   WindowManager I Setting rotation to 0, animFlags=0 
    107   ActivityManager I Config changed: { scale=1.0 imsi=310/120 loc=en_US touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17 seq=167} 
    107    UsageStats I Unexpected resume of com.android.appion.arm.activities while already resumed in com.android.appion.arm.activities 
29574  AppionApplication I alive? [email protected] 
29574    dalvikvm D GC_EXTERNAL_ALLOC freed 347 objects/20712 bytes in 101ms 
    107  WimaxStateTracker D GetAvailableMs 
    107    dalvikvm D GC_EXPLICIT freed 11672 objects/643080 bytes in 123ms 
    107  WimaxStateTracker D GetAvailableMs 
    107   WindowManager I Setting rotation to 1, animFlags=0 
    107   ActivityManager I Config changed: { scale=1.0 imsi=310/120 loc=en_US touch=3 keys=1/1/2 nav=1/1 orien=2 layout=34 uiMode=17 seq=168} 
    107    UsageStats I Unexpected resume of com.android.appion.arm.activities while already resumed in com.android.appion.arm.activities 
29574  AppionApplication I alive? [email protected] 
29574    dalvikvm D GC_EXTERNAL_ALLOC freed 408 objects/21464 bytes in 84ms 
    107    dalvikvm D GC_EXTERNAL_ALLOC freed 488 objects/40864 bytes in 157ms 
    107    dalvikvm D GC_EXTERNAL_ALLOC freed 32 objects/1608 bytes in 142ms 
    107    dalvikvm D GC_EXPLICIT freed 242 objects/11288 bytes in 117ms 
    107   WindowManager I Setting rotation to 0, animFlags=0 
    107   ActivityManager I Config changed: { scale=1.0 imsi=310/120 loc=en_US touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17 seq=169} 
    107  WimaxStateTracker D GetAvailableMs 
    107    UsageStats I Unexpected resume of com.android.appion.arm.activities while already resumed in com.android.appion.arm.activities 
29574  AppionApplication I alive? [email protected] 
29574   dalvikvm-heap E 4320000-byte external allocation too large for this process. 
29574    dalvikvm E Out of memory: Heap Size=4867KB, Allocated=2497KB, Bitmap Size=15657KB 
29574   GraphicsJNI E VM won't let us allocate 4320000 bytes 
28665     DEBUG I *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 
28665     DEBUG I Build fingerprint: 'sprint/htc_supersonic/supersonic/supersonic:2.2/FRF91/294884:user/release-keys' 
28665     DEBUG I pid: 29574, tid: 29574 >>> com.android.appion.arm.activities <<< 
28665     DEBUG I signal 11 (SIGSEGV), fault addr 00000000 
28665     DEBUG I r0 002a7348 r1 00000000 r2 00000000 r3 002a736c 
28665     DEBUG I r4 002a7348 r5 00000000 r6 00000000 r7 00000000 
28665     DEBUG I r8 bee47130 r9 41873724 10 41873710 fp bee47478 
28665     DEBUG I ip 002a7348 sp bee46ef8 lr 00000000 pc ab14b0e4 cpsr 60000010 
28665     DEBUG I d0 6472656767756265 d1 6f6c6c6120737562 
28665     DEBUG I d2 6f6f74206e6f6979 d3 6620656772616c74 
28665     DEBUG I d4 0000000044610000 d5 4448000044610000 
28665     DEBUG I d6 3fc000003fc00000 d7 4080000080000000 
28665     DEBUG I d8 0000038444961000 d9 0000000000000000 
28665     DEBUG I d10 0000000000000000 d11 0000000000000000 
28665     DEBUG I d12 0000000000000000 d13 0000000000000000 
28665     DEBUG I d14 0000000000000000 d15 0000000000000000 
28665     DEBUG I d16 0000000045fada68 d17 bff0000000000000 
28665     DEBUG I d18 3ff0000000000000 d19 0000000000000000 
28665     DEBUG I d20 0000000000000000 d21 0000000000000000 
28665     DEBUG I d22 3ff0000000000000 d23 0000000000000000 
28665     DEBUG I d24 3ff0000000000000 d25 0000000000000000 
28665     DEBUG I d26 0000000000000000 d27 0000000000000000 
28665     DEBUG I d28 00070008000a0009 d29 0005000500050005 
28665     DEBUG I d30 001f001f001f001f d31 001f001f001f001f 
28665     DEBUG I scr 60000012 
28665     DEBUG I 
28665     DEBUG I   #00 pc 0004b0e4 /system/lib/libskia.so 
28665     DEBUG I   #01 pc 0004b1a8 /system/lib/libskia.so 
28665     DEBUG I   #02 pc 0006896c /system/lib/libskia.so 
28665     DEBUG I   #03 pc 0006434c /system/lib/libskia.so 
28665     DEBUG I   #04 pc 0004f7c0 /system/lib/libandroid_runtime.so 
28665     DEBUG I 
28665     DEBUG I code around pc: 
28665     DEBUG I ab14b0c4 e1500001 e92d4070 e1a05001 e1a04000 
28665     DEBUG I ab14b0d4 0a00001a e1a06005 ebffff9f e1a0c004 
28665     DEBUG I ab14b0e4 e8b6000f e8ac000f e8b6000f e8ac000f 
28665     DEBUG I ab14b0f4 e8960003 e88c0003 e5950004 e3500000 
28665     DEBUG I ab14b104 0a000001 e2800004 ebff7655 e5950000 
28665     DEBUG I 
28665     DEBUG I code around lr: 
28665     DEBUG I 
28665     DEBUG I stack: 
28665     DEBUG I  bee46eb8 afd4372c /system/lib/libc.so 
28665     DEBUG I  bee46ebc afd43788 /system/lib/libc.so 
28665     DEBUG I  bee46ec0 002a7340 [heap] 
28665     DEBUG I  bee46ec4 00000000 
28665     DEBUG I  bee46ec8 bee47130 [stack] 
28665     DEBUG I  bee46ecc 41873724 
28665     DEBUG I  bee46ed0 41873710 
28665     DEBUG I  bee46ed4 afd0c737 /system/lib/libc.so 
28665     DEBUG I  bee46ed8 002a7348 [heap] 
28665     DEBUG I  bee46edc 00000000 
28665     DEBUG I  bee46ee0 00000000 
28665     DEBUG I  bee46ee4 ab14af6c /system/lib/libskia.so 
28665     DEBUG I  bee46ee8 002a7348 [heap] 
28665     DEBUG I  bee46eec 00000000 
28665     DEBUG I  bee46ef0 df002777 
28665     DEBUG I  bee46ef4 e3a070ad 
28665     DEBUG I #00 bee46ef8 002a7348 [heap] 
28665     DEBUG I  bee46efc bee46f5c [stack] 
28665     DEBUG I  bee46f00 00000000 
28665     DEBUG I  bee46f04 ab14b1ac /system/lib/libskia.so 
28665     DEBUG I #01 bee46f08 002a7340 [heap] 
28665     DEBUG I  bee46f0c ab168970 /system/lib/libskia.so 
    107   BootReceiver I Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE) 
    107   ActivityManager I Process com.android.appion.arm.activities (pid 29574) has died. 
    107   ActivityManager W Scheduling restart of crashed service com.android.appion.arm.activities/com.android.appion.arm.core.AppionApplication$IOService in 5000ms 
    63     Zygote D Process 29574 terminated by signal (11) 
    107   ActivityManager E fail to set top app changed! 
    107    UsageStats I Unexpected resume of com.google.android.gm while already resumed in com.android.appion.arm.activities 

編輯:在OnCreate一個的onResume

/** Called when the activity is first created. */ 
     @Override public void onCreate(Bundle icicle) { 
      super.onCreate(icicle); 
      setContentView(R.layout.homescreen); 
      mApp = (AppionApplication)getApplicationContext(); 
      if (mApp.getDrawer() == null) { 
       LayoutInflater li = (LayoutInflater)getSystemService(
         Context.LAYOUT_INFLATER_SERVICE); 
       Workspace w = (Workspace) li.inflate(R.layout.workspace, null); 
       w.setContext(this); 
       w.init(); 
       mApp.setDrawer(w); 
      } 
      initWidgets(); 
      AppionApplication a = ((AppionApplication)getApplicationContext()); 
      mPrefs = PreferenceManager.getDefaultSharedPreferences(this); 
      determineFirstStart();     
     } 



@Override public void onResume() { 
    super.onResume(); 
    mMain = (RelativeLayout)findViewById(R.id.homescreen_main); 
    mMain.addView(mApp.getDrawer()); 
} 
+0

發佈導致問題的活動的代碼。至少包括onCreate()和onResume()。 – Squonk 2011-04-20 20:46:30

回答

0

看看這個:http://android-developers.blogspot.com/2011/03/memory-analysis-for-android.html 的MAT工具是在插上內存泄漏真的很有幫助。

+0

我下載並運行MAT。我不完全確定我知道我在看什麼。如果我瞭解報告,它說我的應用程序正在使用; 3.16%的使用資源總量。如果是這種情況,我應該進一步明確。 – AedonEtLIRA 2011-04-20 22:32:46

+0

你轉儲了HPROF文件並加載到MAT,如abhilash教程中所述? – wired00 2011-04-20 23:39:06

+0

是的,我已經使用了博客中解釋的MAT工具來分析內存不足的問題。但我個人更喜歡做 - 殺死-10 ,然後從/ data/misc中提取hprof文件,做hprof-conv,然後使用Jhat工具。 – Abhilash 2011-04-21 17:30:18