Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6620369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:05:25+00:00 2026-05-25T21:05:25+00:00

How do I autorelease a CFMutableDictionary? I’m creating it like this: self.mappingByMediatedObject = CFDictionaryCreateMutable(NULL,

  • 0

How do I autorelease a CFMutableDictionary?

I’m creating it like this:

self.mappingByMediatedObject = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);

And in dealloc:

self.mappingByMediatedObject = nil;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:05:26+00:00Added an answer on May 25, 2026 at 9:05 pm

    CoreFoundation doesn’t have a notion of autorelease– that’s a Cocoa-level construct. However, for the objects that are “toll-free” bridged across worlds like strings and the collection classes, you can get the same result by casting the CF reference to its corresponding Cocoa reference, and sending it the -autorelease message, like this:

    [(NSDictionary *)aDictionaryRef autorelease];
    

    In your case, though, you might not really want to use autorelease here, because you’re not handing back the reference for a Cocoa caller. Why not be a little more explicit around your allocation instead and just releasing it after setting it, like this:

    CFDictionaryRef mapping = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
    self.mappingByMediatedObject = mapping;
    CFRelease(mapping);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not using Autorelease. When I use like this code, I don't know How
Is there an autorelease analogous method for CGPDFDocumentRef instances? I'd like to apply this
{ seViewController *seView = [[[seViewController alloc] initWithNibName:@seViewController bundle:nil] autorelease]; [[self navigationController] pushViewController:seView animated:YES]; [seView
UIBarButtonItem *doneitem=[[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(donePressed:)]autorelease]; self.navigationItem.rightBarButtonItem=doneitem; This is the code of my app, I
I've created autorelease pool. localString has added to this pool. I released the pool.
i have used autorelease throughout my app and would like to understand the behavior
Foo *oFoo = [[[Foo alloc] init] autorelease]; This is how I was taught to
Possible Duplicate: Does every thread need its own autorelease pool? I would like to
employeeDetailed = [[[EmployeeDetailedViewController alloc] initWithNibName:@EmployeeDetailedViewController bundle:nil] autorelease]; UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:employeeDetailed] autorelease];
UIImageView *tblBG = [[[UIImageView alloc] initWithFrame:self.view.bounds] autorelease]; tblBG setImage:[UIImage imageNamed:@evt_det_bg.png]]; self.tableView.backgroundView=tblBG; I want this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.