<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Out of memory with java sdk during uploading (unlimited upload buffer) in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233869#M12769</link>
    <description>Thank you for your help.&lt;BR /&gt;&lt;BR /&gt;I've created a method that analyzes the file and decides which method to use.&lt;BR /&gt;I think that create a single method that implement this logic could be usefull also for other.&lt;BR /&gt;Do you see any limitation to this approach?</description>
    <pubDate>Tue, 25 Jul 2017 05:44:06 GMT</pubDate>
    <dc:creator>SimoneBuzzi</dc:creator>
    <dc:date>2017-07-25T05:44:06Z</dc:date>
    <item>
      <title>Out of memory with java sdk during uploading (unlimited upload buffer)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233149#M12722</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm tring to use the java sdk to move file from pc to dropbox space.&lt;/P&gt;
&lt;P&gt;I've written a method that upload file without problem while they are sufficently small (50MB), but generate a&amp;nbsp;java.lang.OutOfMemoryError: Java heap space when the file is bigger&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the trace thati I obtain&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2271)
at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118)
at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153)
at sun.net.www.http.PosterOutputStream.write(PosterOutputStream.java:78)
at com.dropbox.core.util.IOUtil.copyStreamToStream(IOUtil.java:59)
at com.dropbox.core.util.IOUtil.copyStreamToStream(IOUtil.java:68)
at com.dropbox.core.util.IOUtil.copyStreamToStream(IOUtil.java:43)
at com.dropbox.core.http.HttpRequestor$Uploader.upload(HttpRequestor.java:98)
at com.dropbox.core.DbxUploader.uploadAndFinish(DbxUploader.java:95)
at com.dropbox.core.v2.DbxUploadStyleBuilder.uploadAndFinish(DbxUploadStyleBuilder.java:92)
at it.xxx.cloudLib.CopyToDropBox.upload(CopyToDropBox.java:45)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there the possibiliy to configure the library buffer?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank for your help&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 17:17:03 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233149#M12722</guid>
      <dc:creator>SimoneBuzzi</dc:creator>
      <dc:date>2020-05-29T17:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Out of memory with java sdk during uploading (unlimited upload buffer)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233151#M12723</link>
      <description>Moved to the API forum.</description>
      <pubDate>Thu, 20 Jul 2017 12:35:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233151#M12723</guid>
      <dc:creator>Rich</dc:creator>
      <dc:date>2017-07-20T12:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Out of memory with java sdk during uploading (unlimited upload buffer)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233191#M12725</link>
      <description>Thanks for the report! I don't believe the buffer is configurable, but we'll be happy to look into this issue.&lt;BR /&gt;&lt;BR /&gt;First, what version of the SDK are you using? If you're not already using the latest version (currently v3.0.3) please update to that and try again.&lt;BR /&gt;&lt;BR /&gt;If you're still seeing this issue on the latest version, please let me know, and share the code to reproduce the issue. Thanks in advance!</description>
      <pubDate>Thu, 20 Jul 2017 15:02:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233191#M12725</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-07-20T15:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Out of memory with java sdk during uploading (unlimited upload buffer)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233244#M12729</link>
      <description>&lt;P&gt;Hi Greg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can find a sample project that show the same problem here&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropbox.com/s/54b86x1hgxpup99/dropboxProblem.zip?dl=0" target="_blank"&gt;https://www.dropbox.com/s/54b86x1hgxpup99/dropboxProblem.zip?dl=0&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error generated is&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2271)
