cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We love to hear how every person gets the most from Dropbox, and it seems everyone has a slightly different use for it - tell us yours 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: 

[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

Re: [Swifty] File download memory management

Greg-DB
Dropboxer

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.

Re: [Swifty] File download memory management

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!

Re: [Swifty] File download memory management

Greg-DB
Dropboxer

Thanks! We'll look into it.

Re: [Swifty] File download memory management

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.")

                    }

                }

        }

    }

Re: [Swifty] File download memory management

Greg-DB
Dropboxer

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.

Re: [Swifty] File download memory management

sunil t.
New member | Level 1

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

Re: [Swifty] File download memory management

sunil t.
New member | Level 1

Is there any fix for this

Re: [Swifty] File download memory management

Stephen C.14
Dropboxer

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.

Who's talking

Top contributors to this post

  • User avatar
    Stephen C.14 Dropboxer
  • User avatar
    sunil t. New member | Level 1
  • User avatar
    Greg-DB Dropboxer
  • User avatar
    sigrem New member | Level 1
What do Dropbox user levels mean?
Need more support?