我怎样才能看到我的内存分配位置?

时间:2011-04-20 20:31:31

标签: android memory screen-orientation

这是我的问题,如果我希望操作系统处理屏幕旋转,我的堆栈跟踪告诉我在两三次旋转后我内存不足,然后应用程序崩溃,没有异常或任何真正的跟踪。显然,我失去记忆,但我不知道泄漏在哪里。我怎么能搞清楚这一点?应用程序启动很好并且完美(快速)运行直到我旋转它。

有任何建议或线索吗?

谢谢~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? com.android.appion.arm.widgets.Workspace@45fa1d08
 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? com.android.appion.arm.widgets.Workspace@45fa1d08
 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? com.android.appion.arm.widgets.Workspace@45fa1d08
 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());
}

1 个答案:

答案 0 :(得分:0)

看看这个:http://android-developers.blogspot.com/2011/03/memory-analysis-for-android.html MAT工具在插入内存泄漏方面非常有用。