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

Re: CFDictionary


  • Subject: Re: CFDictionary
  • From: Glen Low <email@hidden>
  • Date: Wed, 3 Mar 2004 07:20:07 +0800

> I'm having a memory management problem with CFDictionary. I am using
> the System Configuration Framework to disable proxy settings. I've
> attached the appropriate code segments.
>
> Everything works fine if I don't release any memory that's given to me.
> But when I try to do the right thing, it seg faults. I've narrowed the
> problem down to the place where I copy the old proxy info. Freeing the
> original dictionary causes strangeness when the copy is used later.
> If I leak the original, though, it works fine.

The documentation says:

If you receive an object from any Core Foundation function other than a
creation or copy function, such as a Get function, you cannot be
certain of the objects life span. For example, if the objects
containing or owning object is deallocated the contained object is
deallocated too. To ensure the persistence of such an object you can
retain it (using the CFRetain function) or, in some cases, copy it.

Therefore you shouldn't be calling CFRelease on it as you've done in
your code.


Cheers, Glen Low


---
pixelglow software | simply brilliant stuff
www.pixelglow.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Re: NSArray cluster class membership
  • Next by Date: Dynamic cursor rectangles?
  • Previous by thread: Re: CFDictionary
  • Next by thread: Resource fork question
  • Index(es):
    • Date
    • Thread