I think I found the source of the problem. The problem is that 
CodedInputStream has internal counter of how many bytes are read so far with 
the same object.

In my case, there are a lot of small messages saved in the same file. I do 
not read them at once and therefore do not care about large messages, 
limits. I am safe.

So, the problem can be easily solved by calling:

CodedInputStream input_stream(...);
input_stream.SetTotalBytesLimit(1e9, 9e8);

My use-case is really about storing extremely large number (up to 1e9) of 
small messages ~ 10K each.

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to