如何解决Android中的“HeapWorker楔入”错误?

前端之家收集整理的这篇文章主要介绍了如何解决Android中的“HeapWorker楔入”错误?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_502_1@我从服务器中获取大量数据.我使用Get方法来获得响应,我能够得到响应,但问题是在解析应用程序之间崩溃是因为某些“HeapWorker被楔入”错误.

logcat的

12-20 10:02:55.111: ERROR/dalvikvm(277): HeapWorker is wedged: 10194ms spent inside Landroid/database/sqlite/sqliteCursor;.finalize()V
12-20 10:02:55.111: INFO/dalvikvm(277): DALVIK THREADS:
12-20 10:02:55.111: INFO/dalvikvm(277): "main" prio=5 tid=3 NATIVE
12-20 10:02:55.111: INFO/dalvikvm(277):   | group="main" sCount=1 dsCount=0 s=Y obj=0x4001b268 self=0xbd00
12-20 10:02:55.111: INFO/dalvikvm(277):   | sysTid=277 nice=0 sched=0/0 cgrp=default handle=-1344001384
12-20 10:02:55.111: INFO/dalvikvm(277):   at android.graphics.NinePatch.nativeDraw(Native Method)
12-20 10:02:55.111: INFO/dalvikvm(277):   at android.graphics.NinePatch.draw(NinePatch.java:104)
12-20 10:02:55.111: INFO/dalvikvm(277):   at android.graphics.drawable.NinePatchDrawable.draw(NinePatchDrawable.java:188)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.view.View.draw(View.java:6520)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.widget.FrameLayout.draw(FrameLayout.java:352)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.view.View.draw(View.java:6538)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.widget.FrameLayout.draw(FrameLayout.java:352)
12-20 10:02:55.121: INFO/dalvikvm(277):   at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1830)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.view.ViewRoot.draw(ViewRoot.java:1349)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.view.ViewRoot.performTraversals(ViewRoot.java:1114)
12-20 10:02:55.121: INFO/dalvikvm(277):   at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
12-20 10:02:55.132: INFO/dalvikvm(277):   at android.os.Handler.dispatchMessage(Handler.java:99)
12-20 10:02:55.132: INFO/dalvikvm(277):   at android.os.Looper.loop(Looper.java:123)
12-20 10:02:55.132: INFO/dalvikvm(277):   at android.app.ActivityThread.main(ActivityThread.java:4363)
12-20 10:02:55.132: INFO/dalvikvm(277):   at java.lang.reflect.Method.invokeNative(Native Method)
12-20 10:02:55.132: INFO/dalvikvm(277):   at java.lang.reflect.Method.invoke(Method.java:521)
12-20 10:02:55.132: INFO/dalvikvm(277):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
12-20 10:02:55.132: INFO/dalvikvm(277):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
12-20 10:02:55.132: INFO/dalvikvm(277):   at dalvik.system.NativeStart.main(Native Method)
12-20 10:02:55.132: INFO/dalvikvm(277): "AsyncTask #1" prio=5 tid=15 RUNNABLE
12-20 10:02:55.132: INFO/dalvikvm(277):   | group="main" sCount=0 dsCount=0 s=N obj=0x44dd0bd0 self=0x125a30
12-20 10:02:55.132: INFO/dalvikvm(277):   | sysTid=283 nice=0 sched=0/0 cgrp=default handle=1203016
12-20 10:02:55.132: INFO/dalvikvm(277):   at java.io.BufferedWriter.<init>(BufferedWriter.java:~67)
12-20 10:02:55.132: INFO/dalvikvm(277):   at uk.co.dodec.ukrcmobileapp.helper.UDFHelper.createHtml(UDFHelper.java:167)
12-20 10:02:55.132: INFO/dalvikvm(277):   at uk.co.dodec.ukrcmobileapp.helper.XMLParser.parseUpdates(XMLParser.java:510)
12-20 10:02:55.132: INFO/dalvikvm(277):   at uk.co.dodec.ukrcmobileapp.Homepage$getUpdateTask.doInBackground(Homepage.java:170)
12-20 10:02:55.132: INFO/dalvikvm(277):   at uk.co.dodec.ukrcmobileapp.Homepage$getUpdateTask.doInBackground(Homepage.java:1)
12-20 10:02:55.132: INFO/dalvikvm(277):   at android.os.AsyncTask$2.call(AsyncTask.java:185)
12-20 10:02:55.132: INFO/dalvikvm(277):   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
12-20 10:02:55.132: INFO/dalvikvm(277):   at java.util.concurrent.FutureTask.run(FutureTask.java:137)
12-20 10:02:55.141: INFO/dalvikvm(277):   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
12-20 10:02:55.141: INFO/dalvikvm(277):   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
12-20 10:02:55.141: INFO/dalvikvm(277):   at java.lang.Thread.run(Thread.java:1096)
12-20 10:02:55.141: INFO/dalvikvm(277): "Binder Thread #2" prio=5 tid=13 NATIVE
12-20 10:02:55.141: INFO/dalvikvm(277):   | group="main" sCount=1 dsCount=0 s=N obj=0x44da1c38 self=0x11d3c8
12-20 10:02:55.141: INFO/dalvikvm(277):   | sysTid=282 nice=0 sched=0/0 cgrp=default handle=1343552
12-20 10:02:55.141: INFO/dalvikvm(277):   at dalvik.system.NativeStart.run(Native Method)
12-20 10:02:55.141: INFO/dalvikvm(277): "Binder Thread #1" prio=5 tid=11 NATIVE
12-20 10:02:55.141: INFO/dalvikvm(277):   | group="main" sCount=1 dsCount=0 s=N obj=0x44d9dea8 self=0x14d8d0
12-20 10:02:55.141: INFO/dalvikvm(277):   | sysTid=281 nice=0 sched=0/0 cgrp=default handle=1366160
12-20 10:02:55.141: INFO/dalvikvm(277):   at dalvik.system.NativeStart.run(Native Method)
12-20 10:02:55.141: INFO/dalvikvm(277): "JDWP" daemon prio=5 tid=9 VMWAIT
12-20 10:02:55.141: INFO/dalvikvm(277):   | group="system" sCount=1 dsCount=0 s=N obj=0x44d9b2a0 self=0x145338
12-20 10:02:55.141: INFO/dalvikvm(277):   | sysTid=280 nice=0 sched=0/0 cgrp=default handle=1331744
12-20 10:02:55.141: INFO/dalvikvm(277):   at dalvik.system.NativeStart.run(Native Method)
12-20 10:02:55.141: INFO/dalvikvm(277): "Signal Catcher" daemon prio=5 tid=7 VMWAIT
12-20 10:02:55.141: INFO/dalvikvm(277):   | group="system" sCount=1 dsCount=0 s=N obj=0x44d9b1e8 self=0x145108
12-20 10:02:55.141: INFO/dalvikvm(277):   | sysTid=279 nice=0 sched=0/0 cgrp=default handle=1262808
12-20 10:02:55.141: INFO/dalvikvm(277):   at dalvik.system.NativeStart.run(Native Method)
12-20 10:02:55.151: INFO/dalvikvm(277): "HeapWorker" daemon prio=5 tid=5 WAIT
12-20 10:02:55.151: INFO/dalvikvm(277):   | group="system" sCount=1 dsCount=0 s=N obj=0x4369a188 self=0x1343c0
12-20 10:02:55.151: INFO/dalvikvm(277):   | sysTid=278 nice=0 sched=0/0 cgrp=default handle=1208016
12-20 10:02:55.151: INFO/dalvikvm(277):   at java.lang.Object.wait(Native Method)
12-20 10:02:55.151: INFO/dalvikvm(277):   - waiting on <0x3362f0> (a java.lang.VMThread)
12-20 10:02:55.151: INFO/dalvikvm(277):   at java.lang.Thread.parkFor(Thread.java:1535)
12-20 10:02:55.151: INFO/dalvikvm(277):   at java.lang.LangAccessImpl.parkFor(LangAccessImpl.java:48)
12-20 10:02:55.151: INFO/dalvikvm(277):   at sun.misc.Unsafe.park(Unsafe.java:317)
12-20 10:02:55.151: INFO/dalvikvm(277):   at java.util.concurrent.locks.LockSupport.park(LockSupport.java:131)
12-20 10:02:55.151: INFO/dalvikvm(277):   at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:790)
12-20 10:02:55.151: INFO/dalvikvm(277):   at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:823)
12-20 10:02:55.151: INFO/dalvikvm(277):   at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1153)
12-20 10:02:55.151: INFO/dalvikvm(277):   at java.util.concurrent.locks.ReentrantLock$FairSync.lock(ReentrantLock.java:200)
12-20 10:02:55.151: INFO/dalvikvm(277):   at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:261)
12-20 10:02:55.151: INFO/dalvikvm(277):   at android.database.sqlite.sqliteDatabase.lock(sqliteDatabase.java:305)
12-20 10:02:55.151: INFO/dalvikvm(277):   at android.database.sqlite.sqliteProgram.close(sqliteProgram.java:219)
12-20 10:02:55.151: INFO/dalvikvm(277):   at android.database.sqlite.sqliteQuery.close(sqliteQuery.java:141)
12-20 10:02:55.151: INFO/dalvikvm(277):   at android.database.sqlite.sqliteCursor.close(sqliteCursor.java:507)
12-20 10:02:55.151: INFO/dalvikvm(277):   at android.database.sqlite.sqliteCursor.finalize(sqliteCursor.java:586)
12-20 10:02:55.151: INFO/dalvikvm(277):   at dalvik.system.NativeStart.run(Native Method)
12-20 10:02:55.151: ERROR/dalvikvm(277): VM aborting
12-20 10:02:55.296: INFO/DEBUG(28): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-20 10:02:55.296: INFO/DEBUG(28): signal 11 (SIGSEGV),fault addr deadd00d
12-20 10:02:55.296: INFO/DEBUG(28):  r0 00000354  r1 afe1331d  r2 0000000c  r3 deadd00d
12-20 10:02:55.296: INFO/DEBUG(28):  r4 00000026  r5 400091e8  r6 ad065714  r7 003fca30
12-20 10:02:55.296: INFO/DEBUG(28):  r8 00000344  r9 00000001  10 ad080c00  fp 00000000
12-20 10:02:55.296: INFO/DEBUG(28):  ip ad080160  sp 46a32c58  lr afe142dd  pc ad035452  cpsr 20000030
12-20 10:02:55.391: INFO/DEBUG(28):          #00  pc 00035452  /system/lib/libdvm.so
12-20 10:02:55.391: INFO/DEBUG(28):          #01  pc 000440d8  /system/lib/libdvm.so
12-20 10:02:55.391: INFO/DEBUG(28):          #02  pc 0001680c  /system/lib/libdvm.so
12-20 10:02:55.391: INFO/DEBUG(28):          #03  pc 000170c4  /system/lib/libdvm.so
12-20 10:02:55.391: INFO/DEBUG(28):          #04  pc 0001724c  /system/lib/libdvm.so
12-20 10:02:55.401: INFO/DEBUG(28):          #05  pc 00055b52  /system/lib/libdvm.so
12-20 10:02:55.401: INFO/DEBUG(28):          #06  pc 00055c80  /system/lib/libdvm.so
12-20 10:02:55.401: INFO/DEBUG(28):          #07  pc 00055d80  /system/lib/libdvm.so
12-20 10:02:55.401: INFO/DEBUG(28):          #08  pc 0001353c  /system/lib/libdvm.so
12-20 10:02:55.411: INFO/DEBUG(28):          #09  pc 00019888  /system/lib/libdvm.so
12-20 10:02:55.411: INFO/DEBUG(28):          #10  pc 00018d5c  /system/lib/libdvm.so
12-20 10:02:55.411: INFO/DEBUG(28):          #11  pc 0004d6d0  /system/lib/libdvm.so
12-20 10:02:55.411: INFO/DEBUG(28):          #12  pc 0004d702  /system/lib/libdvm.so
12-20 10:02:55.411: INFO/DEBUG(28):          #13  pc 00041c78  /system/lib/libdvm.so
12-20 10:02:55.411: INFO/DEBUG(28):          #14  pc 00010000  /system/lib/libc.so
12-20 10:02:55.411: INFO/DEBUG(28):          #15  pc 0000fad4  /system/lib/libc.so
12-20 10:02:55.411: INFO/DEBUG(28): code around pc:
12-20 10:02:55.411: INFO/DEBUG(28): ad035440 4808ecb6 6b9b5823 d0002b00 4b064798 
12-20 10:02:55.411: INFO/DEBUG(28): ad035450 701c2426 ed28f7d9 0004ab1c fffe57c4 
12-20 10:02:55.411: INFO/DEBUG(28): ad035460 fffe8c30 00000354 deadd00d b510b40e 
12-20 10:02:55.411: INFO/DEBUG(28): code around lr:
12-20 10:02:55.422: INFO/DEBUG(28): afe142cc 220ce008 2b005eab 1c28d003 47889901 
12-20 10:02:55.422: INFO/DEBUG(28): afe142dc 35544306 d5f43f01 2c006824 b003d1ee 
12-20 10:02:55.422: INFO/DEBUG(28): afe142ec bdf01c30 00024b44 000000b4 1c0fb5f0 
12-20 10:02:55.422: INFO/DEBUG(28): stack:
12-20 10:02:55.422: INFO/DEBUG(28):     46a32c18  00000015  
12-20 10:02:55.422: INFO/DEBUG(28):     46a32c1c  afe1334d  /system/lib/libc.so
12-20 10:02:55.422: INFO/DEBUG(28):     46a32c20  afe3902c  /system/lib/libc.so
12-20 10:02:55.422: INFO/DEBUG(28):     46a32c24  afe38fd8  /system/lib/libc.so
12-20 10:02:55.422: INFO/DEBUG(28):     46a32c28  00000000  
12-20 10:02:55.422: INFO/DEBUG(28):     46a32c2c  afe142dd  /system/lib/libc.so
12-20 10:02:55.422: INFO/DEBUG(28):     46a32c30  46a32c44  
12-20 10:02:55.422: INFO/DEBUG(28):     46a32c34  afe1331d  /system/lib/libc.so
12-20 10:02:55.422: INFO/DEBUG(28):     46a32c38  ad065714  /system/lib/libdvm.so
12-20 10:02:55.422: INFO/DEBUG(28):     46a32c3c  ad07ff50  /system/lib/libdvm.so
12-20 10:02:55.422: INFO/DEBUG(28):     46a32c40  400091e8  /dev/ashmem/mspace/dalvik-heap/zygote/0 (deleted)
12-20 10:02:55.422: INFO/DEBUG(28):     46a32c44  ad065714  /system/lib/libdvm.so
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c48  003fca30  [heap]
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c4c  afe1337f  /system/lib/libc.so
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c50  df002777  
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c54  e3a070ad  
12-20 10:02:55.431: INFO/DEBUG(28): #00 46a32c58  ad06ccd7  /system/lib/libdvm.so
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c5c  ad0440dd  /system/lib/libdvm.so
12-20 10:02:55.431: INFO/DEBUG(28): #01 46a32c60  000027d2  
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c64  00000000  
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c68  42a58733  /data/dalvik-cache/system@framework@framework.jar@classes.dex
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c6c  42ad950b  /data/dalvik-cache/system@framework@framework.jar@classes.dex
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c70  003fca30  [heap]
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c74  0000011b  
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c78  ad080f8c  /system/lib/libdvm.so
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c7c  afe0f3b0  /system/lib/libc.so
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c80  009b8cc3  
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c84  00000000  
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c88  00000354  
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c8c  400091e8  /dev/ashmem/mspace/dalvik-heap/zygote/0 (deleted)
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c90  ad07ff50  /system/lib/libdvm.so
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c94  00000354  
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c98  0000000a  
12-20 10:02:55.431: INFO/DEBUG(28):     46a32c9c  ad016810  /system/lib/libdvm.so

解决方法

我找到了解决问题的方法
我在解析数据和将数据插入数据库时​​使用事务.
但在这之间我试图从数据库获取一些值.
这样的层次结构如下
<transaction>
<Insert>
 <select>
<insert>
</transaction>

我正在尝试在数据库上运行select查询,而数据库在事务中.
实际上这里有一个关于concurrent transaction解决方

sql命令“BEGIN TRANSACTION”(TRANSACTION关键字是可选的)用于使sqlite脱离自动提交模式.请注意,BEGIN命令不会获取数据库上的任何锁定.在BEGIN命令之后,执行第一个SELECT语句时将获取SHARED锁.执行第一个INSERT,UPDATE或DELETE语句时将获取RESERVED锁.在内存缓存填满并且必须溢出到磁盘或事务提交之前,不会获取EXCLUSIVE锁.通过这种方式,系统延迟阻止对文件文件的读访问,直到最后一刻.

我只是在数据库处于事务中时从代码删除了选择查询

编辑

另外还有一个解决方案是你设置锁定启用false就像

mDb.setLockingEnabled(false);
原文链接:https://www.f2er.com/android/310498.html

猜你在找的Android相关文章