Rendering causes endless memory allocations on proto messages
Author: antoniomacriCreated May 18, 2022Updated May 21, 2024
Consider this:
import (
. "github.com/smartystreets/goconvey/convey"
"google.golang.org/protobuf/types/known/wrapperspb"
"log"
"testing"
)
func TestConveyBug(t *testing.T) {
Convey("Given something", t, func() {
var x = &wrapperspb.BoolValue{Value: false}
log.Printf("Receive type %v", x)
So(nil, ShouldResemble, x)
})
}When I run this test (I actually used GoLand), it starts allocating memory until I kill it.
The problem seems to be in this function (render.go):
func (s *traverseState) render(buf *bytes.Buffer, ptrs int, v reflect.Value, implicit bool)Source: smartystreets/goconvey