Cursor window: window is full

Tirrel picture Tirrel · Nov 20, 2013 · Viewed 20.8k times · Source

I've created a ListView populated by the data returned from a query.
It works, but in the LogCat I've got the message:

Cursor Window: Window is full: requested allocation 444 bytes, free space 363 bytes, window size 2097152 bytes

and it uses a couple of minutes for loading / visualizing the ListView.

My query returns about 3700 rows of String/Int/Double, each of which with 30 columns; no images or particular datatypes

What does this message exactly mean and how can I avoid it?
Can you improve performances by changing this Cursor Window?

Answer

Delblanco picture Delblanco · Jul 8, 2014

From my experience this means that the query results are too large for the cursor's window and it requests more memory. Most times this request is honored, but on low end devices it could throw exceptions.

I don't know the specifics of the app in question but you referred to a ListView. A ListView cannot show 3700 rows at once and a endless list could help to load the data on demand

My advise is to break up the query into a multiple queries that return smaller results and close them before running the next query. After each successive query combine the results.