mirror of
https://github.com/rclone/rclone.git
synced 2026-09-13 14:49:29 -04:00
Each chunked upload allocated a fresh chunk-sized buffer (48 MiB by default), so bulk transfers of many files churned allocations and GC. Buffer chunks with multipart.NewRW instead so chunk memory is reused across uploads and is part of rclone's central memory management. The pool.RW is seekable, so the existing IncorrectOffset recovery which skips already-received bytes on retry carries over unchanged, and the "chunk received OK" check now compares against the bytes actually buffered so a short final chunk is recognised too. The Dropbox SDK wraps the request body in io.NopCloser, so the transport never closes the pool buffer. The upload loop closes it after every chunk, on error paths included. The FsPutRetry integration test covers the retry of a failed upload request and checks the buffers are returned to the pool.