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.
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 mails | Author | Date |
|---|---|---|
| Keith Blount | Dec 4, 15:56 | |
| Fabian Lidman | Dec 4, 16:10 | |
| Keith Blount | Dec 4, 20:16 | |
| Jonathan Jackel | Dec 5, 03:33 | |
| M. Uli Kusterer | Dec 5, 16:00 | |
| Keith Blount | Dec 5, 20:26 |






Cocoa mail archive

