Hello,
I am using GCC to compile a python extension. My info is:
Intel MacBook Pro
Mac OS X 10.5.7
g++ 4.4.0
I get the following runtime error message under a variety of different
output situations:
python(17632) malloc: *** error for object 0x216b674: Non-aligned
pointer being freed
*** set a breakpoint in malloc_error_break to debug
Setting the breakpoint in gdb, the traceback is:
Breakpoint 1, 0x917284a9 in malloc_error_break ()
(gdb) bt
#0 0x917284a9 in malloc_error_break ()
#1 0x91723497 in szone_error ()
#2 0x9164d523 in szone_free ()
#3 0x9164d38d in free ()
#4 0x9358a02a in std::string::_Rep::_M_destroy ()
#5 0x9358b4ab in std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::~basic_string ()
#6 0x9358624f in std::basic_stringbuf<char, std::char_traits<char>,
std::allocator<char> >::overflow ()
#7 0x93588e19 in std::basic_streambuf<char, std::char_traits<char>
>::xsputn ()
#8 0x021206ea in std::__ostream_insert<char, std::char_traits<char> >
()
#9 0x0212098e in std::operator<< <std::char_traits<char> > ()
#10 0x01e26969 in Epetra_BlockMap::Print (this=0x2e01670,
os=@0xbfffbe70) at /Users/wfspotz/Development/Trilinos-dev/packages/
epetra/src/Epetra_BlockMap.cpp:858
...
The Epetra_BlockMap::Print() code at line 858 is simply
os << "\nNumber of Global Elements = "; os << NumGlobalElements();
os << endl;
where os is an ostream object (in this case, an ostringstream object)
and NumGlobalElements() is a method that returns an int. My attempts
to isolate the problem indicate that there is a strong dynamic
component to the problem. The number and order of dynamically loaded
libraries can affect what raises the error and when.
Given the simplicity of the code where the problem is occurring, and
the fact that earlier versions of g++ don't produce the problem, it is
hard to imagine that the code is the issue. Is there perhaps a
compiler option I should be using? Any help would be appreciated.
Thanks
** Bill Spotz **
** Sandia National Laboratories Voice: (505)845-0170 **
** P.O. Box 5800 Fax: (505)284-0154 **
** Albuquerque, NM 87185-0370 Email: wfspotz@xxxxxxxxxx **