timers and background memory management
timers and background memory management
- Subject: timers and background memory management
- From: Matt Neuburg <email@hidden>
- Date: Thu, 31 Jan 2002 10:51:13 -0800
My app generates a lot of timers (NSTimer), and it runs in the background.
The trouble is that autoreleasing of timers doesn't take place when the app
is in the background, so they are piling up. It appears that there is no
way around this, because as far as I can tell, timers are memory-managed in
a special way that is out of the programmer's hands. I do invalidate my
timers, of course, but I can't actually release them myself because I
didn't create them with alloc. Timers can only be created with the class
methods timerWith... and scheduledTimerWith...; there is no alloc-init way
to make a timer.
I can see with ObjectAlloc that as soon as my app comes to the front all
the piled-up timers are released. But that's not going to happen. So is
there a way to jog the autorelease process and force them to be released
even in the background? Thx - m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes gar anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/