objective c - NSURLConnection being called every second is causing a steady increase of used RAM -


i have timer in applicationdidfinishlaunching calls checkdns() every 1 second.

func applicationdidfinishlaunching(anotification: nsnotification?) {     var timer = nstimer.scheduledtimerwithtimeinterval(refreshfrequencyint, target: self, selector: selector("checkdns"), userinfo: nil, repeats: true) } 

and checkdns function follows:

func checkip() { nsurlconnection.sendasynchronousrequest(request, queue: nsoperationqueue(), completionhandler:{ (response: nsurlresponse!, data: nsdata!, error: nserror!) -> void in // there code api data here issue  // happens when commented out seen here.     }) } 

so far, nothing happening when run application, constant steady increase of used ram @ 15mb / minute.

what doing wrong? there way should doing differently isn't using more , more memory?

edit seems cache issue, have tried put following code in applicationdidfinishlaunching no success:

    let urlcache = nsurlcache(memorycapacity: 0, diskcapacity: 0, diskpath: nil)     nsurlcache.setsharedurlcache(urlcache) 

edit 2 i've run through time profiler , seems heaviest stack related "httpconnectioncacheentry::ingesttube(tube*)" if helps anyone.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -