Thanks for your response. I thought of reusing proto messages in loops but it is not supported for a good reason.
Regards, Prakash On Aug 21, 12:14 am, Jason Hsueh <[email protected]> wrote: > This has come up before on the list, for > instancehttp://groups.google.com/group/protobuf/browse_thread/thread/6f4812e3...http://groups.google.com/group/protobuf/browse_thread/thread/368f5b05... > > On Fri, Aug 20, 2010 at 7:19 AM, Prakash Rao <[email protected]>wrote: > > > > > Hi, > > Is it possible to re-use proto object while sending list of proto > > objects instead of building a new proto object each time? Currently > > i'm building a new proto object and it is put in a proto list & return > > it to the client. Is it possible to re-use the proto object as stated > > below? > > > // Create proto object (the same proto object is going to be used in > > the while loop) > > while loop { > > // populate proto object > > // wirte proto object to coded output stream > > // clear proto object > > } > > > flush coded outputstream > > > I'm trying to do this and it says you can't clear proto object once > > it's already built. If this is possible, is there any performance > > overhead with this approach (memory wise we might save something as we > > are reusing proto object but clear API may add performance overhead). > > > Regards, > > Prakash > > > -- > > 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]<protobuf%[email protected]om> > > . > > For more options, visit this group at > >http://groups.google.com/group/protobuf?hl=en.- Hide quoted text - > > - Show quoted text - -- 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.
