Skip to content

Commit

Permalink
Merge pull request #598 from matheusd/fix-msa
Browse files Browse the repository at this point in the history
MultiSegmentArena: Fix release back into bufferpool
  • Loading branch information
lthibault authored Jan 10, 2025
2 parents b4bdc80 + c17d814 commit f9295d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arena.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1825,6 +1825,8 @@ func BenchmarkDecode(b *testing.B) {
if err != nil {
b.Fatal(err)
}

msg.Release()
}
}
}
Expand Down

0 comments on commit f9295d9

Please sign in to comment.