Skip to content

Commit

Permalink
zstd: Remove unused decompression buffer (#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
klauspost committed Jan 16, 2022
1 parent 22de983 commit f877063
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions zstd/blockdec.go
Expand Up @@ -76,12 +76,11 @@ type blockDec struct {
// Window size of the block.
WindowSize uint64

history chan *history
input chan struct{}
result chan decodeOutput
sequenceBuf []seq
err error
decWG sync.WaitGroup
history chan *history
input chan struct{}
result chan decodeOutput
err error
decWG sync.WaitGroup

// Frame to use for singlethreaded decoding.
// Should not be used by the decoder itself since parent may be another frame.
Expand Down Expand Up @@ -512,18 +511,7 @@ func (b *blockDec) decodeCompressed(hist *history) error {
nSeqs = 0x7f00 + int(in[1]) + (int(in[2]) << 8)
in = in[3:]
}
// Allocate sequences
if cap(b.sequenceBuf) < nSeqs {
if b.lowMem {
b.sequenceBuf = make([]seq, nSeqs)
} else {
// Allocate max
b.sequenceBuf = make([]seq, nSeqs, maxSequences)
}
} else {
// Reuse buffer
b.sequenceBuf = b.sequenceBuf[:nSeqs]
}

var seqs = &sequenceDecs{}
if nSeqs > 0 {
if len(in) < 1 {
Expand Down

0 comments on commit f877063

Please sign in to comment.