Search code examples
iphoneipadmkmapviewlow-memory

MKMapView: Received memory warning. Level=2


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?


Solution

  • 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.