Release unused file buffers for empty artifacts

This commit is contained in:
2026-10-09 01:52:06 +00:00
parent 389ef26db3
commit ea6c7d5f0f
5 changed files with 34 additions and 8 deletions

View File

@@ -158,7 +158,7 @@ func readFileArtifact(ctx context.Context, path string, open func(string) (artif
return nil, fmt.Errorf("failed to read file %s: %w", path, readErr)
}
}
if len(data) > 0 && cap(data)-len(data) > len(data) {
if cap(data)-len(data) > len(data) {
// A stale size hint should not make a small completed artifact retain a
// disproportionately large backing array.
compact := make([]byte, len(data))