FROM : Hamish Allan
DATE : Thu Jan 24 22:30:04 2008
On Jan 24, 2008 8:48 PM, Ian was here <<email_removed>> wrote:
> >From what I gathered from the documentation, the
> returned array of top level objects are autoreleased,
> meaning that they would need to be retained by the
> array containing them.
This is a misreading of the documentation, which states that the
returned array (not the objects within it) is autoreleased.
Your code:
> [topLevelNibObjects copy];
causes all the objects in the array to have their retain count
increased (which is why you need that makeObjectsPerformSelector:
call), but does not keep a reference to the copy, and the original
array, which is autoreleased (as per the documentation) is dealloced
next time round the run loop (though by chance you seem to be getting
away with it when you send it a message in your dealloc).
It's not clear to me how this relates to the problem with your object,
but what is clear to me is that you're too happy to try to "work
around" memory management issues, without understanding *why* you're
having them, so I'd hazard a guess that your problem is caused by not
understanding how some other part of your code affects your object's
life cycle.
Hamish
DATE : Thu Jan 24 22:30:04 2008
On Jan 24, 2008 8:48 PM, Ian was here <<email_removed>> wrote:
> >From what I gathered from the documentation, the
> returned array of top level objects are autoreleased,
> meaning that they would need to be retained by the
> array containing them.
This is a misreading of the documentation, which states that the
returned array (not the objects within it) is autoreleased.
Your code:
> [topLevelNibObjects copy];
causes all the objects in the array to have their retain count
increased (which is why you need that makeObjectsPerformSelector:
call), but does not keep a reference to the copy, and the original
array, which is autoreleased (as per the documentation) is dealloced
next time round the run loop (though by chance you seem to be getting
away with it when you send it a message in your dealloc).
It's not clear to me how this relates to the problem with your object,
but what is clear to me is that you're too happy to try to "work
around" memory management issues, without understanding *why* you're
having them, so I'd hazard a guess that your problem is caused by not
understanding how some other part of your code affects your object's
life cycle.
Hamish
| Related mails | Author | Date |
|---|---|---|
| Ian was here | Jan 24, 18:23 | |
| Hamish Allan | Jan 24, 19:37 | |
| Keary Suska | Jan 24, 19:39 | |
| Ian was here | Jan 24, 21:48 | |
| Hamish Allan | Jan 24, 22:30 | |
| Keary Suska | Jan 24, 23:01 | |
| Ken Thomases | Jan 25, 17:56 | |
| Keary Suska | Jan 27, 17:53 |






Cocoa mail archive

