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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:46:08+00:00 2026-05-26T05:46:08+00:00

I get Instrument tools in XCode 4 report memory leaks from ASIHttpRequest… I didn’t

  • 0

I get Instrument tools in XCode 4 report memory leaks from ASIHttpRequest… I didn’t be able to figure out the problem, turned our I commented out all my code to handle the result and make the function like below, but xcode still report the same memory leak…

This method is called everytime when I click a button, and I will see more memory leak happen every time when I hit the button. 🙁

- (void) loadData
{
    // no data set, we need to load ourself
    NSURL *url = [self getDataUrl];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];

    ////////////////////////////////////////////////////////////////////
    // set cache policy
    //

    // always store data in cache
    [request setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy];
    // Always ask the server if there is new content available, 
    // If the request fails, use data from the cache even if it should have expired.
    [request setCachePolicy:ASIAskServerIfModifiedWhenStaleCachePolicy|ASIFallbackToCacheIfLoadFailsCachePolicy];


    [request setCompletionBlock:^{
        NSLog(@"[http request] finishing %@", url);

        [self dataDidLoadSuccess];
    }];

    [request setFailedBlock:^{
        NSError *error = [request error];
        NSLog(@"[http request]Failed to perform request to %@: %@", url, error);
        [self dataDidLoadFail:error];
    }];

    [request startAsynchronous];  
}

Following is copied from Instrument detected leaks (only a part):

Leaked Object   #   Address Size    Responsible Library Responsible Frame
__NSMallocBlock__,2 < multiple >    64 Bytes    UIKit   -[UIViewController view]
NSCFString,2    < multiple >    64 Bytes    CFNetwork   HTTPMessage::parseHeadersFromData()
GeneralBlock-16,2   < multiple >    32 Bytes    Foundation  -[NSThread main]
NSRecursiveLock,2   < multiple >    160 Bytes   Foundation  +[NSRecursiveLock allocWithZone:]
NSConcreteMutableData,2 < multiple >    64 Bytes    Foundation  +[NSMutableData(NSMutableData) allocWithZone:]
__NSArrayM,2    < multiple >    64 Bytes    UIKit   -[UIViewController view]
__NSMallocBlock__,2 < multiple >    64 Bytes    UIKit   -[UIViewController view]
__NSArrayM,2    < multiple >    64 Bytes    Foundation  +[NSHTTPCookie _cf2nsCookies:]
__NSOperationInternal,2 < multiple >    288 Bytes   Foundation  -[NSOperation init]
NSCFString,     0xb35fdc0   16 Bytes    CFNetwork   createCapitalizedHeaderString
NSCFString,     0xb35fda0   32 Bytes    CFNetwork   HTTPMessage::extractResponseStatusLine(unsigned char const*, long)
GeneralBlock-32,    0xb35cd10   32 Bytes    CFNetwork   HTTPMessage::internalSetHeader(__CFString const*, __CFString const*, long)
__NSCFArray,    0xb35c550   32 Bytes    CFNetwork   HTTPReadStream::streamEvent(unsigned long)
GeneralBlock-48,    0xb35c520   48 Bytes    CFNetwork   HTTPReadStream::startRequest(CFStreamError*)
GeneralBlock-16,    0xb35c440   16 Bytes    CFNetwork   HTTPReadStream::startRequest(CFStreamError*)
__NSCFInputStream,  0xb35c420   32 Bytes    CFNetwork   HTTPReadStream::startRequest(CFStreamError*)
GeneralBlock-32,    0xb35ba80   32 Bytes    CFNetwork   HTTPReadStream::constructProxyList(CFStreamError*)
__NSCFArray,    0xb35ba60   32 Bytes    CFNetwork   HTTPReadStream::constructProxyList(CFStreamError*)
GeneralBlock-48,    0xb35ba10   48 Bytes    CFNetwork   HTTPMessage::initialize(HTTPMessage*)
CFHTTPMessage,  0xb35b950   80 Bytes    CFNetwork   HTTPReadStream::streamOpen(__CFReadStream*, CFStreamError*, unsigned char*)
GeneralBlock-48,    0xb35b920   48 Bytes    Foundation  -[NSThread main]
__NSCFArray,    0xb35b900   32 Bytes    CFNetwork   HTTPMessage::initialize(HTTPMessage*)
__NSCFArray,    0xb35b8e0   32 Bytes    Foundation  -[NSThread main]
__NSCFArray,    0xb35b8c0   32 Bytes    CFNetwork   HTTPReadStream::startRequest(CFStreamError*)
GeneralBlock-48,    0xb35b610   48 Bytes    Foundation  -[NSThread main]
GeneralBlock-16,    0xb35b5f0   16 Bytes    CFNetwork   HTTPReadStream::streamSetProperty(__CFReadStream*, __CFString const*, void const*)
GeneralBlock-32,    0xb35b5d0   32 Bytes    Foundation  -[NSThread main]
GeneralBlock-32,    0xb35b5b0   32 Bytes    Foundation  -[NSThread main]
NSCFString,     0xb35b590   32 Bytes    Foundation  -[NSURL(NSURL) host]
GeneralBlock-16,    0xb35b570   16 Bytes    CFNetwork   HTTPReadStream::streamSetProperty(__CFReadStream*, __CFString const*, void const*)
__NSCFDictionary,   0xb35b540   48 Bytes    Foundation  -[NSThread main]
__NSCFDictionary,   0xb35b490   48 Bytes    CFNetwork

Screenshot

  • 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-26T05:46:09+00:00Added an answer on May 26, 2026 at 5:46 am

    I’m not sure if this is the problem you’re having or not, but to quote http://allseeing-i.com/ASIHTTPRequest/How-to-use#using_blocks :

      __block ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    

    Note the use of the __block qualifier when we declare the request,
    this is important! It tells the block not to retain the request, which
    is important in preventing a retain-cycle, since the request will
    always retain the block.

    So try adding the __block qualifier, and retest and see if you still have the problem…

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

Sidebar

Related Questions

The Leaks Instrument in Xcode shows me an memory leak here. I have commented
We get a large amount of data from our clients in pdf files in
I get a URL from a user. I need to know: a) is the
I get an XML file From a web service. Now I want to get
I want to instrument my UPC program with PAPI APIs to get information on
The Leaks instrument is sounding the alarm on some code, but I don't know
I could use some help interpreting results from the Instruments Leaks tool. This is
it is possible on the iPhone to get the memory consumption for a specific
I'm trying to get something like 20101231235959 (yyyyMMddhhmmss) from a datetime value in a
I need to get the statistical details( memory details, object allocations etc.) , when

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.