Could not allocate CursorWindow Could not allocate CursorWindow sqlite sqlite

Could not allocate CursorWindow


Error -12 means cursor leak.Pls try close it as follow:

try {....} finally {  cursor.close();}


I was quering in a loop. And closing the cursor inside the loop and not outside solved the problem.


Android cursors read all the query results into memory, and have a limit of 1 MB for that data.

This limit was chosen because this amount of data is likely to make your app run sluggishly on a mobile device.

You should, if possible:

  • do the computations not in your code but in SQL;
  • query only the data that you need (i.e., do not use SELECT * but get only the columns you need, and use a WHERE filter);
  • read the data in smaller portions.