cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: [Swifty] File download memory management

[Swifty] File download memory management

James Z.3
New member | Level 1

I noticed that for every GB I download to local file system via  client.files.download, the app's memory usage increase by that amount. I imagine the Dropbox client doesn't keep the file in memory after it downloads the file, so it must be something that the rest of my app is doing. Can you confirm? Thanks.

8 Replies 8

Greg-DB
Dropbox Staff

Hi James, that certainly would be unexpected and non-ideal, and I'm not aware of any other such reports. If it doesn't seem to be something your app is doing though, we'd be happy to look into it. The version number of the SDK you're using and the relevant code snippet(s) would be useful in that case.

James Z.3
New member | Level 1

Hi Greg, thanks for the quick response. Here's a gist of what the app tries to do. It downloads an mp3 file and tries to extract its metadata. I'm on 2.0.2 right now. Thanks!

Greg-DB
Dropbox Staff

Thanks! We'll look into it.

sigrem
New member | Level 1

Hi, We are seeing a similar issue when downloading files from Dropbox using Swifty Dropbox. The memory usage increases gradually to almost 2/3 of the file size by around 1 MB/sec. For example for a file of size 320 MB the memory usage goes from 40 MB (when download started) to 240 MB and stays there until the download is finished:

    let destination : (NSURL, NSHTTPURLResponse) -> NSURL = { temporaryURL, response in

        let localUrl = NSURL(fileURLWithPath: self.localPath)

        return localUrl

    }

    if let client = Dropbox.authorizedClient {

        client.files.download(path: dbPath, destination: destination).response

            {

                response, error in

                if let (metadata, url) = response {

                    if error != nil {

                        NSlog("Dropbox download failed. \(error!.description)", .Error)

                    }

                    else {

                        NSlog("Dropbox file downloaded.")

                    }

                }

        }

    }

Greg-DB
Dropbox Staff

Thanks for the additional information sigrem! I don't have an update on this right now, but I'll follow up on this thread when I do.

sunil t.
New member | Level 1

I also faced the same problem when download from Dropbox the file size increases

sunil t.
New member | Level 1

Is there any fix for this

Stephen C.14
Dropbox Staff

Hi Sunil, we looked into this issue on our end and were not able to reproduce it, even in the case of large file downloads. SwiftyDropbox does not handle any memory management -- memory is managed by a third-party networking library, AlamoFire.

You might also want to double check your memory usage levels. Xcode's simulator is known to be unreliable about showing accurate memory usage levels. I would be sure to test memory usage on an actual device as well.

Additionally, we will be distributing a new version of SwiftyDropbox in the next week. I would encourage you to adopt the new version when it is released, as it might address the issue for you as well.

Need more support?