Re: timers and background memory management
Re: timers and background memory management
- Subject: Re: timers and background memory management
- From: Chris Kane <email@hidden>
- Date: Thu, 28 Feb 2002 15:42:55 -0800
I don't know if there's a GOOD way to deal with this, but one way is to
start periodic NSEvents, for say once every minute or so (faster if
necessary, but not too fast). That will cause the AppKit event loop to
cycle and it to purge its autorelease pools.
Chris Kane
Cocoa Frameworks, Apple
On Thursday, January 31, 2002, at 10:51 AM, Matt Neuburg wrote:
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/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.