On Oct 23, 1:43 pm, "Kenton Varda" <[EMAIL PROTECTED]> wrote:
> STL strings never shrink.  When they're cleared, they keep their memory
> around for reuse.  So, you could take advantage of that to accomplish what
> you want by setting all your string fields to values of the maximum size and
> then clearing them.  For example:
>   StaticSizeMsg msg;
>   msg.set_message(string(50, 'x'));
>   msg.Clear();

I have a similar problem... we try to do our own memory management
for events that we publish/subscribe with some fixed sized pools.  I
suppose there is a way to pass a block of memory to a message upon
construction so it uses that block of memory instead of the heap is


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 [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to