On Jan 4, 2011, at 20:25 , Igor Gatis wrote:
A while ago, a colleague had a "memory leak" reusing a PB message
which contained a repeated field. If I'm not mistaken the problem
was that pb_message::Clear() calls vector<something>::clear() and
string::clear() which does not really release the memory allocated.
I can't really tell for sure actually.
@Kenton, does that make any sense? If yes, is there a way to avoid it?
Yes, I have run into this same issue, when I occasionally read in a
"huge" message. I think this is "by design." As Kenton noted: if you
re-use the message, it never has to free / reallocate memory. See the
"Optimization Tips" in this document:
There is a ::SpaceUsed() method that can be helpful.
You received this message because you are subscribed to the Google Groups "Protocol
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group at