Right, reusing an instance of a message will reuse previously allocated
memory where possible. Clear() does not release memory.


On Tue, Aug 14, 2012 at 10:49 AM, Ender1618 <[email protected]> wrote:

> So I have a protobuf message that contains some fields, and a short
> sequence of messages that contain a byte field each. These byte fields
> collectively can contain in the range of 25k to 70k bytes per overall root
> message.
>
> When serializing and deserializing these messages i would like to minimize
> memory allocation and deallocation, since there can and will be a great
> deal of these messages, potentially several per second.
>
> If I instantiate a root message type and reuse it per message (by calling
> clear), is that still going to be allocating and deallocating memory
> (specifically those byte buffers) or will it reuse the memory the best it
> can  (like std::vector would)?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/uKaN7E_ghJkJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to