• 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: Calling autorelease on CFAllocated objects?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling autorelease on CFAllocated objects?


  • Subject: Re: Calling autorelease on CFAllocated objects?
  • From: "Adam R. Maxwell" <email@hidden>
  • Date: Wed, 09 Jul 2008 15:44:40 -0700

On Wednesday, July 09, 2008, at 03:12PM, "Wade Tregaskis" <email@hidden> wrote:
>> I have a memory management question. I was looking at the QCTV
>> example on from the quicktime site. It has some code that does the
>> following:
>>
>> ICMCompressionSessionOptionsRef options;
>>
>> ..
>>
>> Do some work
>> ..
>>
>> return (ICMCompressionSessionOptionsRef)[(id)options autorelease];
>>
>> Can you do this with CoreFoundation allocated things that are not
>> bridged?
>
>Autorelease pools ultimately just invoke -(void)release on the
>objects.  If the object is not a true ObjC object or a bridged CF
>object, this will not work.  I'm not sure what the result will be -
>whether it'll crash or do nothing or what.  Fair to say the result is
>undefined and invariably bad.

Since ICMCompressionSessionOptionsGetTypeID returns a CFTypeID, ICMCompressionSessionOptionsRef is apparently a CFType.  As such, autorelease should work with it:

http://www.cocoabuilder.com/archive/message/cocoa/2008/7/5/212046

I wish this were better documented; the Search Kit docs show autorelease being sent to an SKDocumentRef, also, and that's always made me nervous (I think I actually sent feedback on that one a long time ago).

--
Adam
_______________________________________________

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: Calling autorelease on CFAllocated objects?
      • From: Wade Tregaskis <email@hidden>
References: 
 >Calling autorelease on CFAllocated objects? (From: Scott Andrew <email@hidden>)
 >Re: Calling autorelease on CFAllocated objects? (From: Wade Tregaskis <email@hidden>)

  • Prev by Date: Re: Quick look preview multipage rich text
  • Next by Date: Re: Quick look preview multipage rich text
  • Previous by thread: Re: Calling autorelease on CFAllocated objects?
  • Next by thread: Re: Calling autorelease on CFAllocated objects?
  • Index(es):
    • Date
    • Thread