Skip to content

Commit f877063

Browse files
authored
zstd: Remove unused decompression buffer (#470)
1 parent 22de983 commit f877063

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

zstd/blockdec.go

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@ type blockDec struct {
7676
// Window size of the block.
7777
WindowSize uint64
7878

79-
history chan *history
80-
input chan struct{}
81-
result chan decodeOutput
82-
sequenceBuf []seq
83-
err error
84-
decWG sync.WaitGroup
79+
history chan *history
80+
input chan struct{}
81+
result chan decodeOutput
82+
err error
83+
decWG sync.WaitGroup
8584

8685
// Frame to use for singlethreaded decoding.
8786
// Should not be used by the decoder itself since parent may be another frame.
@@ -512,18 +511,7 @@ func (b *blockDec) decodeCompressed(hist *history) error {
512511
nSeqs = 0x7f00 + int(in[1]) + (int(in[2]) << 8)
513512
in = in[3:]
514513
}
515-
// Allocate sequences
516-
if cap(b.sequenceBuf) < nSeqs {
517-
if b.lowMem {
518-
b.sequenceBuf = make([]seq, nSeqs)
519-
} else {
520-
// Allocate max
521-
b.sequenceBuf = make([]seq, nSeqs, maxSequences)
522-
}
523-
} else {
524-
// Reuse buffer
525-
b.sequenceBuf = b.sequenceBuf[:nSeqs]
526-
}
514+
527515
var seqs = &sequenceDecs{}
528516
if nSeqs > 0 {
529517
if len(in) < 1 {

0 commit comments

Comments
 (0)