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

  • Home
  • SEARCH
  • 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 6753399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:09:23+00:00 2026-05-26T13:09:23+00:00

For the program below i get the following error- Potential leak of an object

  • 0

For the program below i get the following error-
Potential leak of an object allocated on line 50.
Line 50 points to this line–
self.receivedData = [[NSMutableData data] retain];
I tried to release receiveData after this statement but that gives me an error “object sent autorelease too many times.” I am not sure if i am doing it the right way.Please help!

   - (void)viewDidLoad {

        NSURLRequest *theRequest = 
        [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://{your ip}:8080/activiti-rest/service/process-definitions?start=0&size=10&sort=id&order=asc"]                            cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
                     timeoutInterval:10.0];

        NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

        if (theConnection) {       

            self.receivedData = [[NSMutableData data] retain];

        } else {


            UIAlertView *connectFailMessage = [[UIAlertView alloc] initWithTitle:@"NSURLConnection " message:@"Failed in viewDidLoad"  delegate: self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
            [connectFailMessage show];
            [connectFailMessage release];

        }

        [theConnection autorelease];

    }

Edit : In the header file it is declared as @property(nonatomic,assign) NSMutableData *receivedData;
New
It works after i removed this line[theConnection autorelease]. I kept the assign property as is in the header file and added the [self.receiveData release] like you asked.It did not work earlier because i kept this line [theConnection autorelease].I added it because i was wondering if i have to release theConnection object also.Can you please explain why that doesn’t have to released?It is not released anywhere in the code and it still works??

  • 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-26T13:09:24+00:00Added an answer on May 26, 2026 at 1:09 pm

    Without seeing more code, the analyzer may potentially be confused.

    Where is your balancing -release? In -dealloc?

    Why is this property not retain in the first place?


    You should be releasing the object in -dealloc, too. And you still haven’t answered why the object is not retain — that seems distinctly odd.

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

Sidebar

Related Questions

I get the following error on a self-signed jar: jar verified. Warning: This jar
Why doesn't func3 get executed in the program below? After func1, func2 doesn't need
Below is my program and I am trying to get the call stack when
having trouble getting my directx going I get the following error 1>Linking... 1>main.obj :
When I run the program below on my Mac (OS/X 10.6.4), I get the
When trying to start up my Android AVD emulator, I get the following error
The two programs below get n integers from file and calculates the sum of
The program below prints: my name is:null my name is:null Someclass static init AFAIK
I am using the program below to sort and eventually print out email messages.
In the program below, there are two things that I don't understand. How can

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.