Records the Issue that cannot be created in CursorWindow due to memory exhaustion (error-12) caused by cursor leakage on Android.
[Symptom]
20:27:36-30. 751 E/CursorWindow (760): cocould not allocate CursorWindow '/data/com. android. providers. media/databases/external. db 'of size 2097152 due to error-12.
08-30 20:27:36. 771 E/JavaBinder (760): *** Uncaught remote exception! (Exceptions are not yet supported into SS processes .)
20:27:36-30. 771 E/JavaBinder (760): android. database. cursorrentwallocationexception: Cursor window allocation of 2048 kb failed. # Open Cursors = 781 (# cursors opened by pid 3105 = 781)
08-30 20:27:36. 771 E/JavaBinder (760): at android. database. CursorWindow. <init> (CursorWindow. java: 104)
08-30 20:27:36. 771 E/JavaBinder (760): at android. database. abstract=wedcursor. clearOrCreateWindow (abstract=wedcursor. java: 198)
08-30 20:27:36. 771 E/JavaBinder (760): at android. database. sqlite. SQLiteCursor. fillWindow (SQLiteCursor. java: 162)
08-30 20:27:36. 771 E/JavaBinder (760): at android. database. sqlite. SQLiteCursor. getCount (SQLiteCursor. java: 156)
08-30 20:27:36. 771 E/JavaBinder (760): at android. database. CursorToBulkCursorAdaptor. count (CursorToBulkCursorAdaptor. java: 184)
08-30 20:27:36. 771 E/JavaBinder (760): at android. content. ContentProviderNative. onTransact (ContentProviderNative. java: 117)
08-30 20:27:36. 771 E/JavaBinder (760): at android. OS .Binder.exe cTransact (Binder. java: 338)
08-30 20:27:36. 771 E/JavaBinder (760): at dalvik. system. NativeStart. run (Native Method)
[Analysis]
The following output is obvious in logcat:
Cocould not allocate CursorWindow '/data/com. android. providers. media/databases/external. db' of size 2097152due to error-12,
It is mainly due to error-12, ENOMEM. Unless it is caused by other causes of memory depletion, it is generally caused by cursor leakage. Note that errno is-12, if it is-24, EMFILE, it indicates that the file descriptor in the process is exhausted, which is not necessarily the cause of cursor leakage.
Continue searching from logcat and you will find a large number of the following output,
08-30 20:27:24. 909 D/dalvikvm (3105): GC_EXPLICIT freed 1686 K, 26% free 15810 K/21315 K, paused 8 ms + 16 ms
08-30 20:27:24. 919 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:24. 929 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:24. 949 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:24. 949 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:24. 969 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:24. 989 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:24. 989 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:24. 989 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:24. 999 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:24. 999 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:24. 999 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 009 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 009 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 009 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 019 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 019 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 019 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 019 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 029 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 029 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 029 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 039 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 039 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 039 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 039 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 049 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 049 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 049 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 049 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 049 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 049 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 059 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 059 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 059 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 059 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 059 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 059 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 069 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 069 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 069 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 069 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 069 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 069 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 069 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 079 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 079 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 079 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 079 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 079 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:27:25. 079 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 179 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 189 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 209 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 229 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 249 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 259 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 269 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 279 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 299 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 299 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 299 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 309 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 309 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 309 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 309 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 309 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 319 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 319 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 319 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 319 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 319 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 329 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 339 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 339 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 339 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 349 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 349 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 349 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 359 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 359 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 369 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 369 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 369 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 369 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 369 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 379 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 379 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 389 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 389 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 389 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 389 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 399 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 399 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 399 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 399 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 409 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 409 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 409 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 409 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
08-30 20:26:57. 419 W/CursorWrapperInner (3105): Cursor finalized without prior close ()
It indicates that there is an obvious cursor leak.
The solution is to find the place where you want to use cursor. close () after use.