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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:49:42+00:00 2026-05-23T00:49:42+00:00

I ran the ‘Analyze’ on my code and the result shows a potential memory

  • 0

I ran the ‘Analyze’ on my code and the result shows a potential memory leak on the following part of my code

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]];

//Potential memory leak in code below
[[NSURLConnection alloc] initWithRequest:request delegate:self];

I am not sure how to stop this leak. I tried to add a ‘autorelease’ to the back but that caused a crash. Any advise on this?

EDIT:

Screenshot of the leak message

enter image description here

  • 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-23T00:49:42+00:00Added an answer on May 23, 2026 at 12:49 am

    Your call to alloc on NSURLConnection is returning an object with a reference count of 1. Your code should be as following:

    NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
    [connection start]; // This is optional.  It should begin the request after you alloc it
    

    After you are done with the object, you need to explicitly call:

    [connection release];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran across the following code in Ely Greenfield's SuperImage from his Book component
Ran accross the following code in an article and didn't think it was standard
I ran across the following snippet of code. Names have been changed to protect
Ran across this line of code: FormsAuth = formsAuth ?? new FormsAuthenticationWrapper(); What do
I ran across a tutorial that had the following syntax: rails generate model User
I ran into a situation where I had the following two implementations located in
I ran into a slight coding problem with WordPress template. This is the code
I ran into this code on Wikipedia : (define (pyth x y k) (*
I ran into a little problem. I am creating a web app with code
Ran into a bit of an issue with some jQuery code, but in essence,

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.