Re: object ownership question
Re: object ownership question
- Subject: Re: object ownership question
- From: Bob Savage <email@hidden>
- Date: Mon, 02 Jul 2001 23:37:50 -0700
Peter Ammon wrote:
>
after your code is done and control
>
is returned to the main event loop, it will be released.
I am still somewhat confused about two things here:
1. What do you mean by "return"? Do you mean any method that returns, or do
you mean backing completely out of a nest of method calls, until you don't
have control over the code anymore? I would assume the latter <-- GUESS
This is important because I want to know whether it is okay to do this:
id anOBJ = [supplier gimmeAnOBJ]; // do I need a retain here?
theNUM = [anotherOBJ returnSomething];
[anOBJ doSomething];
Does the returnSomething method call potentially invalidate the non-retained
instance anOBJ?
2. Another question about memory: What happens if I forget to release some
object before the application terminates? Is that memory still occupied
until a reboot, or will it get freed automatically at the end of the
process?
Thanks,
Bob