Python/uuid bytes field

2009-06-16 Thread aronb
We are working on a project where we are sending UUIDs between a backedn written in C++ and a Python front end. Our proto file specifies that we want to store these UUIDs in byte fields. This maps to a std::string in C++ which we can assign to manually. We are running into a problem on the Python

Usage RepeatedPtrField - Advanced memory mgmt

2009-06-16 Thread RobertFach
Hi, is there anybody out there who can tell me how the special methods like addcleared(), etc. for repeated field ptr work? I guess I can somehow improve/avoid the allocation overhead, right? Say, I have the following messages, message test { repeated chunk = 1; } message chunk { int

Re: Java thread safety

2009-06-16 Thread Kenton Varda
The Java implementation does not contain any mutable singletons, so as long as you are accessing different objects, there is no need to worry about thread-safety. So, yes, multiple threads may call parseFrom() at the same time as long as they are parsing from different streams. On Mon, Jun 15,

Re: Usage RepeatedPtrField - Advanced memory mgmt

2009-06-16 Thread Kenton Varda
Everything you say sounds right. If you want to know precisely what these methods do, or how much overhead they incur, I encourage you to look at the code in repeated_field.h -- it's not very complicated. However, instead of trying to control all this in detail, it's usually easiest to simply

Re: Usage RepeatedPtrField - Advanced memory mgmt

2009-06-16 Thread RobertFach
However, instead of trying to control all this in detail, it's usually easiest to simply make sure that you reuse your protobuf objects.  If you parse a message, clear it, and then parse another message into the same object, it will reuse the memory for sub-objects and such which was

Re: Python/uuid bytes field

2009-06-16 Thread Kenton Varda
I checked the code, and AFAICT, the error you are getting should only happen with string fields, not bytes. I wrote a test to make sure and, sure enough, assigning a non-ASCII str to a bytes field worked fine. Can you write a small program demonstrating the problem for us to debug? On Tue, Jun

Re: Usage RepeatedPtrField - Advanced memory mgmt

2009-06-16 Thread Kenton Varda
On Tue, Jun 16, 2009 at 10:13 AM, RobertFach robert.f...@inf.tu-dresden.dewrote: So if I understood you right, say my example message test contains 10 chunks, if I clear that message and parse another message containing 9 chunks, no allocation would be performed and 1 cleared chunk object

Use of repeated

2009-06-16 Thread skshe...@gmail.com
I am experimenting with repeated fields my dot-proto is as follows: message Foo { required string name= 1; optional int32 id = 2; optional int32 num = 3; repeated string sbr = 4; repeated int32 wrk

RE: 'Streaming' messages (say over a socket)

2009-06-16 Thread Alex Black
Thanks, I got something working...how does this look? (ugly I'm sure...) On the C++ server side I am looping sending many messages (all of the same type), and on the Java side I am looping parsing them out. C++ Server: int size = message.ByteSize(); EnsureBufferIsAtLeastSize(size