Android出现CursorWindow: Window is full: requested allocation 1354087 bytes, free space 141032 bytes,

在使用SQLiteDatabase插入一个比较大的数据时,抛出如下异常:

 W/CursorWindow: Window is full: requested allocation 1354087 bytes, free space 141032 bytes, window size 2097152 bytes

如下图所示:
1

这是因为:
Android SQLite在光标返回行的窗口是指定了一个最大大小为2MB的config_cursorWindowSize值,如果你的行大小超过此限制,你会得到这个错误。无论如何,在SQLite数据库存储大量的数据是不是一个好主意,应在数据库中放置文件系统和存储文件的路径。

【Android SQLite returns rows in cursor windows that have the maximum size of 2MB as specified by config_cursorWindowSize. If your row exceeds this limit, you’ll get this error.
Storing large data in sqlite database is not a good idea anyway. Store files in filesystem and paths in database.】

在Android源码中config_cursorWindowSize值定义如下:
sdk\platforms\android-23\data\res\values\configs.xml:

<!-- When a database query is executed, the results retuned are paginated in pages of size (in KB) indicated by this value -->
    <integer name="config_cursorWindowSize">2048</integer>
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值