Skip navigation.
 
mlRe: Quick and basic retain/release/pointers question
FROM : Fabian Lidman
DATE : Sat Dec 04 16:10:49 2004

> 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.

Related mailsAuthorDate
mlQuick and basic retain/release/pointers question Keith Blount Dec 4, 15:56
mlRe: Quick and basic retain/release/pointers question Fabian Lidman Dec 4, 16:10
mlRe: Best way to debug (was retain/release/pointers question) Keith Blount Dec 4, 20:16
mlRe: Best way to debug (was retain/release/pointers question) Jonathan Jackel Dec 5, 03:33
mlRe: Best way to debug (was retain/release/pointers question) M. Uli Kusterer Dec 5, 16:00
mlRe: Best way to debug (was retain/release/pointers question) Keith Blount Dec 5, 20:26