Android Question Sqlite android.database.CursorWindowAllocationException

Kiran Raotole

Active Member
Licensed User
I'm getting this error again.
B4X:
Error occurred on line: 479 (MysqlEntrySync)
android.database.CursorWindowAllocationException: Cursor window allocation of 2097152 bytes failed. # Open Cursors=920 (# cursors opened by this proc=920)
    at android.database.CursorWindow.<init>(CursorWindow.java:136)
    at android.database.CursorWindow.<init>(CursorWindow.java:114)
    at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
    at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:143)
    at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:137)
    at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:220)
    at android.database.AbstractCursor.moveToFirst(AbstractCursor.java:259)
    at anywheresoftware.b4a.sql.SQL.ExecQuerySingleResult2(SQL.java:247)
    at anywheresoftware.b4a.sql.SQL.ExecQuerySingleResult(SQL.java:234)
    at com.ctron.mobile.mysqlentrysync$ResumableSub_update_old_record_new.resume(mysqlentrysync.java:4103)
    at com.ctron.mobile.mysqlentrysync._update_old_record_new(mysqlentrysync.java:4046)
    at com.ctron.mobile.mysqlentrysync$ResumableSub_mysql_sync_sync.resume(mysqlentrysync.java:4014)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:137)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1760)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6702)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)

Whats the Problem?
 

DonManfred

Expert
Licensed User
Longtime User
Looks like you opened a lot of cursors. Do you not close them after use?

Maybe you are just fetching too much data at once
There is a Limit in sqlite.
 
Last edited:
Upvote 0

Kiran Raotole

Active Member
Licensed User
I closed all unused cursor.
and I'm trying to fetch
B4X:
select count(*) from TR
with 5000 recrods.

Is there any provision for checking Open Cursor?
 
Upvote 0
Top