Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Tilde expansion in paths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tilde expansion in paths



On Oct 31, 2006, at 3:15 PM, David Walters wrote:

http://developer.apple.com/documentation/CoreFoundation/Conceptual/ CFMemoryMgmt/CFMemoryMgmt.html


so, using the output of a CFCreate type function (in this case copyfilesystempath) as an anonymous "stack variable" results in the failure to CFRelease the return value of that function.

The rules in the memory management doc are simple, and this isn't an exception to them.


The "stack variable" is just a "pointer" (reference) whose underlying storage you have to release your reference too.

So do we say, don't use CFCreate functions on anonymous vars ?

The rules are simple enough that adding special cases to them overcomplicates things.


The memory management rules say that if you create something, you must release it. Ergo, you must store it in a local or equivalent so that you can do so when you are done with the object.

how does CFURLCopyFileSystemPath know what allocator to use?

Presumably it uses the same allocator that was used to create the URL. You can check the open source CF code if you are curious.


Jim

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Tilde expansion in paths (From: Dair Grant <email@hidden>)
 >Re: Tilde expansion in paths (From: Philip Aker <email@hidden>)
 >Re: Tilde expansion in paths (From: Jerry <email@hidden>)
 >Re: Tilde expansion in paths (From: Philip Aker <email@hidden>)
 >Re: Tilde expansion in paths (From: Laurence Harris <email@hidden>)
 >Re: Tilde expansion in paths (From: David Walters <email@hidden>)
 >Re: Tilde expansion in paths (From: Jim Correia <email@hidden>)
 >Re: Tilde expansion in paths (From: David Walters <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.