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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:41:13+00:00 2026-05-22T00:41:13+00:00

I have a question on the topic of memory management. When I create a

  • 0

I have a question on the topic of memory management. When I create a
NSMutableURLRequest and I release it, after the method return the application crash.

If I remove the line with release on NSMutableURLRequest the application works. But it let memory leak.

What´s wrong?

This is the code:

- (NSString *) callServerWhaitReturn {

    NSMutableURLRequest * theRequest = [ NSMutableURLRequest requestWithURL: [NSURL URLWithString: self.internalUrl] cachePolicy: NSURLRequestUseProtocolCachePolicy timeoutInterval: 60.0];

    [theRequest setHTTPMethod: @"POST"];
    [theRequest setHTTPBody:[[NSString stringWithFormat:@"p1=%@", self.parameters] dataUsingEncoding: NSASCIIStringEncoding]];
    NSURLResponse * response;
    NSError * error;
    NSData * result = [NSURLConnection sendSynchronousRequest: theRequest returningResponse: &response error: &error];
    NSString * toReturn = [[[NSString alloc] initWithData: result encoding:NSASCIIStringEncoding] autorelease];
    NSLog(@"%@", toReturn );
    [theRequest release];
    if (response) {
        [response release];
    }
    if (result) {
        [result release];
    }
    [toReturn autorelease];
    return toReturn;
}
  • 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-22T00:41:14+00:00Added an answer on May 22, 2026 at 12:41 am

    requestWithURL:cachePolicy:timeoutInterval: returns an autoreleased object. If you haven’t retained it, you shouldn’t be releasing it.

    Here are the memory management rules.

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

Sidebar

Related Questions

I have the tables question, topic and question_has_topic (many-to-many relationship). In my application admins
I have question related to what is done in SMS application is if i'm
i have question on this topic i think that answer is incorrect look Swap
I have the following database: CREATE TABLE QUESTION ( QUES_ID INTEGER AUTO INCREMENT, TOPIC_ID
I'm doing a compiler design class on the topic of memory management. I am
My DB have two tables - Question and Topic. To implement many-to-many relation, there
I'm afraid I have a question on a detail of a rather oversaturated topic,
I have a question about regex/Python. Sorry if this topic has been discussed millions
I have a topic/question concerning your upload filename standards, if any, that you are
I have read the topic about pointer, but i still have some question. //

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.