SQLite的内存不足时preparing update语句 [英] Sqlite Out of Memory when preparing update statement

查看:1774
本文介绍了SQLite的内存不足时preparing update语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我的申请。

I have one problem with my application.

我创建下载文件列表从服务器一个AsyncTask的。当所有的文件都下载后,我更新数据库。但是,当我打电话给更新查询它给我下面的错误。

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 when i called the update query its give me the below error.

这是为0x0时失败21(内存不足)
  preparing更新

Failure 21 (out of memory) on 0x0 when preparing update

可为什么这个错误发生时任何一个告诉我?

Can any one tell me why this error occurs ?

public void setStatus(int index)
{
    try
    {
        db.OpenDatabase();
        db.updateStatus(id.get(index), 1);
        db.closeDatabase();
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }
}

以上内容来自于AsyncTask的调用函数....

Above function called from the AsyncTask ....

public void updateStatus(int id,int status)
{
    try
    {
        db.execSQL("update sample set status =" + status + " where id = " + id);
    }
    catch(Exception e){e.printStackTrace();}
}


推荐答案

此可以不涉及到数据库的pe本身,而是这样的事实:在存储器(堆)几乎充满和打开数据库完全填满它。

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.

请记住,大多数手机都堆48MB甚至更少。

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

这篇关于SQLite的内存不足时preparing update语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