cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you an educator? Well we want to hear from you, so check out some tools we think might help you out 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: 

Getting OutOfMemoryException when downloading

Getting OutOfMemoryException when downloading

Ryan F.17
New member | Level 1

Hello,

I wrote a quick console app using Dropbox.NET with the intent of downloading particular files or folders from Dropbox (for archival purposes, etc...there are multiple reasons).

However, I quickly ran into an issue when it tried to download a 1GB file. I receive an OutOfMemoryException. Here is the code that I use:

---------------

private async Task DownloadFile(string dropboxPath, string targetPath) {
    using (var response = await _dbx.Files.DownloadAsync(dropboxPath)) {
        using (var source = await response.GetContentAsStreamAsync()) {
            using (var target = File.Create(targetPath)) {
                await source.CopyToAsync(target);
            }
        }
    }
}

---------------

This code does work for smaller files, and I know my system itself is not out of memory (have over 8 GB still available). Am I doing something wrong?

Please advise...thanks!

Ryan

3 Replies 3

Re: Getting OutOfMemoryException when downloading

Greg-DB
Dropboxer

Thanks for the report Ryan! This looks like a bug in the SDK. We're looking into it.

Re: Getting OutOfMemoryException when downloading

Greg-DB
Dropboxer

This should be fixed in version 2.2.3. Please update and let me know if you're still seeing any issues. 

Re: Getting OutOfMemoryException when downloading

Ryan F.17
New member | Level 1

The fix did indeed take care of the problem. Thanks so much for such a speedy resolution!

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Ryan F.17 New member | Level 1
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?