MKMapView:收到内存警告。等级=2
我有一个应用程序,它在解析 csv 文件后在内存中缓存相当多的数据,并且还显示 MKMapView。在 MKMapView 中从一端滚动到另一端后,该应用程序不可避免地会给我一个或多个:
Received memory warning. Level=1
Received memory warning. Level=2
最后由于内存不足而崩溃。我一直在试图找出一种管理 MKMapView 内存或我自己的数据(来自 csv 文件 - csv 文件需要经常写入,所以我想将其保存在内存中)的方法如果可能的话,一些时尚或其他,除非有更好的方法来处理这个问题
?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用工具来确定缓存的 CSV 与 MKMapView 相比占用了多少内存。如果 CSV 是问题所在,请考虑使用 CoreData 或 sqlite 存储它。
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.