Android SQL Lite fail to grow
We are creating an app that syncs 5000 calendar entries with the server. The issue is that after adding 1913 entries it failing and giving the following stack trace. What is the problem?
12-30 11:48:16.989: DEBUG/dalvikvm(384): GC_EXPLICIT freed 5699 objects / 345848 bytes in 579ms 12-30 11:48:22.530: DEBUG/dalvikvm(232): GC_EXPLICIT freed 2552 objects / 124160 bytes in 311ms 12-30 11:48:24.560: ERROR/CursorWindow(232): need to grow: mSize = 1048576, size = 414, freeSpace() = 328, numRows = 1913 12-30 11:48:24.599: ERROR/CursorWindow(232): not growing since there are already 1913 row(s), max size 1048576 12-30 11:48:24.599: ERROR/CursorWindow(232): The row failed, so back out the new row accounting from allocRowSlot 1912 12-30 11:48:24.620: ERROR/Cursor(232): Failed allocating fieldDir at startPos 0 row 1912 12-30 开发者_如何学运维11:48:27.340: DEBUG/Cursor(232): finish_program_and_get_row_count row 3266 12-30 11:48:28.070: ERROR/Calendar(Vikas)(384): Uncaught exception in EasSyncServicejava.lang.NullPointerException 12-30 11:48:28.089: ERROR/Calendar(Vikas)(384): Sync ended due to an exception.
The CursorWindow
class only supports reading 1MB of data per query:
#define MAX_WINDOW_SIZE (1024 * 1024)
(Source)
Try one or more of the following:
- Request fewer rows.
- Request fewer columns.
- Split your query up into smaller queries and run them one at a time.
One way you could improve the situation is to store the last sync date on the server and only synchronize changes that have happened since that date.
SELECT *
FROM calendar
WHERE modified > 'some date'
I had the same problem, in my case was due to a NullPointerException by parsing the TimeZone info (unfortunately the stack trace is lost in code).
Maybe you are affected by the same problem.
Visit http://code.google.com/p/android/issues/detail?id=21435, I've opened an issue by google but it looks like they are not interested to the problem. The Issue is currently Declined.
精彩评论