开发者

sqlite query results in crash in iPhone app - Memory Issue

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 app开发者_高级运维lication. 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")


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.


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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