Skip to content

Commit

Permalink
relase bytebuffer earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
ppzqh committed Feb 6, 2024
1 parent 6555cf8 commit 2720c2a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/remote/codec/default_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ func (c *defaultCodec) encodeMetaAndPayloadWithCRC32C(ctx context.Context, messa

// 1. encode payload and calculate crc32c checksum
newPayloadOut := remote.NewWriterBuffer(PayloadBufferSize)
defer newPayloadOut.Release(nil)

if err = me.EncodePayload(ctx, message, newPayloadOut); err != nil {
return err
Expand All @@ -207,6 +206,7 @@ func (c *defaultCodec) encodeMetaAndPayloadWithCRC32C(ctx context.Context, messa
} else {
payload, err = newPayloadOut.Bytes()
}
newPayloadOut.Release(err)
if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion pkg/remote/default_bytebuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func init() {
}

// NewWriterBuffer is used to create a defaultByteBuffer using the given size.
// NOTICE: defaultByteBuffer is only used for testing.
func NewWriterBuffer(size int) ByteBuffer {
return newWriterByteBuffer(size)
}
Expand Down

0 comments on commit 2720c2a

Please sign in to comment.