• 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: CFReadStreamSetProperty and CFRelease
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFReadStreamSetProperty and CFRelease


  • Subject: Re: CFReadStreamSetProperty and CFRelease
  • From: Quinn <email@hidden>
  • Date: Thu, 7 Oct 2004 17:13:36 +0100

At 9:07 +0000 11/9/04, Trygve Inda wrote:
If I call...

proxyDict = SCDynamicStoreCopyProxies (NULL);

CFReadStreamSetProperty (readStreamRef, kCFStreamPropertyHTTPProxy,
proxyDict);

When can I release proxyDict? Do I need to wait until I am done using the
readStreamRef, or does the CFReadStreamSetProperty copy the proxy data into
the stream, thus allowing me to toss proxyDict?

The CF memory management rules are pretty well documented. The following documents on our web site has a bunch of useful info.


<http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFDesignConcepts/index.html>
<http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/index.html>

Specifically, the "Reference Counting" and "Ownership Policy" sections of the second second document are crucial to understanding any CF-based APIs.

To answer your specific question, you are free to release proxyDict after calling CFReadStreamSetProperty because CFReadStreamSetProperty must either a) add its own reference to proxyDict and be responsible for releasing that reference, or b) make a copy of the info in the proxyDict and be responsible for releasing that copy.

                 *                   *                   *

Modulo bugs, of course (-: It turns out that we just found a bug in CFFTP <rdar://problem/3745574> that is triggered by proxy dict handling. See CFFTPSample for all the details.

<http://developer.apple.com/samplecode/CFFTPSample/CFFTPSample.html>

AFAIK CFRead/WriteStream are not affected by this.

S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Help with MoreSCFSetPortNameCallback Help
  • Next by Date: Re: OT: MPW over MacOS X
  • Previous by thread: Re: Help with MoreSCFSetPortNameCallback Help
  • Next by thread: Re: OT: MPW over MacOS X
  • Index(es):
    • Date
    • Thread