release cache in MKMapView










0















I have a map based app, that uses the MKMapView as main view.
While my iPad is connected to Xcode, I can see in the debug navigator that the memory usage keeps increasing when zooming and panning around the map. I suppose iOS is caching the map tiles, but doesn't release them before the MkMapView is destroyed.



Is there any way to force MkMapView to clear all cache?



If I continue to pan and zoom around my app finally crashes when memory usage is at 3Gb.










share|improve this question






















  • Possible duplicate of How to clear the cache of mkmapview

    – dengApro
    Nov 14 '18 at 1:19















0















I have a map based app, that uses the MKMapView as main view.
While my iPad is connected to Xcode, I can see in the debug navigator that the memory usage keeps increasing when zooming and panning around the map. I suppose iOS is caching the map tiles, but doesn't release them before the MkMapView is destroyed.



Is there any way to force MkMapView to clear all cache?



If I continue to pan and zoom around my app finally crashes when memory usage is at 3Gb.










share|improve this question






















  • Possible duplicate of How to clear the cache of mkmapview

    – dengApro
    Nov 14 '18 at 1:19













0












0








0


1






I have a map based app, that uses the MKMapView as main view.
While my iPad is connected to Xcode, I can see in the debug navigator that the memory usage keeps increasing when zooming and panning around the map. I suppose iOS is caching the map tiles, but doesn't release them before the MkMapView is destroyed.



Is there any way to force MkMapView to clear all cache?



If I continue to pan and zoom around my app finally crashes when memory usage is at 3Gb.










share|improve this question














I have a map based app, that uses the MKMapView as main view.
While my iPad is connected to Xcode, I can see in the debug navigator that the memory usage keeps increasing when zooming and panning around the map. I suppose iOS is caching the map tiles, but doesn't release them before the MkMapView is destroyed.



Is there any way to force MkMapView to clear all cache?



If I continue to pan and zoom around my app finally crashes when memory usage is at 3Gb.







ios caching mkmapview






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 20:52









ZifigoZifigo

737




737












  • Possible duplicate of How to clear the cache of mkmapview

    – dengApro
    Nov 14 '18 at 1:19

















  • Possible duplicate of How to clear the cache of mkmapview

    – dengApro
    Nov 14 '18 at 1:19
















Possible duplicate of How to clear the cache of mkmapview

– dengApro
Nov 14 '18 at 1:19





Possible duplicate of How to clear the cache of mkmapview

– dengApro
Nov 14 '18 at 1:19












1 Answer
1






active

oldest

votes


















0














func applicationDidReceiveMemoryWarning(_ application: UIApplication) 
URLCache.shared.removeAllCachedResponses()



Clears the receiver’s cache, removing all stored cached URL responses.




Are you setting the reuse identifier on your annotation views? (This means the system can detach those views and only keep a small number of views in memory at once. It also increases scrolling performance, because scrolling will reuse the detached views.)



Use this method to get an annotation view to be reused:



// Used by the delegate to acquire a reusable annotation view, or create a new view for registered class, in lieu of allocating a new one.
open func dequeueReusableAnnotationView(withIdentifier identifier: String) -> MKAnnotationView?





share|improve this answer

























  • I tried firing that every 5 seconds, doesn't change anything. Memory usage still grows.

    – Zifigo
    Nov 14 '18 at 17:56











  • firing that every 5 seconds is intuitive, and a little weird.

    – dengApro
    Nov 15 '18 at 1:30











  • I have a scheduled task that runs every 5 seconds, so I added it there for testing, to see if it would keep memory usage from growing if constantly panning through the maps.

    – Zifigo
    Nov 15 '18 at 6:44










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289325%2frelease-cache-in-mkmapview%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














func applicationDidReceiveMemoryWarning(_ application: UIApplication) 
URLCache.shared.removeAllCachedResponses()



Clears the receiver’s cache, removing all stored cached URL responses.




Are you setting the reuse identifier on your annotation views? (This means the system can detach those views and only keep a small number of views in memory at once. It also increases scrolling performance, because scrolling will reuse the detached views.)



Use this method to get an annotation view to be reused:



// Used by the delegate to acquire a reusable annotation view, or create a new view for registered class, in lieu of allocating a new one.
open func dequeueReusableAnnotationView(withIdentifier identifier: String) -> MKAnnotationView?





share|improve this answer

























  • I tried firing that every 5 seconds, doesn't change anything. Memory usage still grows.

    – Zifigo
    Nov 14 '18 at 17:56











  • firing that every 5 seconds is intuitive, and a little weird.

    – dengApro
    Nov 15 '18 at 1:30











  • I have a scheduled task that runs every 5 seconds, so I added it there for testing, to see if it would keep memory usage from growing if constantly panning through the maps.

    – Zifigo
    Nov 15 '18 at 6:44















