OK, thanks. I got that one figured out. Now I'm seeing another issue that may be related where I show a UIView by instantiating the view controller:
statsViewController = [[StatsViewController alloc] init]; statsViewController.view.alpha = 0; [win addSubview:statsViewController.view]; ... then in the view controller I create the view: statsView = [[StatsView alloc] initWithFrame:CGRectMake(14, 55, 292, 371)]; self.view = statsView; [statsView release]; // some other things are added to self.view here... So this view fades in, then starts a 3 second timer at which point it fades back out. Once it has faded out it dispatches an NSNotificationCenter event, the handler of which releases the viewcontroller. The dealloc method is then called in the viewcontroller and the view -- I confirmed this by putting an NSLog in each of the dealloc methods, and they both get written out, so they should be completely dropped from memory at this point. But when I run this in ObjectAlloc, a bunch of parts of the view are still showing as 'created and still living'. It's very odd considering the deallocs are both called so nothing should be hanging around. I wonder if it's a similar issue as before since it's an NSTimer that triggers the view to fade out and get removed from memory? I tried clicking the mouse around afterwards per Peter's previous suggestion, but it didn't help. I'm not sure how I'd use a NSAutoreleasePool in this case. Is this the same issue, or another one? Workarounds or fixes? Thanks On Wed, Apr 22, 2009 at 10:46 PM, Peter N Lewis <pe...@stairways.com.au>wrote: > 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 (Cocoa-dev@lists.apple.com) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/vardpenguin%40gmail.com > > This email sent to vardpeng...@gmail.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com