Re: timers and background memory management
Re: timers and background memory management
- Subject: Re: timers and background memory management
- From: Allan Odgaard <email@hidden>
- Date: Fri, 1 Feb 2002 02:48:59 +0100
On torsdag, januar 31, 2002, at 07:51 , Matt Neuburg wrote:
> My app generates a lot of timers (NSTimer), and it runs in the
background.
Maybe you could re-use them instead of instantiating new ones all the
time (as this certainly has an overhead, even when autoreleasing works)?
> [...] So is there a way to jog the autorelease process and force them
to be
> released even in the background? Thx - m.
You can setup your own auto release pool like this:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
And then release it (and all objects added to the pool in between) like
this:
[pool release];
Effectively this is probably what the NSRunLoop does when your
application is active. Have a look at "Programming topic: Memory
Management" for more details.
Regards Allan
--
http://www.diku.dk/students/duff/