[protobuf] Static allocation

2012-07-17 Thread Jeremy Swigart
Is there a way to tell the proto compiler to generate message definitions 
for which the message fields are statically defined rather than each 
individual field allocated with dynamic memory? Obviously the repeater 
fields couldn't be fully statically allocated(unless you could provide the 
compiler with a max size), but it would be preferable to have the option to 
create messages with minimal dynamic memory impact. Is this possible in the 
current library?

-- 
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/-/Hgcdsv8WS6gJ.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Static allocation

2012-07-17 Thread Evan Jones
On Jul 17, 2012, at 2:33 , Jeremy Swigart wrote:
 Is there a way to tell the proto compiler to generate message definitions for 
 which the message fields are statically defined rather than each individual 
 field allocated with dynamic memory? Obviously the repeater fields couldn't 
 be fully statically allocated(unless you could provide the compiler with a 
 max size), but it would be preferable to have the option to create messages 
 with minimal dynamic memory impact. Is this possible in the current library?

I'll assume you are talking C++. In this case, if you re-use a single message, 
it will re-use the dynamically allocated memory. This means that after the 
maximal message(s) have been parsed, it will no longer allocate memory. This 
is approximately equivalent to what you want. See Optimization Tips in:

https://developers.google.com/protocol-buffers/docs/cpptutorial

Hope that helps,

Evan

--
http://evanjones.ca/

-- 
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 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.