本文介绍了iphone sqlite 页面缓存增长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 sqlite 数据库进行存储.还有许多数据库事务.我的问题是 sqlite 页面缓存的内存使用量迅速增长.在 instruments 我可以找到这一行

I use sqlite database for storage. There are many database transactions as well. My problem is that the memory usage grows rapidly for sqlite page cache. In instruments i could find this line

Graph   Category                 Live Bytes   # Living # Transient  Overall Bytes   
0       VM: SQLite page cache    12.12 MB     97       1434         191.38 MB   

里面有 97 个以下文件

and inside it i have 97 of following files

#   Address     Category                Timestamp     Live  Size        Responsible Library     Responsible Caller
0   0x4c06000   VM: SQLite page cache   00:49.241.377   •   128.00 KB   libsystem_kernel.dylib  vm_allocate
1   0x5002000   VM: SQLite page cache   01:41.203.588   •   128.00 KB   libsystem_kernel.dylib  vm_allocate
2   0x5515000   VM: SQLite page cache   01:41.255.275   •   128.00 KB   libsystem_kernel.dylib  vm_allocate
3   0x5535000   VM: SQLite page cache   01:41.309.973   •   128.00 KB   libsystem_kernel.dylib  vm_allocate
4   0x5565000   VM: SQLite page cache   01:41.358.003   •   128.00 KB   libsystem_kernel.dylib  vm_allocate
5   0x55c8000   VM: SQLite page cache   01:41.407.916   •   128.00 KB   libsystem_kernel.dylib  vm_allocate
6   0x568f000   VM: SQLite page cache   01:41.451.870   •   128.00 KB   libsystem_kernel.dylib  vm_allocate
7   0x570d000   VM: SQLite page cache   01:41.501.194   •   128.00 KB   libsystem_kernel.dylib  vm_allocate
8   0x573d000   VM: SQLite page cache   01:41.550.465   •   128.00 KB   libsystem_kernel.dylib  vm_allocate

任何导致此问题或如何删除这些文件的想法将不胜感激.谢谢!

any idea what causes this or how to remove those files will be greatly appreciated.Thank you!

推荐答案

找到答案了,这只是一个sqlite的select方法,我错误地放了sqlite3_close(mySqliteDB);而不是 sqlite3_finalize(statement);

Found the answer, It's just a sqlite select method that I mistakenly put sqlite3_close(mySqliteDB); instead of sqlite3_finalize(statement);

这篇关于iphone sqlite 页面缓存增长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 12:59