[#2339] Reduce memory usage in ProtobufVarint32LengthFieldPrepender
Motivation: Reduce memory usage in ProtobufVarint32LengthFieldPrepender. Modifications: Explicit set the buffer size that is needed for the header (between 1 and 5 bytes). Result: Less memory usage in ProtobufVarint32LengthFieldPrepender.
This commit is contained in:
parent
68670ba195
commit
ab2119feac
@ -47,7 +47,7 @@ public class ProtobufVarint32LengthFieldPrepender extends MessageToByteEncoder<B
|
||||
out.ensureWritable(headerLen + bodyLen);
|
||||
|
||||
CodedOutputStream headerOut =
|
||||
CodedOutputStream.newInstance(new ByteBufOutputStream(out));
|
||||
CodedOutputStream.newInstance(new ByteBufOutputStream(out), headerLen);
|
||||
headerOut.writeRawVarint32(bodyLen);
|
||||
headerOut.flush();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user