Skip to content

Reduce object body memory copies#37

Merged
louisgls merged 1 commit intomainfrom
fix/reduce-s3proxy-memory
Apr 22, 2026
Merged

Reduce object body memory copies#37
louisgls merged 1 commit intomainfrom
fix/reduce-s3proxy-memory

Conversation

@louisgls
Copy link
Copy Markdown
Collaborator

@louisgls louisgls commented Apr 22, 2026

Summary

  • avoid cloning successful S3 response bodies in the raw-response middleware
  • preallocate request and response body buffers when Content-Length is known
  • drop plaintext/ciphertext references earlier after encryption/decryption to reduce peak live memory
  • add unit coverage for fixed-size body reads and short-body errors

Context

This is a focused upstream version of the memory work discussed in #28 .

Unlike #28, the raw-response middleware still stores the error body in metadata after reading it, so forwarded S3 error responses keep their raw XML body.

Supersedes #36, which GitHub closed automatically when its head branch was renamed.

Validation

  • go test ./...
  • CGO_ENABLED=0 GOOS=linux go build -o /tmp/s3proxy-memory ./s3proxy/cmd

@louisgls louisgls marked this pull request as ready for review April 22, 2026 13:51
@louisgls louisgls merged commit 6948465 into main Apr 22, 2026
2 checks passed
@louisgls louisgls deleted the fix/reduce-s3proxy-memory branch April 22, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant