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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:10:03+00:00 2026-06-14T05:10:03+00:00

Im downloading some gzipped xml files from a server, save it to the documents

  • 0

Im downloading some gzipped xml files from a server, save it to the documents folder and unzip every file. After that I delete the .gz file. I do that in a loop for more or less 500 files. When im using instruments, I see that the live bytes more or less are 470MB after this process. When Im waiting some seconds, the ARC clears it and the application is going to 5mb live bytes. But because its a synchronization process my app gets a memory warning right after that when I dont stop after the downloading and unzipping. At least I think it should be possible to force the ARC to release the memory? Or do I have a real bad code and I am just still dont see that?

Any help or hint is really appreciated.

Downloading and unzipping:

for(NSString *filePath in filePaths){
    NSString *localPath = [[DownloadManager sharedInstance] downloadFile:filePath];
    if(localPath){
        //downloaded correctly
        if([self unzipFileAtPath:localPath]){
            [FileUtility deleteFileAtPath:localPath];
        }
    }
}

Unzip method:

+ (BOOL)unzipFileAtPath:(NSString *)path
{
    NSData *gzData = [NSData dataWithContentsOfFile:path];
    NSData *ungzippedData = [gzData gunzippedData];

    BOOL success = [ungzippedData writeToFile:[FormatUtility pathWithoutGz:path] atomically:NO];
    ungzippedData = nil;
    gzData = nil;

    return success;
}
  • 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-14T05:10:04+00:00Added an answer on June 14, 2026 at 5:10 am

    Wrap the inside of your for-loop with an autorelease pool:

    for (NSString* filePath in filePaths) {
        @autoreleasepool {
            // do work
        }
    }
    

    The problem actually has nothing to do with ARC. Methods like dataWithContentsOfFile: will return a new autoreleased object instance. These objects will not be released until the enclosing autorelease pool is drained, which by default only happens at the end of your thread/operation or when you return to the run-loop.

    When you allocate many temporary objects in a loop, like you’re doing, you should use your own autorelease pool to ensure that these temporary objects do not accumulate needlessly.

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

Sidebar

Related Questions

I am downloading some file Audio/Video/PDF from amazon S3 server. What I am doing
I am downloading some contents from the server and after sometimes the screen is
I am downloading some very large data from a server with the NSURLConnection class.
I am creating an application wherein I am downloading some data from server. While
In my application I am downloading some images from the web (from my server
I have UI which displaying status of long-running operations (downloading some text files from
How could I avoid git of downloading specified some files from main repository? I
What are some tips on downloading a single file from a GitHub repo? I
After downloading and installing exuberant ctags, I get some issues hinting that the ctags
In my application i m downloading some (mp4 or mp3 ) files from the

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.