at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118)
at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153)
at sun.net.www.http.PosterOutputStream.write(PosterOutputStream.java:78)
at com.dropbox.core.util.IOUtil.copyStreamToStream(IOUtil.java:59)
at com.dropbox.core.util.IOUtil.copyStreamToStream(IOUtil.java:68)
at com.dropbox.core.util.IOUtil.copyStreamToStream(IOUtil.java:43)
at com.dropbox.core.http.HttpRequestor$Uploader.upload(HttpRequestor.java:98)
at com.dropbox.core.DbxUploader.uploadAndFinish(DbxUploader.java:95)
at com.dropbox.core.v2.DbxUploadStyleBuilder.uploadAndFinish(DbxUploadStyleBuilder.java:92)
at it.xxx.cloudLib.CopyToDropBox.upload(CopyToDropBox.java:45)
at it.xxx.cloudLib.CopyFile.main(CopyFile.java:17)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using the last SDK version as you can find in the pom.&lt;/P&gt;
&lt;P&gt;During my test I have experienced the same issue using one of 2.x.x version&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm experiencing the problem using&lt;/P&gt;
&lt;P&gt;Linux XXX&amp;nbsp;3.2.0-126-generic #169-Ubuntu SMP Fri Mar 31 14:15:21 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Java&lt;/P&gt;
&lt;P&gt;java version "1.7.0_80"&lt;BR /&gt;Java(TM) SE Runtime Environment (build 1.7.0_80-b15)&lt;BR /&gt;Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)&lt;BR /&gt;&lt;BR /&gt;I'm compiling for 1.7 version&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I obtain the error trying to uploading a file of 1.1 GB, I know that the maximum size for a file is 5GB, do I hope I can use the SDK till this line&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 19:23:09 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233244#M12729</guid>
      <dc:creator>SimoneBuzzi</dc:creator>
      <dc:date>2017-07-21T19:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Out of memory with java sdk during uploading (unlimited upload buffer)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233388#M12740</link>
      <description>Thanks! That's helpful. We'll look into it.</description>
      <pubDate>Fri, 21 Jul 2017 19:31:07 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233388#M12740</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-07-21T19:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Out of memory with java sdk during uploading (unlimited upload buffer)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233403#M12741</link>
      <description>&lt;P&gt;I just took a look over your last reply and the supplied code, and I notice you mentioned you're trying to upload a 1.1 GB file, but you're using UploadBuilder. For large files, that is, anything bigger than 150 MB, you need to use "upload sessions", per &lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#uploadBuilder-java.lang.String-" target="_self"&gt;the documentation for uploadBuilder&lt;/A&gt;. (You may even want to use upload sessions for files smaller than 150 MB, depending on the scenario.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's &lt;A href=" https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/upload-file/src/main/java/com/dropbox/core/examples/upload_file/Main.java#L68" target="_self"&gt;an example of using upload sessions here&lt;/A&gt;. For reference, using this method, there isn't an overall file size limit. You can upload files of any size, including larger than 5 GB. (Note that this only applies to the&amp;nbsp;Dropbox side. Your local filesystem may have its own limit.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 20:10:27 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233403#M12741</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-07-21T20:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: Out of memory with java sdk during uploading (unlimited upload buffer)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233869#M12769</link>
      <description>Thank you for your help.&lt;BR /&gt;&lt;BR /&gt;I've created a method that analyzes the file and decides which method to use.&lt;BR /&gt;I think that create a single method that implement this logic could be usefull also for other.&lt;BR /&gt;Do you see any limitation to this approach?</description>
      <pubDate>Tue, 25 Jul 2017 05:44:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233869#M12769</guid>
      <dc:creator>SimoneBuzzi</dc:creator>
      <dc:date>2017-07-25T05:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Out of memory with java sdk during uploading (unlimited upload buffer)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233934#M12773</link>
      <description>Programmatically checking the file size to determine which style of uploading to use if a good practice. The example does that here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/upload-file/src/main/java/com/dropbox/core/examples/upload_file/Main.java#L270" target="_blank"&gt;https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/upload-file/src/main/java/com/dropbox/core/examples/upload_file/Main.java#L270&lt;/A&gt;</description>
      <pubDate>Tue, 25 Jul 2017 13:34:41 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Out-of-memory-with-java-sdk-during-uploading-unlimited-upload/m-p/233934#M12773</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-07-25T13:34:41Z</dc:date>
    </item>
  </channel>
</rss>

