2

I'm sometimes seeing a crash report with an android.database.CursorWindowAllocationException which would suggest a leak, like in this other SO question Out of Memory when allocating cursors but my Exception has '# Open Cursors=1 (# cursors opened by this proc=1)' which doesn't seem like I've lots of cursors left lying around.

I'm using ORMLite, I'm wondering if there's anything I can do to track down exactly what's going wrong?

The stack trace for the exception looks like this:

android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. # Open Cursors=1 (# cursors opened by this proc=1)
at android.database.CursorWindow.<init>(CursorWindow.java:104)
at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:162)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:156)
at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:161)
at android.database.AbstractCursor.moveToFirst(AbstractCursor.java:201)
at com.j256.ormlite.android.AndroidDatabaseResults.first(AndroidDatabaseResults.java:73)
at com.j256.ormlite.android.AndroidDatabaseConnection.queryForOne(AndroidDatabaseConnection.java:176)
at com.j256.ormlite.stmt.mapped.MappedQueryForId.execute(MappedQueryForId.java:38)
at com.j256.ormlite.field.FieldType.assignField(FieldType.java:533)
at com.j256.ormlite.stmt.mapped.BaseMappedQuery.mapRow(BaseMappedQuery.java:71)
at com.j256.ormlite.stmt.StatementExecutor.queryForFirst(StatementExecutor.java:97)
at com.j256.ormlite.dao.BaseDaoImpl.queryForFirst(BaseDaoImpl.java:231)
at com.our.company.service.DownloadService.getLatestVoucherUpdate(DownloadService.java:354)
at com.our.company.service.DownloadService.downloadVouchers(DownloadService.java:831)
at com.our.company.service.DownloadService.onHandleIntent(DownloadService.java:1483)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:60)
Community
  • 1
  • 1
Jonathan Caryl
  • 1,330
  • 3
  • 12
  • 30
  • Have u tried this : http://stackoverflow.com/questions/12577400/out-of-memory-when-allocating-cursors – Sourab Sharma Feb 04 '13 at 13:38
  • This may mean that you are running out of memory. Can you take a look at your memory usage to see if it's getting full? – Gray Feb 08 '13 at 17:43
  • In terms of the cursor, is it possible that you are using an iterator that has not been closed? Maybe a for loop that you `break` out of? – Gray Feb 09 '13 at 22:48
  • I'm having a similiar issue with Android Room's cursor allocation. Did you ever find the cause? – dasfima Oct 26 '18 at 08:11

0 Answers0