Re: Quick and basic retain/release/pointers question
Re: Quick and basic retain/release/pointers question
- Subject: Re: Quick and basic retain/release/pointers question
- From: Fabian Lidman <email@hidden>
- Date: Sat, 4 Dec 2004 16:10:49 +0100
SomeCusomView *aView = [[SomeCustomView alloc]
initWithFrame:aRect];
[anotherView addSubview:aView];
[aView release];
//...
[aView doThisOrThat];
Your assumptions are correct. Calling [anObject release] the object
only actually releases when the retain count is 0. It is not moved in
memory.
The fact that the runtime complains about a selector not recognized
indicates that the object still 'lives' (otherwise you'd probably get a
SIGBUS or something).
For debugging purposes, use NSLog(@"%d", [anObject retainCount]); to
find out the current retain count of your object.
Clever use of autorelease and nested autorelease pools can save you
some headache. Read Apple's documentation.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden