Re: Bundles, CFStrings and release/retain
Re: Bundles, CFStrings and release/retain
- Subject: Re: Bundles, CFStrings and release/retain
- From: Marc Poirier <email@hidden>
- Date: Wed, 20 Aug 2003 08:15:14 -0500 (CDT)
I would really recommend just taking the time to read at least the general
CoreFoundation documentation:
http://developer.apple.com/documentation/CoreFoundation/CoreFoundation.html
At the very least, I would read through these two topics:
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFDesignConcepts/
http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/
The short answer to your questions is: If you don't release when you
should, you will leak memory. If you release when you shouldn't, you will
probably cause crashes. If you read the CoreFoundation docs, you will
learn how to use CoreFoundation properly and prevent both of those
problems. :)
Marc
On Wed, 20 Aug 2003, John Pitcairn wrote:
>
I'm using a lot of static CFStrings grabbed from a bundle .strings
>
file, to allow the user to define parameter names, # of parameters,
>
min/max/default values, and indexed values where needed. I'm using
>
the sample code provided in SampleEffectUnit, with only slight
>
modification/expansion to allow for more parameters.
>
>
There's a comment in the sample code:
>
>
> // NOTE: Don't release the bundle. It is autoreleased.
>
> sLocalized = true;
>
> }
>
> // !!MSH- check documentation to see whether we
>
>recommend releasing
>
> string properties after they are returned from properties
>
>
and Bill Stewart wrote recently:
>
>
>kAudioUnitProperty_ParameterValueName ->
>
>AudioUnitParameterValueName
>
> typedef struct AudioUnitParameterValueName {
>
> AudioUnitParameterID inParamID;
>
> Float32 *inValue;
>
> CFStringRef outName;
>
> } AudioUnitParameterValueName;
>
> Get
>
> - should be released by caller
>
> (So, if AU has static CFStrings for these, it
>
>should call CFRetain
>
> on these names before returning them)
>
>
So - I guess my AU should be doing something in respect to
>
releasing/retaining stuff, yes? What happens if I don't? And do I
>
have to worry about just the CFStrings I actually supply to the host,
>
or all the CFStrings I load for my own purposes that the host never
>
sees? I'm really hazy on the whole memory-management issue - is there
>
an AU example somewhere that demonstrates this in a reasonably
>
idiot-friendly way?
>
>
>
--
>
John Pitcairn
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.