android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. … run time error in titanium app

You must Login before you can answer or comment on any questions.

android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. # Open Cursors=741 (# cursors opened by this proc=741) run time error in titanium app this error come when execution time of query or coming data isti too large

— asked 2 years ago by Alok Gupta
2 Comments
  • Do you have the full log?

    Best,

    Mauro

    — commented 2 years ago by Mauro Parra

  • I'm getting the same error, but on my case it's happening because I encapsulated my queries on the function below:

    function runQuery(sql){
        var db = Ti.Database.open('weatherDB');
        var sqlObject = db.execute(sql);
        db.close();
        return sqlObject;
    }
    The error shows when I call two queries at the exact same time. If I do two queries, each inside an different setTimeout, I get the error.
    setTimeout(function(){
        runQuery('SELECT * FROM weather');
    }, 3000);
    setTimeout(function(){
        runQuery('DELETE FROM weather');
    }, 3000);
    If I'd guess, the causes of this error are: 1. Database isn't being opened/closed properly; 2. Titanium isn't locking database when there's queries already running

    — commented 1 year ago by Leonardo Montenegro

Your Answer

Think you can help? Login to answer this question!