Re: ObjectAlloc and objects that should have been released
Re: ObjectAlloc and objects that should have been released
- Subject: Re: ObjectAlloc and objects that should have been released
- From: Peter N Lewis <email@hidden>
- Date: Thu, 23 Apr 2009 13:46:28 +0800
On 23/04/2009, at 10:19 , Miles wrote:
I have a timer that continues calling a method that for the moment
(testing
purposes) only contains:
NSArray *tmp = [NSArray arrayWithArray:animatingTilesArray];
The time is setup like this:
animationTimer = [NSTimer scheduledTimerWithTimeInterval:0.5
target:self
selector:@selector(doAnimation:) userInfo:nil repeats:YES];
When I run this in ObjectAlloc, it shows that every instance of the
'tmp'
array created above is 'created and still living'. Considering it's an
auto-released array shouldn't there only be zero or one still living?
If you are only running a timer, you may be running in to the issue
described at:
<http://www.cocoabuilder.com/archive/message/cocoa/2008/12/16/225553>
The run loop autorelease pool is not released for timer events.
If so, you should see all your objects disappear as soon as you do a
UI action in your app, like click the mouse.
You have two possible solutions:
* Periodically post an event to your app.
* Create and release an NSAutoreleasePool in your timer method.
Enjoy,
Peter.
--
Run macros from your iPhone with Keyboard Maestro Control!
or take a break with Derzle for your iPhone
Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
Aragom Space War <http://www.stairways.com/iphone/aragom> Don't get
killed!
Derzle <http://www.stairways.com/iphone/derzle> Enjoy a relaxing puzzle.
<http://www.stairways.com/> <http://download.stairways.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden