• 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: Guidelines for Cocoa frameworks supporting garbage collection?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guidelines for Cocoa frameworks supporting garbage collection?


  • Subject: Re: Guidelines for Cocoa frameworks supporting garbage collection?
  • From: "Sean McBride" <email@hidden>
  • Date: Mon, 7 Jul 2008 13:30:30 -0400
  • Organization: Rogue Research

On 7/5/08 2:56 PM, Chris Hanson said:

>For example, this pseudocode is wrong under GC:
>
>   - (NSURL *)someURL {
>       NSURL *URL = (NSURL *)CFURLCreate...(...);
>       return [URL autorelease];
>   }
>
>It will leak, because the runtime will "eat" the -autorelease message
>when running under GC.

Which reminds me of something else Bill might want to watch out for:
Apple's leak finding tools ('leaks', Instruments, Malloc Debug) do not
work with GC apps.  They report so many false positives that they are
unworkable (except for Malloc Debug, which just crashes).  So if your
code uses malloc/new/NewPtr of whatever, you'll have a hard time finding
leaks.

Also, I second the recommendation to stay away from finalize.  I've used
it exactly twice: 1) to call DisposeHandle() to 2) to call NSLog.

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Guidelines for Cocoa frameworks supporting garbage collection? (From: Bill Cheeseman <email@hidden>)
 >Re: Guidelines for Cocoa frameworks supporting garbage collection? (From: Chris Hanson <email@hidden>)

  • Prev by Date: Re: NSButton in a NSPanel's top-right corner?
  • Next by Date: Re: garbage collection and NSConnection
  • Previous by thread: Re: Guidelines for Cocoa frameworks supporting garbage collection?
  • Next by thread: Re: Guidelines for Cocoa frameworks supporting garbage collection?
  • Index(es):
    • Date
    • Thread