I was having a similar problem at one point in my project development. We did 2 things to correct it:
- I set the message type (Hardware in your case) to use Arena. After this the malloc error stopped occurring. This was a temporary fix to allow us to continue development. - We found a memory leak in another area of the code that was the actual cause of the malloc error. An engineer corrected the memory leak error and I removed the Arena usage from the protobuf code and we did not have the malloc problem any more. We were developing for an embedded version of Debian, cross compiling the code. Hopefully this will help. Regards, Doug On Saturday, February 11, 2017 at 5:01:39 AM UTC-6, hce h wrote: > > Hi, > > I have a following protocol and coded running on Debian Jessie in C++, I > got google protobuf library malloc error at the statement of > Device_Interface *interface = device->add_interface();, I could not find > any errors in following implementation. Appreciate helps to fix the malloc > error. > > Device *device=hardware.add_device(); > device->set_name(device_name) > device->set_devicetype(device_type); > for (auto local_interface = local_device.interfaces()) { > Device_Interface *interface = device->add_interface(); // Caused > segmentation malloc error??? > interface->set_name(local_interface.name()); > ...... > } > > > > message Hardware { > repeated Device device = 1; > } > > message Device { > required string name = 1; > required string deviceType = 2; > repeated Interface interface = 3; > > message Interface { > required string name = 1; > required string type = 2; > } > } > > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.