我一直在Crashlytics上遇到类似下面的例外情况。我自己从来没有得过它们。我的所有数据库查询都是这样的:
Cursor c = null;
try {
c = db.query(....);
...
} finally {
if (c != null) {
c.close();
}
}
所以我很确定我的代码不是留下游标的代码。这让我觉得有些图书馆让他们开放。我怎么能弄清楚谁让他们开着?
这是一个例外:
Fatal Exception: android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. # Open Cursors=1 (# cursors opened by this proc=1)
at android.database.CursorWindow.(CursorWindow.java)
at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
at android.database.sqlite.SQLiteCursor.clearOrCreateWindow(SQLiteCursor.java:300)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:138)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:132)
at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:219)
at android.database.AbstractCursor.moveToNext(AbstractCursor.java:268)