I want to simulate android.database.CursorWindowAllocationException crash. I am working on a huge codebase with a lot of room database queries in each screen. I am not sure in which database query this crash occurs and in which scenario this crash occurs. So is there any way to simulate this crash? I tried keeping almost 10 database cursors open in a for loop but could not reproduce the crash. I have attached the crashlytics logs for reference.
Fatal Exception: android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed.
at android.database.CursorWindow.<init>(CursorWindow.java:108)
at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
at android.database.sqlite.SQLiteCursor.clearOrCreateWindow(SQLiteCursor.java:309)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:147)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:141)
at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:220)
at android.database.AbstractCursor.moveToNext(AbstractCursor.java:269)
at androidx.room.InvalidationTracker$1.checkUpdatedTable(InvalidationTracker.java:461)
at androidx.room.InvalidationTracker$1.run(InvalidationTracker.java:431)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)