sqlite 查询导致 iPhone 应用程序崩溃 - 内存问题

发布于 2024-12-06 09:14:15 字数 337 浏览 2 评论 0原文

我正在使用 sqlite 查询从 USDA 数据库获取特定食品的营养值。 在模拟器中尝试时,查询工作正常,但有时会导致设备崩溃。 我将美国农业部数据库包含在应用程序本身中。此外,执行查询的表保存了超过 5 条 lac 记录。我在启动应用程序时收到“1 级内存警告”。我不能选择网络服务,因为要求是提供离线支持。

有什么建议如何处理这种情况吗?

编辑:

在日志中我收到 Signal 0 消息

程序收到信号:“0”。 数据格式化程序暂时不可用,将在“继续”后重试。 (加载共享库“/Developer/usr/lib/libXcodeDebuggerSupport.dylib”时发生未知错误)

I am using a sqlite query to get nutrient values for a specific food item from USDA database.
The query works fine, when tried in simulator, but results in crash on device sometimes.
I am including the USDA database in the app itself. Also the table on which the query is getting executed holds more than 5 lac records. I am getting 'Level 1 Memory Warning' at the launch of application. I cannot go for webservices, as the requirement is to give offline support.

Any suggestions how to handle this situation??

Edit :

In the log I get Signal 0 message

Program received signal: “0”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib")

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

别忘他 2024-12-13 09:14:15

您正在耗尽应用程序的内存。我不是数据库专家,但您将不得不使用一些特殊的技术来访问您庞大的数据库。也许在数据库的不同部分连续执行多个查询。或者将数据库分成段。以下是与您所看到的崩溃相关的一些参考

- 程序收到信号: “0”。数据格式化程序暂时不可用

数据格式化程序暂时不可用

数据格式化程序暂时不可用,将在一段时间后重试'继续'

如果您搜索错误消息,还会有更多内容。

You are exhausting your app's memory. I am not a DB expert but you will have to use some special techniques to access your huge data base. Perhaps execute multiple queries serially in different sections of the DB. Or divide the DB into segments. Following are some references related to the crash you are seeing-

Program received signal: “0”. Data Formatters temporarily unavailable

Data Formatters temporarily unavailable

Data Formatters temporarily unavailable, will re-try after a 'continue'

There are more if you search for the error message.

满天都是小星星 2024-12-13 09:14:15

我猜数据库的大小导致了崩溃......
如果您以只读方式使用此数据库,则可以使用压缩和加密的形式...您可以从此处获取更多详细信息 http://www.hwaci.com/sw/sqlite/cerod.html
这可能会帮助您摆脱内存警告..
这是另一个链接,可以帮助您减小数据库的大小......
如何减小 sqlite3 数据库的大小苹果手机?

I guess the size of the database is causing the crash...
If you are using this database as read only then you can use the compressed and encrypted form ... you can get more details from here http://www.hwaci.com/sw/sqlite/cerod.html
this might help you get rid of the memory warnings..
here is another link which can help you reduce the size of the database....
How to reduce the size of an sqlite3 database for iphone?

逆光飞翔i 2024-12-13 09:14:15

内存相关的崩溃对于 iOS 应用程序来说很常见,我注意到更稳定的应用程序倾向于手动管理内存,而不是让设备管理它。我认为,如果你将其分成几个部分,而不是读取一个文件,并且像 akshay 所说的那样对表建立索引,它会更稳定。您可以尝试从压缩的 zip 中读取文件,这比普通的旧读取更有效率。

Memory Related Crashes are quite common for ios apps I've noticed that more stable apps tend to manually manage memory alot over just letting the device manage it. I think if you split it up into sections instead of reading off one file and like akshay said index the tables it will be more stable. You could try reading files from compressed zips which would be more efficient over just plain old reading.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文