[protobuf] DescriptorPool: call to FindFileByName() required before call to FindMessageTypeByName()?
Hi, In the code below, I've found that the returned Descriptor* is NULL after I call FindMessageTypeByName(), *unless* I first call FindFileByName() on the .proto which contains the Message I am looking for. Is this a bug? Is there another way to do this? I would really like to be able to setup a SourceTreeDescriptorDatabase to a directory that contains all of the .proto files I plan to use and not have to search for each file individually. Any advice is much appreciated. thanks, Dan string sProtoRoot("/home/dan/tests/new-protobuf/protos"); DiskSourceTree dst; dst.MapPath("", sProtoRoot); SourceTreeDescriptorDatabase stdb(&dst); DescriptorPool dp(&stdb); const FileDescriptor* pfd = dp.FindFileByName("TestMessage.proto"); const Descriptor* pd = dp.FindMessageTypeByName("Test.TestMessage"); -- 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/-/V3u8UREKOEAJ. 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] 1MB message limit (recommendation)
On May 29, 2012, at 23:26 , msrobo wrote: > According to the documentation, it's recommended that the message size > be <= 1 Megabyte. I've searched around for the reason for this > recommendation, but I can't seem to find anything. Based on some basic > benchmarking serializing/unserializing messages ranging from a few KB > to more than 1MB in C++ there doesn't seem to be a drastic increase in > time. More specifically, it doesn't seem to be performance driven in a > C++ application. I think the main motivation is that there is no way to "seek" inside a protocol buffer, and you must load the entire thing into memory in one go. Hence when you get really large messages, you may need to allocate huge amounts of memory (the memory for the serialized buffer, and the memory for the entire protocol buffer object). 1 MB is just a recommendation, but there are also some internal default limits set to 64 MB for "security" issues: If you parse an enormous message, it requires allocating a ton of RAM. Hence the limits can prevent servers from running out of memory. If you have huge messages, you'll need to call the appropriate APIs to change the limits. https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.coded_stream#CodedInputStream.SetTotalBytesLimit.details 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.
[protobuf] How to add custom #include in the Header of generated protobuf header file
Dear all, i have generated some C++ code from a protobuf message. the c++ code was generated with the option: -- cpp_out=dllexport_decl=MY_IMPORT_EXPORT so that the generated classes all have a __declspec. my problem is that I need to include at leat one header in the generated header files so that the compiler will find the MY_IMPORT_EXPORT. Is ther any option or possibility to include another header file at generation time to a protobuf header file? Thank you in advance Emeric -- 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.
[protobuf] 1MB message limit (recommendation)
According to the documentation, it's recommended that the message size be <= 1 Megabyte. I've searched around for the reason for this recommendation, but I can't seem to find anything. Based on some basic benchmarking serializing/unserializing messages ranging from a few KB to more than 1MB in C++ there doesn't seem to be a drastic increase in time. More specifically, it doesn't seem to be performance driven in a C++ application. Any insight is greatly appreciated. -- 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.