0
일반적으로이 오류는 커서가 닫히지 않았을 때 발생합니다. 그러나 나에게는 올바른 방법으로 닫습니다. 여기에 어떤 문제가 있습니까?4096kb의 커서 창 할당이 실패했습니다
로그 :
10-21 11:55:36.818 26541-26541/com.mycrosswod.crossfit E/CursorWindow: Could not allocate CursorWindow '/data/data/com.mycrosswod.crossfit/databases/Crossfit' of size 4194304 due to error -12.
10-21 11:55:36.843 26541-26541/com.mycrosswod.crossfit D/AndroidRuntime: Shutting down VM
10-21 11:55:36.843 26541-26541/com.mycrosswod.crossfit W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x40c681f8)
10-21 11:55:36.863 26541-26541/com.mycrosswod.crossfit E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycrosswod.crossfit/com.mycrosswod.crossfit.gui.WodsListActivity}: android.database.CursorWindowAllocationException: Cursor window allocation of 4096 kb failed. # Open Cursors=379 (# cursors opened by this proc=379)
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycrosswod.crossfit/com.mycrosswod.crossfit.gui.WodsListActivity}: android.database.CursorWindowAllocationException: Cursor window allocation of 4096 kb failed. # Open Cursors=378 (# cursors opened by this proc=378)
방법 :
ArrayList<WodForBuilder> wods = new ArrayList<WodForBuilder>();
Cursor cursor = database.query(MySQLiteHelper.WOD_TABLE,
new String[]{"*"}, null, null, null, null, null);
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
WodForBuilder wod = cursorToWodWithRound(cursor);
wods.add(wod);
cursor.moveToNext();
}
// make sure to close the cursor
if(cursor!=null) {
cursor.close();
}
return wods;
}