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 7955793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:47:54+00:00 2026-06-04T03:47:54+00:00

I ran into this problem while trying to fix a memory leak with the

  • 0

I ran into this problem while trying to fix a memory leak with the facebook-ios-sdk. How do i handle this situation when passing objects from no arc compiled classe to arc enabled classe?

This is the code inside the non arc compiled Facebook library: (i removed the unnecessary stuff which is not related to the problem) as you can see, result object is not autoreleased or released.

- (void)handleResponseData:(NSData *)data {        
    NSError* error = nil;
    id result = [self parseJsonResponse:data error:&error];
    self.error = error;

    // Call the defined delegate wich is my AppDelegate didLoad method wich is arc enabled
    [_delegate request:self didLoad:result];
}

- (id)parseJsonResponse:(NSData *)data error:(NSError **)error {
    SBJSON *jsonParser = [[SBJSON alloc] init];

    //gets the object wich leaks or gets overreleased
    id result = [jsonParser objectWithString:responseString];
    [jsonParser release];

    return result;
}

Now if i try to add autorelease to the result object, i am facing a NSZombie when my arc code in my AppDelegate try’s to release the object. However if i leave the code like this i’m facing memory leaks whit the result object which gets not released.

am i missing something basic? i can’t get my head around this?

Thanx for any advice! Chris

  • 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-06-04T03:47:55+00:00Added an answer on June 4, 2026 at 3:47 am

    The result returned from -parseJsonResponse:... is autoreleased already (see note at bottom).

    Since the name of the -parseJson method doesn’t begin with new, alloc, copy or mutableCopy, the compiler assumes that it returns an object with a +0 reference count, meaning it needs to be retained by the calling code if it is to be kept around, and doesn’t need to be released if it’s not being kept around. That’s a long winded way of saying that it should neither leak nor cause a crash in your ARC code as written in your question.

    Passing objects between ARC code and manual reference counting code doesn’t require any special handling. You just need to make sure that methods’ names match their memory management semantics in the non-ARC code. It certainly seems like you’ve done that in this case, although as you say, you didn’t post your complete code.

    Note: Presumably, objectWithString: returns an autoreleased object. If it doesn’t it, it should (because it doesn’t start with alloc, new, copy, mutableCopy).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While trying to automate testing with selenium rc I ran into this problem. I
I ran into this problem while developing in Objective-C for iOS, but this should
Ran into this error message while trying to select some records off a table.
I ran into a problem while trying to parse an XML string returned from
I've ran into a weird problem while trying to send a JSON command to
Never ran into this problem with jQuery before. I have the following: $(document).ready(function() {
I ran into this problem and I cant solve it. Basically Im making an
All, I ran into this problem where for a UITextField that has secureTextEntry=YES, I
I ran into this concurrency problem which I've been scratching my head for several
I ran into a problem with some C code like this: struct SomeType {

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.