Skip to content

Commit d9fbef2

Browse files
authored
Reduce GCS memory footprint (#717)
1 parent eba71cb commit d9fbef2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

storage/gcp/gcp.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,8 @@ func (s *gcsStorage) setObject(ctx context.Context, objName string, data []byte,
11531153
}
11541154
w.ContentType = contType
11551155
w.CacheControl = cacheCtl
1156+
// Limit the amount of memory used for buffers, see https://pkg.go.dev/cloud.google.com/go/storage#Writer
1157+
w.ChunkSize = len(data) + 1024
11561158
if _, err := w.Write(data); err != nil {
11571159
return fmt.Errorf("failed to write object %q to bucket %q: %w", objName, s.bucket, err)
11581160
}

0 commit comments

Comments
 (0)