Home > Archive > Objective C > March 2005 > Memory managment
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Ole Andre Karlson 2005-03-16, 4:05 pm |
| Hi,
ObjectAlloc tells me that each time I perform a certain task in my
application, 3 new objects of a specific type are created never to
disapear.
When I use the instance browser and look at the objects I see they all
have four events registerd.
AllocationEvent
ObjectRetainedEvent
ObjectReleasedEvent
ObjectReleasedEvent
In my simple understanding of objective-c this should bring their
retaincount to 0, and thus they should be dealloced.
Under what circumstances will an object with retaincount 0 not be
dealloced?
thanks
Ole Andre Karlson
ole@cognita.no
| |
| Michael Ash 2005-03-16, 4:05 pm |
| Ole Andre Karlson <oleaka@ifi.uio.no> wrote:
> Hi,
>
> ObjectAlloc tells me that each time I perform a certain task in my
> application, 3 new objects of a specific type are created never to
> disapear.
>
> When I use the instance browser and look at the objects I see they all
> have four events registerd.
>
> AllocationEvent
> ObjectRetainedEvent
> ObjectReleasedEvent
> ObjectReleasedEvent
>
> In my simple understanding of objective-c this should bring their
> retaincount to 0, and thus they should be dealloced.
>
> Under what circumstances will an object with retaincount 0 not be
> dealloced?
Commonly when this happens when you've overridden -dealloc but forgot to
call [super dealloc]; at the end. Since object deallocation is simply a
method in the superclass, not something handled by the compiler,
forgetting to call [super dealloc] means that the deallocation code will
never run.
| |
| Ole Andre Karlson 2005-03-16, 4:05 pm |
| thanks, that was it :)
what a silly mistake...
Ole
> Ole Andre Karlson <oleaka@ifi.uio.no> wrote:
>
> Commonly when this happens when you've overridden -dealloc but forgot to
> call [super dealloc]; at the end. Since object deallocation is simply a
> method in the superclass, not something handled by the compiler,
> forgetting to call [super dealloc] means that the deallocation code will
> never run.
>
|
|
|
|
|