Skip to content

Commit

Permalink
tests: Fix reuse of SingleSegmentArena
Browse files Browse the repository at this point in the history
The arena was reused when it shouldn't after a Release() call.
  • Loading branch information
matheusd committed Aug 15, 2024
1 parent c7c3a76 commit 1eb7143
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,7 @@ func BenchmarkMarshal_ReuseMsg(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
a := data[r.Intn(len(data))]
seg, err := msg.Reset(msg.Arena)
seg, err := msg.Reset(capnp.SingleSegment(nil))
if err != nil {
b.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,11 +646,11 @@ var errReadOnlyArena = errors.New("Allocate called on read-only arena")

func BenchmarkMessageGetFirstSegment(b *testing.B) {
var msg Message
var arena Arena = SingleSegment(nil)

b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
arena := SingleSegment(nil)
_, err := msg.Reset(arena)
if err != nil {
b.Fatal(err)
Expand Down

0 comments on commit 1eb7143

Please sign in to comment.