[Android] Issue : Too slow to scroll the list which has sqlite-cursor-adapter.

Domain/Android 2012.10.23 12:03
Sometimes developer may be faced with below log message with extremely-slow-scrolling of List.

Log includes "Window is full: requested allocation 2195889 bytes, free space 2096720 bytes, window size 2097152 bytes"

Most case of this kind of issue can be seen when SQLite DB has blob-type field whose data is quite big, and Cursor that includes this field is used at Aadapter.

In this case, Cursor easily exceeds it's maximum Window size (at Android 4.0.3, this value is about 2 MB).

After reaching to maximum Window size, Cursor need to handle Window, and at worse, field size is quite big.
So, whenever move to another row of Cursor, Cursor should handle quite complex disk operation.

So, at this moment, scrolling list becomes very very slow.

To avoid this, main Cursor of Adapter would better not to have big-size field of DB Table.

Instead of it, try to read from DB whenever the field value is demanded.

Then, average time for scrolling list may be increased. But, even at worst cases, list can show reasonable scrolling performance.

Trackbacks 0 : Comments 0