• 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: question about retain/release
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question about retain/release


  • Subject: Re: question about retain/release
  • From: Ed Watkeys <email@hidden>
  • Date: Mon, 22 Dec 2003 14:27:47 -0500

On Dec 22, 2003, at 12:46 PM, Thierry Bucco wrote:

Hi evereybody,

I have a little question.

[...]

In several documentation I have read that I have to release every
object I allocate, copy or retain.
So, why newTitle isn't released on this example ?

Because you (should) release it in your dealloc method. If you keep a reference to an object, you should retain it; otherwise it may get released out from under you. Fully understanding retain counts and auto-release pools is extremely important to writing software that doesn't crash or leak memory. Others may have preferred books or web sites for explaining how this works, but I found the discussion in COCOA PROGRAMMING FOR MAC OS X by Hillegass enlightening:

http://www.amazon.com/exec/obidos/tg/detail/-/0201726831

Obsolescence warning: the second edition will be released in April. Perhaps someone else can link to an equally clear on-line resource.

Regards,
Ed
_______________________________________________
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: 
 >question about retain/release (From: Thierry Bucco <email@hidden>)

  • Prev by Date: RE: question about retain/release
  • Next by Date: Re: [OT] True multiuser?
  • Previous by thread: RE: question about retain/release
  • Next by thread: Re: question about retain/release
  • Index(es):
    • Date
    • Thread