Note that Buffer.Unmarshal does NOT reset the destination protobuf. When repeatedly Unmarshalling into the same destination, this can cause a memory leak. PiperOrigin-RevId: 135304939
diff --git a/proto/decode.go b/proto/decode.go index 04dcb88..a54a8cc 100644 --- a/proto/decode.go +++ b/proto/decode.go
@@ -340,6 +340,8 @@ // Buffer and places the decoded result in pb. If the struct // underlying pb does not match the data in the buffer, the results can be // unpredictable. +// +// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. func (p *Buffer) Unmarshal(pb Message) error { // If the object can unmarshal itself, let it. if u, ok := pb.(Unmarshaler); ok {