Wow. In that particular example it was '[UIScreen mainScreen] applicationFrame' that was causing the problem. When I changed that to a CGRectMake, the view was not longer living once I released it. Does '[UIScreen mainScreen] applicationFrame' cause some sort of caching issue?
Now I'm at a point where this is keeping the view around longer than I think it should: NSDictionary *rootDict = [[NSDictionary alloc] initWithContentsOfFile: filePath]; [rootDict release]; Could someone please explain what this is all about? Thanks! On Sun, Apr 26, 2009 at 12:16 PM, Miles <vardpeng...@gmail.com> wrote: > I've narrowed this down to the smallest case I can. > > I have a method that loads a view and immediately releases it: > > UIWindow *win = [UIApplication > sharedApplication].keyWindow; > TestVC *test = [[TestVC alloc] init]; > [win addSubview:test.view]; > [test.view removeFromSuperview]; > [test release]; > > And here is the entire TestVC class: > > #import "TestVC.h" > > @implementation TestVC > > - (id)init > { > self = [super init]; > if (self){} > return self; > } > > // Implement loadView to create a view hierarchy programmatically, without > using a nib. > - (void)loadView { > > UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen > mainScreen] applicationFrame]]; > contentView.backgroundColor = [UIColor blackColor]; > contentView.autoresizesSubviews = YES; > [contentView release]; > } > > - (void)didReceiveMemoryWarning { > [super didReceiveMemoryWarning]; > } > > - (void)dealloc { > [super dealloc]; > } > > @end > > > When I look in ObjectAlloc, TestVC points to the "UIView *contentView" > declaration as created and still living. Is this just an objectAlloc bug, or > is there some other sort of autorelease thing that goes on behind the > scenes? I don't see any reason why this would still be hanging around. > > Ugh. > > > > > > > > > On Fri, Apr 24, 2009 at 7:18 PM, Miles <vardpeng...@gmail.com> wrote: > >> Very interesting, I'll give all that a shot and report back. Thanks so >> much! >> >> >> >> >> On Apr 24, 2009, at 7:07 PM, Peter N Lewis <pe...@stairways.com.au> >> wrote: >> >> On 25/04/2009, at 8:28 , Miles wrote: >>> >>>> I just mean that I'm adding some labels and images to the view. I have >>>> quadruple checked that they are all being released, but I must be >>>> overlooking something. >>>> >>> >>> I doubt its your issue, but I recently had a problem like this that took >>> me far too long to track down. >>> >>> The debugging technique I used was to override retain/release/autorelease >>> and dealloc and have them just call NSLog and super, then set a breakpoint >>> on each, add a backtrace "bt" debugging command and set them to >>> auto-continue. >>> >>> Eventually, after much hair pulling I tracked it down to my >>> removeFromSuperview override neglecting to call super - ouch! >>> >>> But one technique for finding this might be to make a trivial subclass of >>> UIImage that does the above and use it for logo. >>> >>> One other possibility would be - does UIImage cache images created with >>> initWithContentsOfFile? The tehcnique above might tell you if thats what is >>> happening, because you should see UIImage system code adding it to an >>> array/dictiuonary/set and not releasing it later. >>> >>> 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