Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fishkorp

macrumors 68030
Original poster
Apr 10, 2006
2,536
650
Ellicott City, MD
I'm working on something where the app will fetch data from a URL and populate a table with the results. I'm trying to get it to fetch if the app is open at an interval (say every 10 minutes for this example). I have that all setup using an NSTimer and it works. My issue is memory. I'm not sure what I should be releasing or reallocating and when. On my dev phone I installed the program, opened it up, and just let it run. After a while (hours) it crashes, I'm assuming out of memory (didn't check the log yet, I had to leave and I don't have access to the phone or XCode until later today). The current flow is:

Open app->makes request->parses response->populates table.

Every 10 minutes it will remake the request->parse response->populate table if response is different.

I'm assuming I'm missing something very simple? Are there any Apple provided examples that do something similar that I missed?
 

fishkorp

macrumors 68030
Original poster
Apr 10, 2006
2,536
650
Ellicott City, MD
Looking at what's happening, I'm (inadvertently) calling the scheduledTimerWithTimeInterval every time through :eek: So first time it repeats after x minutes, next time it repeats twice, then three times, etc. Can easily make a crash like that, lol.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.