diff --git a/arena.go b/arena.go index 61440919..89b0df2c 100644 --- a/arena.go +++ b/arena.go @@ -267,6 +267,7 @@ func (msa *MultiSegmentArena) demux(hdr streamHeader, data []byte, bp *bufferpoo msa.segs = append(msa.segs, make([]Segment, inc)...) } + rawData := data for i := SegmentID(0); i <= maxSeg; i++ { sz, err := hdr.segmentSize(SegmentID(i)) if err != nil { @@ -277,7 +278,7 @@ func (msa *MultiSegmentArena) demux(hdr streamHeader, data []byte, bp *bufferpoo msa.segs[i].id = i } - msa.rawData = data + msa.rawData = rawData msa.bp = bp return nil } diff --git a/integration_test.go b/integration_test.go index 7abc59fb..fbdee38f 100644 --- a/integration_test.go +++ b/integration_test.go @@ -1825,6 +1825,8 @@ func BenchmarkDecode(b *testing.B) { if err != nil { b.Fatal(err) } + + msg.Release() } } }