• 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: Memory management question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory management question


  • Subject: Re: Memory management question
  • From: Jerry Krinock <email@hidden>
  • Date: Sat, 27 Mar 2004 10:00:34 -0800

I know this thread has been dead for a few days, but it took me that long to
study it and all the referenced articles.

I have a question regarding the use of accessor methods for "object instance
variables", (which I prefer to call "objects within objects").

I understand the recommendation to use fancy setter methods, with their
pattern of retain, release, copy; and I also understand the arguments for
and against using autorelease there instead of release.

But I don't understand the recommendation to use the getter method:

- (NSSomeType*)foo
{
return foo;
}

and the advice to always use the getter method

[self foo]

instead of just a direct reference

foo

when using foo in other methods in the class.

What's the effective difference between these two expressions? All I can
see is that the getter has the overhead of a message, while the direct
reference does not and should run faster.

Jerry Krinock
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Memory management question
      • From: Andreas Mayer <email@hidden>
    • Re: Memory management question
      • From: Alastair Houghton <email@hidden>
References: 
 >Re: Memory management question (From: Alastair Houghton <email@hidden>)

  • Prev by Date: NSTableView tooltips
  • Next by Date: Re: NSTableView tooltips
  • Previous by thread: Re: Memory management question
  • Next by thread: Re: Memory management question
  • Index(es):
    • Date
    • Thread