• 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: Garbage Collection, Core Foundation, and the -finalize problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Garbage Collection, Core Foundation, and the -finalize problem


  • Subject: Re: Garbage Collection, Core Foundation, and the -finalize problem
  • From: Michael Tsai <email@hidden>
  • Date: Mon, 16 Mar 2009 14:32:49 -0400

On Mar 16, 2009, at 2:08 PM, Bill Cheeseman wrote:

I am looking for a strategy to avoid implementing a -finalize method in a garbage-collected Objective-C class that declares a CFTypeRef- style Core Foundation instance variable. I believe this is a fairly common problem, because any Cocoa wrapper class for a Core Foundation API would have to do it, but I haven't seen a usable solution. Apple's GC documentation stops just short of suggesting an answer.


I believe you're supposed to declare your CFTypeRef ivar as __strong and call CFMakeCollectable so that the garbage collector will be responsible for releasing it. You can still use CFRelease in -dealloc for when you aren't running under garbage collection.

--Michael


_______________________________________________

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


  • Follow-Ups:
    • Re: Garbage Collection, Core Foundation, and the -finalize problem
      • From: Bill Cheeseman <email@hidden>
    • Re: Garbage Collection, Core Foundation, and the -finalize problem
      • From: Bill Cheeseman <email@hidden>
References: 
 >Garbage Collection, Core Foundation, and the -finalize problem (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: Re: case-insensitive NSDictionary
  • Next by Date: Working with weekdays on NSDate, NSDateComponents, NSCalendar and NSValueTransformer
  • Previous by thread: Garbage Collection, Core Foundation, and the -finalize problem
  • Next by thread: Re: Garbage Collection, Core Foundation, and the -finalize problem
  • Index(es):
    • Date
    • Thread