Skip to content Skip to sidebar Skip to footer

Sqlite Out Of Memory When Preparing Update Statement

I have one problem with my application. I create a one AsyncTask for downloading list of files from server . When all the files are download after that i update the database. But w

Solution 1:

This may not be related to the database pe se, but rather to the fact that the memory (heap) is almost full and opening the database completely fills it up.

Remember that most handsets have 48MB of heap or even less.


Solution 2:

Sometime while working I also got the same error.

I used this link

"Failure 21 (out of memory)" when performing some SQLite operations

It said that this error occurs when you try to work on a closed DB. I looked back into my code and found that I was also doing the same. Got it working afterwards

I think you are also trying to work on a closed DB.


Solution 3:

Have you tried to use the update() method instead of execSQL()?

public void updateStatus(int id,int status)
{
    try
    {
         ContentValues values = new ContentValues();
         values.put("status", status);
         db.update ("sample", values, "id = ?", new String[]{Integer.toString(id)});
    }
    catch(Exception e){e.printStackTrace();}
}

Solution 4:

I has "out of memory" error (21) when I try to call sqlite3_prepare() with a NULL pointer to database handle. Check if your handle is valid and the database is opened.


Post a Comment for "Sqlite Out Of Memory When Preparing Update Statement"