• 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 allocation questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory allocation questions


  • Subject: Re: Memory allocation questions
  • From: Ondra Cada <email@hidden>
  • Date: Sun, 28 Jul 2002 18:12:57 +0200

On Sunday, July 28, 2002, at 08:21 , Nathan Day wrote:

- (void)setMainSprocket:(Sprocket *)newSprocket
{
[mainSprocket autorelease];
mainSprocket = [newSprocket retain]; /* Claim the new Sprocket. */
return;
}

You could,

Caveat. You could not.

I don't know why they choose to do it that way

For newSprocket might be the same object as mainSprocket, and it might have a retain count of one, in which case you'd dealloc it first and use afterwards, with all the potential havoc.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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: 
 >Re: Memory allocation questions (From: Nathan Day <email@hidden>)

  • Prev by Date: Re: Asynchronous I/O using NSFileHandle
  • Next by Date: Re: Serial number verification / obfuscation (was: Re: Hiding
  • Previous by thread: Re: Memory allocation questions
  • Next by thread: Re: Memory allocation questions
  • Index(es):
    • Date
    • Thread