简体   繁体   English

SKMaps,当从iOS收到内存警告时清除地图数据的内存缓存的方法?

[英]SKMaps, way to clear in-memory cache for map data when receiving memory warning from iOS?

I have an iOS app using the Skobbler Map Framework (SKMaps). 我有一个使用Skobbler Map Framework(SKMaps)的iOS应用程序。 I found that it uses a lot of memory. 我发现它占用了大量内存。 Granted, the UIViewController where I added the mapView is heavy without the mapView already, but it was working fine with SKMaps framework version 2.5.1. 当然,我没有添加mapView的UIViewController很沉重,但是在SKMaps框架2.5.1版中可以正常工作。 I was using light maps. 我正在使用光照贴图。

Now, since 3.0 light maps are no longer available and I have to use the full maps. 现在,由于3.0光照贴图不再可用,因此我必须使用完整的贴图。 Now quite some users are reporting crashes while navigating (sometimes after 10 minutes, sometimes after 3 hours, etc). 现在,许多用户在导航时报告崩溃(有时是10分钟后,有时是3小时后,等等)。 After (a lot of) analysis turns out these are memory related (my app shows up as the largestProcess in the JetsamEvent logs with reason "vnode-limit"). 经过(大量)分析后,这些与内存有关(我的应用程序显示为JetsamEvent日志中最大的进程,原因为“ vnode-limit”)。

I've already stripped about everything I can from my own app elements and data structures, but the SKMaps framework is still like 85% of my app's total memory usage. 我已经从我自己的应用程序元素和数据结构中剥离了所有可能的东西,但是SKMaps框架仍然占我应用程序总内存使用量的85%。 I've also implemented didReceiveMemoryWarning and added what I can for my own elements. 我还实现了didReceiveMemoryWarning并为自己的元素添加了我所能做的。 I also did a lot of memory analysis with instruments and the Xcode 8 memory graph. 我还使用仪器和Xcode 8内存图进行了很多内存分析。 No leaks found. 找不到泄漏。

My guess is that it's related to the full map vs the light map in 2.5.1. 我的猜测是它与2.5.1中的完整贴图和光照贴图有关。

Is there a way to clear (or reduce) the in-memory cache of SKMaps upon receiving a memory warning? 有没有收到内存警告时清除(或减少)SKMap的内存缓存的方法?

The size of the map tiles cached on the device could cause the problem. 设备上缓存的地图图块的大小可能会导致此问题。 In this case, SKTilesCacheManager class might help you. 在这种情况下,SKTilesCacheManager类可能会为您提供帮助。 It provides advanced management for the tiles caching mechanism. 它提供了切片缓存机制的高级管理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM