cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

[Swifty] File download memory management

New member | Level 1
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
Highlighted

Re: [Swifty] File download memory management

Dropboxer
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.

Highlighted

Re: [Swifty] File download memory management

New member | Level 1
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!

Highlighted

Re: [Swifty] File download memory management

Dropboxer
Dropboxer

Thanks! We'll look into it.

Highlighted

Re: [Swifty] File download memory management

New member | Level 1
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.")

                    }

                }

        }

    }

Highlighted

Re: [Swifty] File download memory management

Dropboxer
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.

Highlighted

Re: [Swifty] File download memory management

New member | Level 1
New member | Level 1

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

Highlighted

Re: [Swifty] File download memory management

New member | Level 1
New member | Level 1

Is there any fix for this

Highlighted

Re: [Swifty] File download memory management

Dropboxer
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.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?