• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: object ownership question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: object ownership question
      • From: Peter Ammon <email@hidden>
  • Prev by Date: Re: Very simple Cocoa question
  • Next by Date: Re: NSThread and memory management
  • Previous by thread: Re: object ownership question
  • Next by thread: Re: object ownership question
  • Index(es):
    • Date
    • Thread