detached ab3fd84

fix(snapshot): drop inflate buffer slack from retained payloads

A grown buffer could keep up to twice the payload size for every restored history chunk.
commit
ab3fd846f61cdd8dbea677b1b3f87b18ba831d68
author
brice · · 2026-10-08 06:22 UTC
committer
brice · · 2026-10-08 06:24 UTC
parent
fab9d89
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +4 -0
M internal/snapshotcodec/object_compress.go +4 -0
@@ -66,6 +66,10 @@ func inflateObjectPayload(compressed []byte, size uint32) ([]byte, error) {
6666 return nil, invalid(io.ErrUnexpectedEOF)
6767 }
6868 payload := out.Bytes()
69+ if cap(payload) > len(payload)+len(payload)/4 {
70+ // Restored payloads are retained; drop the growth slack.
71+ payload = bytes.Clone(payload)
72+ }
6973 var extra [1]byte
7074 if n, err := r.Read(extra[:]); n != 0 || err != io.EOF {
7175 if err == nil || err == io.EOF {
@@ -66,6 +66,10 @@ func inflateObjectPayload(compressed []byte, size uint32) ([]byte, error) {
66 return nil, invalid(io.ErrUnexpectedEOF)66 return nil, invalid(io.ErrUnexpectedEOF)
67 }67 }
68 payload := out.Bytes()68 payload := out.Bytes()
69+ if cap(payload) > len(payload)+len(payload)/4 {
70+ // Restored payloads are retained; drop the growth slack.
71+ payload = bytes.Clone(payload)
72+ }
69 var extra [1]byte73 var extra [1]byte
70 if n, err := r.Read(extra[:]); n != 0 || err != io.EOF {74 if n, err := r.Read(extra[:]); n != 0 || err != io.EOF {
71 if err == nil || err == io.EOF {75 if err == nil || err == io.EOF {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close