0

I keep getting exceptions like the one below on Crashlytics. I've never gotten them myself. All of my database queries look like this:

    Cursor c = null;
    try {
        c = db.query(....);
        ...
    } finally {
        if (c != null) {
            c.close();
        }
    }

So I am pretty sure my code isn't the one leaving cursors open. Which makes me think some library is leaving them open. How can I figure out who is leaving them open?

This is the exception:

Fatal Exception: android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. # Open Cursors=1 (# cursors opened by this proc=1)
       at android.database.CursorWindow.(CursorWindow.java)
       at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
       at android.database.sqlite.SQLiteCursor.clearOrCreateWindow(SQLiteCursor.java:300)
       at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:138)
       at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:132)
       at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:219)
       at android.database.AbstractCursor.moveToNext(AbstractCursor.java:268)
casolorz
  • 8,486
  • 19
  • 93
  • 200
  • look into this link https://stackoverflow.com/questions/11340257/sqlite-android-database-cursor-window-allocation-of-2048-kb-failed – Rohan Sharma May 27 '17 at 18:20
  • I do have a blob on my latest beta but this error predates that blob. I'm still thinking about whether that blob is a good idea. – casolorz May 28 '17 at 01:27
  • This might be [a memory leak elsewhere](http://stevevallay.github.io/blog/2014/11/17/memory-leak/). If it is not in your app's code, there's nothing much you can do about it. – CL. May 28 '17 at 07:28
  • I know there is a cursor leak on some of the google play services code because I have strict mode enabled when testing but that is why I was asking if this is a per cursor limit or a global one. – casolorz May 28 '17 at 15:37

0 Answers0