Vaibhav Tekam
Vaibhav Tekam

Reputation: 2344

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 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")

Upvotes: 2

Views: 907

Answers (3)

Akshay
Akshay

Reputation: 5765

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.

Upvotes: 2

Aquertu
Aquertu

Reputation: 174

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.

Upvotes: 2

Ankit Srivastava
Ankit Srivastava

Reputation: 12405

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?

Upvotes: 2

Related Questions