I wrote simple app to test upload with dropbox-core-sdk 2.1.2.
It opens stream from a file located at Dropbox
InputStream fileContentStream = getClient().files().download(path).getInputStream();
and passes it to upload method (within same account, but should be same even for different accounts):
builder.uploadAndFinish(fileContentStream);
The problem is memory consumption rapidly increases from 5MB to 192MB within 10 s., then app crashes:
I/art: Clamp target GC heap from 207MB to 192MB
I/art: HomogeneousSpaceCompact marksweep + semispace GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 0% free, 191MB/192MB, paused 624.881ms total 624.881ms
W/art: Throwing OutOfMemoryError "Failed to allocate a 12 byte allocation with 3680 free bytes and 3KB until OOM"
File size is 550MB. Allocation trace showing DbxUploadStyleBuilder.uploadAndFinish():92 is the main contributor; it breaks down to com.android.okhttp.okio.SegmentPool.take():46 which is allocating numerous byte[] chunks 12288 each until crash.
Question: am I using the dropbox SDK not properly for uploading of large files or it's an issue with SDK?