views:

254

answers:

1

I've got an app that caches a pretty decent amount of data in memory after parsing a csv file, and also displays an MKMapView. After scrolling across the country from one end to the other in the MKMapView, the app inevitably gives me one or more:

Received memory warning. Level=1
Received memory warning. Level=2

and finally crashes due to low memory. I've been trying to figure out a means of managing either the memory of MKMapView or my own data (which comes from a csv file - the csv file needs to be written to frequently, so I'd like to keep it in memory in some fashion or other if possible, unless there is a better means of handling the issue.

Any ideas?

+1  A: 

Use instruments to determine how much memory the cached CSV is taking vs the MKMapView. If the CSV is the problem, then look at storing it using CoreData or sqlite.

jojaba
I'm not familiar with core data yet - I've been thinking about learning it though. What will core data do for my memory issues?
JoBu1324
CoreData will allow for you to store your data on disk instead of in memory. This is important if you have too much data to store in memory.
jojaba
Core Data was the answer, and quite the learning experience. It doesn't help much with NSZombieEnabled though!
JoBu1324