Could not allocate CursorWindow size due to error -12 错误解决方法
04-29 11:13:54.284 13584-13584/com.uniubi.smartfrontdesk E/art: Throwing OutOfMemoryError "pthread_create (1040KB stack) failed: Try again" 04-29 11:13:54.292 13584-13606/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 13606 (Thread-55205) 04-29 11:13:54.294 13584-13633/? E/H264Stream: NAL unit length:22151 04-29 11:13:54.320 13584-13633/? E/H264Stream: NAL unit length:19356 04-29 11:13:54.322 13584-13626/? E/Dispatcher: UFaceAPI faceDetect Time:1 04-29 11:13:54.343 13584-13626/? E/Dispatcher: UFaceAPI faceDetect Time:1 04-29 11:13:57.244 517-845/system_process E/NativeCrashListener: Exception dealing with report android.system.ErrnoException: read failed: EAGAIN (Try again) at libcore.io.Posix.readBytes(Native Method) at libcore.io.Posix.read(Posix.java:165) at libcore.io.BlockGuardOs.read(BlockGuardOs.java:230) at android.system.Os.read(Os.java:350) at com.android.server.am.NativeCrashListener.consumeNativeCrashData(NativeCrashListener.java:240) at com.android.server.am.NativeCrashListener.run(NativeCrashListener.java:138) 04-29 11:14:10.347 517-567/system_process E/Sensors: poll() failed (Interrupted system call) 04-29 11:14:26.586 517-783/system_process E/InputDispatcher: channel '300698bd com.uniubi.smartfrontdesk/com.uniubi.smartfrontdesk.HomeActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 04-29 11:14:26.658 19628-19638/? E/art: Failed sending reply to debugger: Broken pipe 04-29 11:14:27.885 153-183/? E/BufferQueueProducer: [SurfaceView] dequeueBuffer: BufferQueue has been abandoned 04-29 11:14:27.886 159-13652/? E/OMXCodec: [OMX.rk.video_decoder.avc] dequeueBuffer failed w/ error 0xffffffed 04-29 11:14:27.892 153-183/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.892 153-185/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.892 153-183/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.892 153-436/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.893 153-1283/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.893 153-185/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.894 153-436/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.894 153-183/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.894 153-1283/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.894 153-1283/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.894 153-185/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.895 153-436/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.895 153-183/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.895 153-437/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.895 153-1283/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.895 153-1283/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.895 153-1283/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.896 153-183/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.896 153-437/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:27.896 153-185/? E/BufferQueueProducer: [SurfaceView] cancelBuffer: BufferQueue has been abandoned 04-29 11:14:29.346 517-571/system_process E/ActivityManagerService: ANR in com.uniubi.smartfrontdesk PID: 13584 Reason: Broadcast of Intent { act=android.intent.action.TIME_TICK flg=0x54000010 (has extras) } Load: 1.98 / 2.01 / 1.86 CPU usage from 0ms to 19310ms later: 85% 156/debuggerd: 52% user + 33% kernel / faults: 28490 minor 12% 517/system_server: 7.3% user + 5.3% kernel / faults: 5159 minor 7.6% 153/surfaceflinger: 3.1% user + 4.5% kernel / faults: 4234 minor 6.4% 159/mediaserver: 3.4% user + 2.9% kernel / faults: 1992 minor 2.3% 97/kconsole: 0% user + 2.3% kernel 1.9% 1443/com.rockchip.mediacenter:service: 1.7% user + 0.2% kernel / faults: 2969 minor 0.7% 882/com.android.systemui: 0.5% user + 0.2% kernel / faults: 1843 minor 0.6% 1083/com.android.phone: 0.3% user + 0.2% kernel / faults: 1823 minor 0.6% 147/logd: 0.3% user + 0.2% kernel / faults: 2 minor 0% 864/android.process.media: 0% user + 0% kernel / faults: 1140 minor 0.3% 312/adbd: 0% user + 0.3% kernel / faults: 580 minor 0% 1004/com.android.inputmethod.latin: 0% user + 0% kernel / faults: 1033 minor 0% 1046/com.cghs.stresstest: 0% user + 0% kernel / faults: 966 minor 0.2% 68/cfinteractive: 0% user + 0.2% kernel 0.2% 65/rk-fb: 0% user + 0.2% kernel 0.2% 1598/com.ijinshan.ShouJiKong.AndroidDaemon: 0.2% user + 0% kernel / faults: 1113 minor 0.2% 70/irq/42-ff9a0000: 0% user + 0.2% kernel 0.1% 63/irq/50-rga: 0% user + 0.1% kernel 0% 64/fb-vsync: 0% user + 0% kernel 0.1% 107/mmcqd/0: 0% user + 0.1% kernel 0.1% 114/ddrfreqd: 0% user + 0.1% kernel 0% 163/zygote: 0% user + 0% kernel / faults: 1552 minor 0% 1104/com.android.launcher3: 0% user + 0% kernel / faults: 54 minor 0.1% 14980/kworker/u8:1: 0% user + 0.1% kernel 0% 16565/kworker/1:2: 0% user + 0% kernel 0% 3/ksoftirqd/0: 0% user + 0% kernel 0% 8/rcu_preempt: 0% user + 0% kernel 0% 14/ksoftirqd/1: 0% user + 0% kernel 0% 19/ksoftirqd/2: 0% user + 0% kernel 0% 24/ksoftirqd/3: 0% user + 0% kernel 0% 155/netd: 0% user + 0% kernel / faults: 15 minor 0% 11920/kworker/0:2: 0% user + 0% kernel 0% 13449/logcat: 0% user + 0% kernel 0% 13608/com.uniubi.smartfrontdesk:pushservice: 0% user + 0% kernel / faults: 20 minor +0% 19628/com.uniubi.smartfrontdesk: 0% user + 0% kernel 30% TOTAL: 17% user + 12% kernel + 0% iowait + 0% irq + 0.1% softirq CPU usage from 18589ms to 19099ms later: 11% 1443/com.rockchip.mediacenter:service: 11% user + 0% kernel / faults: 89 minor 4.8% 1458/GCDaemon: 4.8% user + 0% kernel 3.2% 24366/Rockchip-4: 3.2% user + 0% kernel 5.6% 517/system_server: 0% user + 5.6% kernel 5.6% 571/ActivityManager: 0% user + 5.6% kernel 1.5% 68/cfinteractive: 0% user + 1.5% kernel 1.5% 153/surfaceflinger: 1.5% user + 0% kernel 1.5% 312/adbd: 0% user + 1.5% kernel / faults: 72 minor 1.5% 312/adbd: 0% user + 1.5% kernel 1.6% 16565/kworker/1:2: 0% user + 1.6% kernel 5.1% TOTAL: 3% user + 2% kernel
程序出现下面的错误:
08-30 20:27:36.751 E/CursorWindow(u 760): Could not allocate CursorWindow
'/data/data/com.Android.providers.media/databases/external.db' of size 2097152 due to error -12.08-30 20:27:36.771 E/JavaBinder(u 760): *** Uncaught remote exception!u (Exceptions are not yet supported across processes.)
08-30 20:27:36.771 E/JavaBinder(u 760): android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. # Open Cursors=781 (# cursors opened by pid 3105=781)08-30 20:27:36.771 E/JavaBinder(u 760):u at android.database.CursorWindow.<init>(CursorWindow.Java:104)
08-30 20:27:36.771 E/JavaBinder(u 760):u at
android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)08-30 20:27:36.771 E/JavaBinder(u 760):u at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:162)
08-30 20:27:36.771 E/JavaBinder(u 760):u at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:156)
08-30 20:27:36.771 E/JavaBinder(u 760):u at android.database.CursorToBulkCursorAdaptor.count(CursorToBulkCursorAdaptor.java:184)
08-30 20:27:36.771 E/JavaBinder(u 760):u at android.content.ContentProviderNative.onTransact
主要是due to error -12, ENOMEM,除非是其它原因内存耗尽,否则一般情况下是cursor泄露;注意errno是-12,如果是-24,EMFILE,则表示是进程内文件描述符耗尽,则未必是cursor泄露的原因。
说明有很明显的cursor leak。
解决办法是找到使用cursor的地方,在使用完毕后cursor.close()即可。