Re: Memory management puzzle
Re: Memory management puzzle
- Subject: Re: Memory management puzzle
- From: Jens Miltner <email@hidden>
- Date: Thu, 27 Nov 2008 14:23:08 +0100
Am 27.11.2008 um 03:49 schrieb DKJ:
I've got something this in my code, which is run several times by
the app:
UIView *subView = [[MyView alloc] initWithFrame:frame];
[theView addSubview:subView];
[subView release];
Later on this happens:
[subView removeFromSuperView];
subView = nil;
These two code snippets are in different controller methods. I'm
certain they're called the same number of times.
The docs say that subView gets a release message when
removeFromSuperview is called. But the NSLog statement I put in the
dealloc method for MyView is never called. The ObjectAlloc
instrument shows the count of MyView instances increasing by 1 each
time the code is run. And the Leaks instrument shows no leaks at all.
Enable refcount tracking ("Record reference counts" option for the
ObjectAlloc instrument) and see who retains and releases your MyView
instance. This will get you a nice stacktrace for each call to retain,
release or dealloc...
There might be other objects holding on to the view.
HTH,
</jum>
_______________________________________________
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