• 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: I think I get most of the memory stuff but...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I think I get most of the memory stuff but...


  • Subject: Re: I think I get most of the memory stuff but...
  • From: "Tony S. Wu" <email@hidden>
  • Date: Sun, 4 May 2003 19:04:20 -0700

Imagine if clientCode and aString is the same object and you didn't retain aString first.
Yes, when you are going to retain it, it's already released.

Tony S. Wu
email@hidden

"The world doesn't give us hope - it gives us chance."
http://homepage.mac.com/tonyswu/tonyswu - My web page.



On Sunday, May 4, 2003, at 06:41 PM, Theodore Petrosky wrote:

These conversations on memory management are useful
but one issue has never been discussed. why do I have
to retain a passed in value.

in a common setter....

-(void)setClientCode:(NSString *) aString {
[aString retain];
[clientCode release];
clientCode=aString;
}

I assume that aString is a convenience construct that
is autoreleased. Why do I have to retain it? Why
doesn't it live through the method? I finally
understand the autorelease mechanics. I just do get
why I need to retain aString.

Ted

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
_______________________________________________
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.
_______________________________________________
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.

References: 
 >I think I get most of the memory stuff but... (From: Theodore Petrosky <email@hidden>)

  • Prev by Date: Re: I think I get most of the memory stuff but...
  • Next by Date: NSEvent and mouseDown:
  • Previous by thread: Re: I think I get most of the memory stuff but...
  • Next by thread: NSEvent and mouseDown:
  • Index(es):
    • Date
    • Thread