0














func applicationDidReceiveMemoryWarning(_ application: UIApplication) 
URLCache.shared.removeAllCachedResponses()



Clears the receiver’s cache, removing all stored cached URL responses.




Are you setting the reuse identifier on your annotation views? (This means the system can detach those views and only keep a small number of views in memory at once. It also increases scrolling performance, because scrolling will reuse the detached views.)



Use this method to get an annotation view to be reused:



// Used by the delegate to acquire a reusable annotation view, or create a new view for registered class, in lieu of allocating a new one.
open func dequeueReusableAnnotationView(withIdentifier identifier: String) -> MKAnnotationView?





share|improve this answer

























  • I tried firing that every 5 seconds, doesn't change anything. Memory usage still grows.

    – Zifigo
    Nov 14 '18 at 17:56











  • firing that every 5 seconds is intuitive, and a little weird.

    – dengApro
    Nov 15 '18 at 1:30











  • I have a scheduled task that runs every 5 seconds, so I added it there for testing, to see if it would keep memory usage from growing if constantly panning through the maps.

    – Zifigo
    Nov 15 '18 at 6:44













0












0








0







func applicationDidReceiveMemoryWarning(_ application: UIApplication) 
URLCache.shared.removeAllCachedResponses()



Clears the receiver’s cache, removing all stored cached URL responses.




Are you setting the reuse identifier on your annotation views? (This means the system can detach those views and only keep a small number of views in memory at once. It also increases scrolling performance, because scrolling will reuse the detached views.)



Use this method to get an annotation view to be reused:



// Used by the delegate to acquire a reusable annotation view, or create a new view for registered class, in lieu of allocating a new one.
open func dequeueReusableAnnotationView(withIdentifier identifier: String) -> MKAnnotationView?





share|improve this answer















func applicationDidReceiveMemoryWarning(_ application: UIApplication) 
URLCache.shared.removeAllCachedResponses()



Clears the receiver’s cache, removing all stored cached URL responses.




Are you setting the reuse identifier on your annotation views? (This means the system can detach those views and only keep a small number of views in memory at once. It also increases scrolling performance, because scrolling will reuse the detached views.)



Use this method to get an annotation view to be reused:



// Used by the delegate to acquire a reusable annotation view, or create a new view for registered class, in lieu of allocating a new one.
open func dequeueReusableAnnotationView(withIdentifier identifier: String) -> MKAnnotationView?






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 15 '18 at 1:24

























answered Nov 14 '18 at 1:18









dengAprodengApro

1,06411122




1,06411122












  • I tried firing that every 5 seconds, doesn't change anything. Memory usage still grows.

    – Zifigo
    Nov 14 '18 at 17:56











  • firing that every 5 seconds is intuitive, and a little weird.

    – dengApro
    Nov 15 '18 at 1:30











  • I have a scheduled task that runs every 5 seconds, so I added it there for testing, to see if it would keep memory usage from growing if constantly panning through the maps.

    – Zifigo
    Nov 15 '18 at 6:44

















  • I tried firing that every 5 seconds, doesn't change anything. Memory usage still grows.

    – Zifigo
    Nov 14 '18 at 17:56











  • firing that every 5 seconds is intuitive, and a little weird.

    – dengApro
    Nov 15 '18 at 1:30











  • I have a scheduled task that runs every 5 seconds, so I added it there for testing, to see if it would keep memory usage from growing if constantly panning through the maps.

    – Zifigo
    Nov 15 '18 at 6:44
















I tried firing that every 5 seconds, doesn't change anything. Memory usage still grows.

– Zifigo
Nov 14 '18 at 17:56





I tried firing that every 5 seconds, doesn't change anything. Memory usage still grows.

– Zifigo
Nov 14 '18 at 17:56













firing that every 5 seconds is intuitive, and a little weird.

– dengApro
Nov 15 '18 at 1:30





firing that every 5 seconds is intuitive, and a little weird.

– dengApro
Nov 15 '18 at 1:30













I have a scheduled task that runs every 5 seconds, so I added it there for testing, to see if it would keep memory usage from growing if constantly panning through the maps.

– Zifigo
Nov 15 '18 at 6:44





I have a scheduled task that runs every 5 seconds, so I added it there for testing, to see if it would keep memory usage from growing if constantly panning through the maps.

– Zifigo
Nov 15 '18 at 6:44



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289325%2frelease-cache-in-mkmapview%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo