Could not allocate CursorWindow

后端 未结 3 1183
走了就别回头了
走了就别回头了 2020-12-06 01:33

I\'m operating on an SQLite3 database in my android app. I just read from the pre populated database that has 200k rows and 14 columns. Entries are words. Datatype

相关标签:
3条回答
  • 2020-12-06 01:42

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

    try {....} finally {  cursor.close();}
    
    0 讨论(0)
  • 2020-12-06 01:52

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

    0 讨论(0)
  • 2020-12-06 01:53

    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.
    0 讨论(0)
提交回复
热议问题