How to change the buffer limit in Google's protobuf?

前端 未结 3 546
梦谈多话
梦谈多话 2020-12-09 20:34

I\'m getting this warning and an error afterwards when I try to parse a large message. I know than 64MB which is the default limit. I am using message.ParseFromIstream now.

3条回答
  •  渐次进展
    2020-12-09 20:54

    The correct fix: You should try to limit the sizes of your protobuf messages. Please see: https://developers.google.com/protocol-buffers/docs/techniques#streaming

    The quick and dirty (read not recommended) approach: In the file coded_stream.h of the protobuf library source, change the values of kDefaultTotalBytesLimit and kDefaultTotalBytesWarningThreshold, recompile, and reinstall.

提交回复
热议问题