Yes, here you are:

===
gdb) b malloc_error_break
Breakpoint 1 at 0xe24a6
(gdb) r
Starting program: protobuf_test/test
Reading symbols for shared libraries ++++.... done
Breakpoint 1 at 0x93a154a9
test(46757) malloc: *** error for object 0x36a674: Non-aligned pointer
being freed
*** set a breakpoint in malloc_error_break to debug

Breakpoint 1, 0x93a154a9 in malloc_error_break ()
(gdb) bt
#0  0x93a154a9 in malloc_error_break ()
#1  0x93a10497 in szone_error ()
#2  0x9393a523 in szone_free ()
#3  0x9393a38d in free ()
#4  0x0034bf25 in operator delete ()
#5  0x91f4802a in std::string::_Rep::_M_destroy ()
#6  0x91f49aa5 in std::string::reserve ()
#7  0x91f49baf in std::string::append ()
#8  0x001e07c2 in google::protobuf::Message::AppendPartialToString ()
#9  0x001e19fd in google::protobuf::Message::AppendToString ()
#10 0x001e1c3a in google::protobuf::Message::SerializeToString ()
#11 0x00004c9d in main ()
(gdb) c
Continuing.
test(46757) malloc: *** error for object 0x36a674: Non-aligned pointer
being freed
*** set a breakpoint in malloc_error_break to debug

Breakpoint 1, 0x93a154a9 in malloc_error_break ()
(gdb) bt
#0  0x93a154a9 in malloc_error_break ()
#1  0x93a10497 in szone_error ()
#2  0x9393a523 in szone_free ()
#3  0x9393a38d in free ()
#4  0x0034bf25 in operator delete ()
#5  0x91f4802a in std::string::_Rep::_M_destroy ()
#6  0x91f49aa5 in std::string::reserve ()
#7  0x91f49baf in std::string::append ()
#8  0x001f25e4 in google::protobuf::io::CodedInputStream::ReadString
()
#9  0x00004acd in google::protobuf::internal::WireFormat::ReadString
()
#10 0x0000356c in Person::MergePartialFromCodedStream ()
#11 0x001e1f29 in google::protobuf::Message::MergeFromCodedStream ()
#12 0x001e2061 in google::protobuf::Message::ParseFromCodedStream ()
#13 0x001e20a8 in
google::protobuf::Message::ParseFromBoundedZeroCopyStream ()
#14 0x001e21c3 in google::protobuf::Message::ParseFromString ()
#15 0x00004cba in main ()
(gdb) c
Continuing.
test(46757) malloc: *** error for object 0x36a674: Non-aligned pointer
being freed
*** set a breakpoint in malloc_error_break to debug

Breakpoint 1, 0x93a154a9 in malloc_error_break ()
(gdb) bt
#0  0x93a154a9 in malloc_error_break ()
#1  0x93a10497 in szone_error ()
#2  0x9393a523 in szone_free ()
#3  0x9393a38d in free ()
#4  0x0034bf25 in operator delete ()
#5  0x91f4802a in std::string::_Rep::_M_destroy ()
#6  0x91f49aa5 in std::string::reserve ()
#7  0x91f49d21 in std::string::append ()
#8  0x001f2624 in google::protobuf::io::CodedInputStream::ReadString
()
#9  0x00004acd in google::protobuf::internal::WireFormat::ReadString
()
#10 0x00003665 in Person::MergePartialFromCodedStream ()
#11 0x001e1f29 in google::protobuf::Message::MergeFromCodedStream ()
#12 0x001e2061 in google::protobuf::Message::ParseFromCodedStream ()
#13 0x001e20a8 in
google::protobuf::Message::ParseFromBoundedZeroCopyStream ()
#14 0x001e21c3 in google::protobuf::Message::ParseFromString ()
#15 0x00004cba in main ()
(gdb) c
Continuing.
123
Bob
b...@example.com

Program exited normally.
===

Thanks for feedback!

Cheers,
Kamil

On 8 Cze, 18:19, Kenton Varda <ken...@google.com> wrote:
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to