Re: [protobuf] C++ malloc error when adding a repeated message element
Sorry for taking so long to reply, somehow this slipped through my inbox. It does sound like this must have something to do with the runtime environment on your embedded board. It might be interesting to try calling malloc directly and see if you can reproduce the same kind of failure that way, perhaps by making the same sequence of malloc calls that the protobuf implementation would be doing internally. On Tue, Jan 10, 2017 at 9:06 AM, Doug Lewis wrote: > Some additional information that I've obtained from the debugging process. > > This malloc error is occurring in: > > void RepeatedField::Reserve(int new_size) > > this is in repeated_field.h. > > > On Tuesday, January 10, 2017 at 10:51:12 AM UTC-6, Doug Lewis wrote: >> >> Here's the error message I get during execution: >> >> lStat: malloc.c:3695: _int_malloc: Assertion `(unsigned long) (size) >= >> (unsigned long) (nb)' failed. >> >> This code is executing on a Beaglebone ARM board running Linux RTOS. >> We're cross compiling. >> >> We have tried this same code building it on Windows and we do not get the >> malloc error on Windows so we believe it is something to do with the memory >> setup on the embedded board. >> >> Regards, >> Doug >> >> >> On Friday, January 6, 2017 at 6:37:04 PM UTC-6, Adam Cozzette wrote: >>> >>> Could you provide some more details on what the error message looks >>> like? I don't see anything obviously wrong with your code, so it's hard to >>> say what the problem could be. >>> >>> On Fri, Jan 6, 2017 at 9:01 AM, Doug Lewis wrote: >>> I get a malloc error when I try to add a repeated message element. Below is the .proto message definition: message Discovery { uint32 lmuSerialNumber = 1; uint64 gpsTime = 2; repeated EquipmentInfo discoveredUnits = 3; } Here is the code where I'm trying to add discoveredUnits to the message: for (int i = 0; i < numOfAssocMotes; i++) { EquipmentInfo* assocUnitInfo = outAssocUnitDiscoveryMsg.add_a ssociatedunits(); assocUnitInfo->set_unitserialnumber(mySerialNum); assocUnitInfo->set_latitude(myLatitude); assocUnitInfo->set_longitude(myLongitude); } I get the malloc error when the add_associatedunits() function is called. Thanks, Doug -- 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+u...@googlegroups.com. To post to this group, send email to prot...@googlegroups.com. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout. >>> >>> -- > 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. > -- 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.
Re: [protobuf] C++ malloc error when adding a repeated message element
Some additional information that I've obtained from the debugging process. This malloc error is occurring in: void RepeatedField::Reserve(int new_size) this is in repeated_field.h. On Tuesday, January 10, 2017 at 10:51:12 AM UTC-6, Doug Lewis wrote: > > Here's the error message I get during execution: > > lStat: malloc.c:3695: _int_malloc: Assertion `(unsigned long) (size) >= > (unsigned long) (nb)' failed. > > This code is executing on a Beaglebone ARM board running Linux RTOS. > We're cross compiling. > > We have tried this same code building it on Windows and we do not get the > malloc error on Windows so we believe it is something to do with the memory > setup on the embedded board. > > Regards, > Doug > > > On Friday, January 6, 2017 at 6:37:04 PM UTC-6, Adam Cozzette wrote: >> >> Could you provide some more details on what the error message looks like? >> I don't see anything obviously wrong with your code, so it's hard to say >> what the problem could be. >> >> On Fri, Jan 6, 2017 at 9:01 AM, Doug Lewis wrote: >> >>> I get a malloc error when I try to add a repeated message element. >>> >>> Below is the .proto message definition: >>> >>> message Discovery >>> { >>> uint32 lmuSerialNumber = 1; >>> uint64 gpsTime = 2; >>> repeated EquipmentInfo discoveredUnits = 3; >>> } >>> >>> Here is the code where I'm trying to add discoveredUnits to the message: >>> >>> for (int i = 0; i < numOfAssocMotes; i++) >>> { >>> EquipmentInfo* assocUnitInfo = >>> outAssocUnitDiscoveryMsg.add_associatedunits(); >>> assocUnitInfo->set_unitserialnumber(mySerialNum); >>> assocUnitInfo->set_latitude(myLatitude); >>> assocUnitInfo->set_longitude(myLongitude); >>> } >>> >>> I get the malloc error when the add_associatedunits() function is called. >>> >>> Thanks, >>> Doug >>> >>> -- >>> 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+u...@googlegroups.com. >>> To post to this group, send email to prot...@googlegroups.com. >>> Visit this group at https://groups.google.com/group/protobuf. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- 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.
Re: [protobuf] C++ malloc error when adding a repeated message element
Here's the error message I get during execution: lStat: malloc.c:3695: _int_malloc: Assertion `(unsigned long) (size) >= (unsigned long) (nb)' failed. This code is executing on a Beaglebone ARM board running Linux RTOS. We're cross compiling. We have tried this same code building it on Windows and we do not get the malloc error on Windows so we believe it is something to do with the memory setup on the embedded board. Regards, Doug On Friday, January 6, 2017 at 6:37:04 PM UTC-6, Adam Cozzette wrote: > > Could you provide some more details on what the error message looks like? > I don't see anything obviously wrong with your code, so it's hard to say > what the problem could be. > > On Fri, Jan 6, 2017 at 9:01 AM, Doug Lewis > wrote: > >> I get a malloc error when I try to add a repeated message element. >> >> Below is the .proto message definition: >> >> message Discovery >> { >> uint32 lmuSerialNumber = 1; >> uint64 gpsTime = 2; >> repeated EquipmentInfo discoveredUnits = 3; >> } >> >> Here is the code where I'm trying to add discoveredUnits to the message: >> >> for (int i = 0; i < numOfAssocMotes; i++) >> { >> EquipmentInfo* assocUnitInfo = >> outAssocUnitDiscoveryMsg.add_associatedunits(); >> assocUnitInfo->set_unitserialnumber(mySerialNum); >> assocUnitInfo->set_latitude(myLatitude); >> assocUnitInfo->set_longitude(myLongitude); >> } >> >> I get the malloc error when the add_associatedunits() function is called. >> >> Thanks, >> Doug >> >> -- >> 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+u...@googlegroups.com . >> To post to this group, send email to prot...@googlegroups.com >> . >> Visit this group at https://groups.google.com/group/protobuf. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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.
Re: [protobuf] C++ malloc error when adding a repeated message element
Could you provide some more details on what the error message looks like? I don't see anything obviously wrong with your code, so it's hard to say what the problem could be. On Fri, Jan 6, 2017 at 9:01 AM, Doug Lewis wrote: > I get a malloc error when I try to add a repeated message element. > > Below is the .proto message definition: > > message Discovery > { > uint32 lmuSerialNumber = 1; > uint64 gpsTime = 2; > repeated EquipmentInfo discoveredUnits = 3; > } > > Here is the code where I'm trying to add discoveredUnits to the message: > > for (int i = 0; i < numOfAssocMotes; i++) > { > EquipmentInfo* assocUnitInfo = outAssocUnitDiscoveryMsg.add_ > associatedunits(); > assocUnitInfo->set_unitserialnumber(mySerialNum); > assocUnitInfo->set_latitude(myLatitude); > assocUnitInfo->set_longitude(myLongitude); > } > > I get the malloc error when the add_associatedunits() function is called. > > Thanks, > Doug > > -- > 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. > -- 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.