title: Cursor window allocation of 2048 kb failed
body: <p>I am using this <a href="https://github.com/j256/ormlite-android" rel="nofollow">library</a> for database operations. I faced an exception. When i try to run 
  "contentsDao.queryForAll();", i got "Cursor window allocation of 2048 kb failed." exception.</p>
  
  <p>My Code:</p>
  
  <pre><code>private Dao contentsDao = getDao(L_Content.class); 
  public List getAllContents(String searchQuery)
      {
          try {
              if (searchQuery == null) {
                  return contentsDao.queryForAll();
              } else {
                  if (contentsQuery == null) {
                      contentsQuery= makeContentsQuery(false);
                  }
                  String nameParameter = searchQuery == null ? "%%" : "%"+searchQuery.trim()+"%";
                  contentsQuery.setArgumentHolderValue(0,nameParameter);
                  return contentsDao.query(contentsQuery);
              }
          } catch (SQLException e){
              e.printStackTrace();
              return null;
          }
      }
  </code></pre>
  
  <p>Logcat output:</p>
  
  <pre><code>Fatal Exception: android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. 
  at android.database.CursorWindow.(CursorWindow.java:108)
  at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
  at android.database.sqlite.SQLiteCursor.clearOrCreateWindow(SQLiteCursor.java:316)
  at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:142)
  at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:136)
  at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:197)
  at android.database.AbstractCursor.moveToFirst(AbstractCursor.java:237)
  at com.j256.ormlite.android.AndroidCompiledStatement.getCursor(AndroidCompiledStatement.java:163)
  at com.j256.ormlite.android.AndroidCompiledStatement.runQuery(AndroidCompiledStatement.java:57)
  at com.j256.ormlite.stmt.SelectIterator.(SelectIterator.java:55)
  at com.j256.ormlite.stmt.StatementExecutor.buildIterator(StatementExecutor.java:232)
  at com.j256.ormlite.stmt.StatementExecutor.query(StatementExecutor.java:181)
  at com.j256.ormlite.stmt.StatementExecutor.queryForAll(StatementExecutor.java:113)
  at com.j256.ormlite.dao.BaseDaoImpl.queryForAll(BaseDaoImpl.java:239)
  at ak.detaysoft.yeryuzudergidis.DatabaseApi.getAllContents(DatabaseApi.java:469)
  at ak.detaysoft.yeryuzudergidis.DataApi.isLibraryMustBeEnabled(DataApi.java:201)
  at com.artifex.mupdfdemo.MuPDFActivity.onKeyDown(MuPDFActivity.java:2414)
  at android.view.KeyEvent.dispatch(KeyEvent.java:3147)
  at android.app.Activity.dispatchKeyEvent(Activity.java:2831)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2438)
  at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4582)
  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4537)
  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121)
  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087)
  at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4201)
  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095)
  at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4258)
  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121)
  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087)
  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4095)
  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4068)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4121)
  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4087)
  at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4234)
  at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4421)
  at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2480)
  at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2074)
  at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2065)
  at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2457)
  at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
  at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
  at android.os.MessageQueue.next(MessageQueue.java:143)
  at android.os.Looper.loop(Looper.java:130)
  at android.app.ActivityThread.main(ActivityThread.java:5942)
  at java.lang.reflect.Method.invoke(Method.java)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
  </code></pre>
  
  <p><a href="https://github.com/j256/ormlite-android/issues/55" rel="nofollow">https://github.com/j256/ormlite-android/issues/55</a></p>