2011-01-07 61 views
0
[ 01-01 08:29:02.954 1511:0x5e7 E/dalvikvm ] 
HeapWorker is wedged: 10330ms spent inside Landroid/content/ContentResolver$CursorWrapperInner;.finalize()V 
[ 01-01 08:29:02.954 1511:0x5e7 I/dalvikvm ] 
DALVIK THREADS:  
[ 01-01 08:29:02.954 1511:0x5e7 I/dalvikvm ] 
"main" prio=5 tid=1 RUNNABLE  
[ 01-01 08:29:02.954 1511:0x5e7 I/dalvikvm ] 
    | group="main" sCount=0 dsCount=0 s=N obj=0x400258c8 self=0xcd98 
[ 01-01 08:29:02.954 1511:0x5e7 I/dalvikvm ] 
    | sysTid=1511 nice=0 sched=0/0 cgrp=default handle=-1345021912 
[ 01-01 08:29:02.977 1511:0x5e7 I/dalvikvm ] 
    at java.lang.AbstractStringBuilder.toString(AbstractStringBuilder.java:Note: 0000662) 
[ 01-01 08:29:02.977 1511:0x5e7 I/dalvikvm ] 
    at java.lang.StringBuilder.toString(StringBuilder.java:664) 
[ 01-01 08:29:02.977 1511:0x5e7 I/dalvikvm ] 
    at java.io.File.join(File.java:264) 
[ 01-01 08:29:02.977 1511:0x5e7 I/dalvikvm ] 
    at java.io.File.<init>(File.java:175) 
[ 01-01 08:29:02.977 1511:0x5e7 I/dalvikvm ] 
    at java.io.File.<init>(File.java:142) 
[ 01-01 08:29:02.977 1511:0x5e7 I/dalvikvm ] 
    at java.io.File.filenamesToFiles(File.java:1082) 
[ 01-01 08:29:02.977 1511:0x5e7 I/dalvikvm ] 
    at java.io.File.listFiles(File.java:1008) 

如何解決此問題?HeapWorker Android性能

我知道根本原因是要創建很多臨時變量。

回答

3

您正在查看錯誤線程的堆棧跟蹤。

問題是終結器需要超過10秒才能完成,因此VM認爲它已死鎖並中止導致應用程序重新啓動。在這種情況下,停頓的函數是android.content.ContentResolver.CursorWrapperInner.finalize()。

附近應該有HeapWorker線程的堆棧跟蹤。

+0

`HeapWorker楔入:在Landroid/database/sqlite/SQLiteCompiledSql中花費33299ms; .finalize()V`嵌套的sqlite事務會導致這種情況發生嗎? – 2015-02-05 22:03:33