mercredi 4 mai 2016

App works fine, so can I ignore "CursorWindow: Window is full: requested allocation 12 bytes, free space 4 bytes, window size 2,097,152 bytes"?

I have a 176,000 word SQLite database and an app that searches it (via an IntentService) and works great, never crashing. Even if thousands of "hits" are returned, the user can scroll through the list quickly and seamlessly. But I often-to-maybe-always get the Logcat warning message shown in the Title.

I've use a Cursor to access the database data and a TextView inside a ScrollView, as shown:

<ScrollView
...>
    <TextView
        android:id=                     "@+id/txaMatches"
        android:scrollbars=             "vertical"
    .../>
</ScrollView>

code:

  // initialize, etc.
  Cursor cursor = mdatabase.query(TABLE_NAME, mColumns, whereClause,
                                  wildCardReplacements, null, null, WORD_COLUMN_NAME);
  nRows = cursor.getCount();
  while (n <= prefMaxMatches && i < nRows) {
    cursor.moveToPosition(i);
    // do stuff
  }

But the warning makes me wonder if making a change in the code to get rid of it might improve responsiveness. Some searches take awhile (i.e., output not immediate, but given in a reasonable time period), depending on the Pattern entered (e.g., * must search all 176,000 words). Anyone could live with it, but we always want more speed.

What should I do? Just ignore the warning since it causes no apparent unacceptable action (e.g., crashing, slow execution)? Or what?

Aucun commentaire:

Enregistrer un commentaire