Open zengjingfang opened 6 years ago
public CursorWindow(String name) {
mStartPos = 0;
mName = name != null && name.length() != 0 ? name : "<unnamed>";
if (sCursorWindowSize < 0) {
/** The cursor window size. resource xml file specifies the value in kB.
* convert it to bytes here by multiplying with 1024.
*/
sCursorWindowSize = Resources.getSystem().getInteger(
com.android.internal.R.integer.config_cursorWindowSize) * 1024;
}
mWindowPtr = nativeCreate(mName, sCursorWindowSize);
if (mWindowPtr == 0) {
// 异常抛出的地方
throw new CursorWindowAllocationException("Cursor window allocation of " +
(sCursorWindowSize / 1024) + " kb failed. " + printStats());
}
mCloseGuard.open("close");
recordNewWindow(Binder.getCallingPid(), mWindowPtr);
}
// 创建表CursorWindow
private static native long nativeCreate(String name, int cursorWindowSize);
应该就是系统调用 nativeCreate 方法时存在问题,导致了抛出该异常。
android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. at android.database.CursorWindow.(CursorWindow.java:104)
at android.database.CursorWindow.(CursorWindow.java:126)
at net.sqlcipher.CursorWindow.(CursorWindow.java:54)
at net.sqlcipher.database.SQLiteCursor.fillWindow(SQLiteCursor.java:288)
at net.sqlcipher.database.SQLiteCursor.getCount(SQLiteCursor.java:280)
at net.sqlcipher.AbstractCursor.moveToPosition(AbstractCursor.java:178)
at net.sqlcipher.AbstractCursor.moveToFirst(AbstractCursor.java:222)
at android.database.CursorWrapper.moveToFirst(CursorWrapper.java:65)
at com.j256.ormlite.sqlcipher.android.AndroidCompiledStatement.getCursor(AndroidCompiledStatement.java:181)
at com.j256.ormlite.sqlcipher.android.AndroidCompiledStatement.runQuery(AndroidCompiledStatement.java:65)
at com.j256.ormlite.stmt.SelectIterator.(SelectIterator.java:55)
at com.j256.ormlite.stmt.StatementExecutor.buildIterator(StatementExecutor.java:247)
at com.j256.ormlite.stmt.StatementExecutor.query(StatementExecutor.java:196)
at com.j256.ormlite.dao.BaseDaoImpl.query(BaseDaoImpl.java:265)
at com.j256.ormlite.stmt.QueryBuilder.query(QueryBuilder.java:361)