I haven't seen that before. Can you set a breakpoint in malloc_error_break like the error suggests and get a stack trace?
On Sun, Jun 7, 2009 at 4:23 AM, kgs <kgo...@gmail.com> wrote: > > Hi, > > I encountered a strange problem using protocol buffers on Mac OSX > (Leopard). > > My configuration is: > - libprotoc 2.1.0 (from macports) > - gcc (GCC) 4.3.2 > > 0. I wrote simple proto file (from examples on site): > > == Person.proto == > message Person { > required int32 id = 1; > required string name = 2; > optional string email = 3; > } > ==== > > 1. Next, I wrote simple test: > > == test.cc == > #include <iostream> > #include <string> > > #include "Person.pb.h" > > int main() { > GOOGLE_PROTOBUF_VERIFY_VERSION; > > Person person; > person.set_id(123); > person.set_name("Bob"); > person.set_email("b...@example.com"); > > std::string s; > person.SerializeToString(&s); > > Person tmp_person; > tmp_person.ParseFromString(s); > > std::cout << tmp_person.id() << std::endl > << tmp_person.name() << std::endl > << tmp_person.email() << std::endl; > > google::protobuf::ShutdownProtobufLibrary(); > } > ===== > > 3. Compilation: > > g++ Person.pb.cc test.cc -lprotobuf -L/opt/local/lib -o test > > 4. When I run this program, I get strange results: > > ==== > test(1456) malloc: *** error for object 0x36a674: Non-aligned pointer > being freed > *** set a breakpoint in malloc_error_break to debug > test(1456) malloc: *** error for object 0x36a674: Non-aligned pointer > being freed > *** set a breakpoint in malloc_error_break to debug > test(1456) malloc: *** error for object 0x36a674: Non-aligned pointer > being freed > *** set a breakpoint in malloc_error_break to debug > 123 > Bob > b...@example.com > ==== > > Running GDB (and looking at backtrace) shows me that there are some > problems with SerializeToString and ParseFromString (2 of 3 errors > above are from second function). > > It seems that on linux there is no such a problem. > Am I doing something wrong or there is a bug in library? > > Cheers, > Kamil > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---