MueLu: pointer being freed was not allocated
Created by: tjfulle
I get the following error when running a simple driver (Mac OS X, gcc 6.3, openmpi 1.10.3):
Driver.Darwin.x(62878,0x7fff78d2f000) malloc: *** error for object 0x7f8951032e00: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
[s1008256:62878] *** Process received signal ***
[s1008256:62878] Signal: Abort trap: 6 (6)
[s1008256:62878] Signal code: (0)
[s1008256:62878] *** End of error message ***
Abort trap: 6
I'm not sure if this is a @trilinos/muelu specific problem, or not, but building the driver against Trilinos built without MueLu does not give an error (to be fair, when I rebuilt without MueLu, I left out Epetra, EpetraExt, and AztecOO, too). However, running the driver in valgrind
suggests that the problem is indeed in MueLu (see lines with ==62014== by 0x1026A24CB: __static_initialization_and_destruction_0(int, int) (MueLu_Facade_Simple_def.hpp:180)
and ==62014== by 0x1026A2667: _GLOBAL__sub_I_MueLu_FacadeSimple.cpp (MueLu_ETI_4arg.hpp:32))
:
==62014== Invalid free() / delete / delete[] / realloc()
==62014== at 0x100F5CABD: free (vg_replace_malloc.c:533)
==62014== by 0x100070335: __gnu_cxx::new_allocator<char>::deallocate(char*, unsigned long) (ext/new_allocator.h:110)
==62014== by 0x1000553FF: std::allocator_traits<std::allocator<char> >::deallocate(std::allocator<char>&, char*, unsigned long) (alloc_traits.h:442)
==62014== by 0x10003CC85: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_destroy(unsigned long) (basic_string.h:186)
==62014== by 0x10003C7D5: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose() (basic_string.h:181)
==62014== by 0x10001BFE7: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (basic_string.h:558)
==62014== by 0x114860462: __cxa_finalize_ranges (in /usr/lib/system/libsystem_c.dylib)
==62014== by 0x114860766: exit (in /usr/lib/system/libsystem_c.dylib)
==62014== by 0x1147A65B3: start (in /usr/lib/system/libdyld.dylib)
==62014== Address 0x115e0d910 is 0 bytes inside a block of size 10,784 free'd
==62014== at 0x100F5CABD: free (vg_replace_malloc.c:533)
==62014== by 0x100070335: __gnu_cxx::new_allocator<char>::deallocate(char*, unsigned long) (ext/new_allocator.h:110)
==62014== by 0x1000553FF: std::allocator_traits<std::allocator<char> >::deallocate(std::allocator<char>&, char*, unsigned long) (alloc_traits.h:442)
==62014== by 0x10003CC85: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_destroy(unsigned long) (basic_string.h:186)
==62014== by 0x10003C7D5: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose() (basic_string.h:181)
==62014== by 0x10001BFE7: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (basic_string.h:558)
==62014== by 0x114860462: __cxa_finalize_ranges (in /usr/lib/system/libsystem_c.dylib)
==62014== by 0x114860766: exit (in /usr/lib/system/libsystem_c.dylib)
==62014== by 0x1147A65B3: start (in /usr/lib/system/libdyld.dylib)
==62014== Block was alloc'd at
==62014== at 0x100F5C681: malloc (vg_replace_malloc.c:302)
==62014== by 0x114273061: operator new(unsigned long) (in /opt/local/lib/libgcc/libstdc++.6.dylib)
==62014== by 0x10007042D: std::allocator_traits<std::allocator<char> >::allocate(std::allocator<char>&, unsigned long) (alloc_traits.h:416)
==62014== by 0x100055A9B: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long) (basic_string.tcc:153)
==62014== by 0x100070162: void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) (basic_string.tcc:219)
==62014== by 0x100055302: void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char const*>(char const*, char const*, std::__false_type) (basic_string.h:196)
==62014== by 0x10003CA62: void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*) (basic_string.h:215)
==62014== by 0x10001C32C: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.h:456)
==62014== by 0x1026A24CB: __static_initialization_and_destruction_0(int, int) (MueLu_Facade_Simple_def.hpp:180)
==62014== by 0x1026A2667: _GLOBAL__sub_I_MueLu_FacadeSimple.cpp (MueLu_ETI_4arg.hpp:32)
==62014== by 0x7FFF5FC1310A: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==62014== by 0x7FFF5FC13283: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==62014==
==62014==
==62014== HEAP SUMMARY:
==62014== in use at exit: 256,961 bytes in 627 blocks
==62014== total heap usage: 419,122 allocs, 418,503 frees, 34,726,526 bytes allocated
==62014==
==62014== LEAK SUMMARY:
==62014== definitely lost: 47,738 bytes in 12 blocks
==62014== indirectly lost: 73 bytes in 4 blocks
==62014== possibly lost: 792 bytes in 3 blocks
==62014== still reachable: 185,482 bytes in 412 blocks
==62014== suppressed: 22,876 bytes in 196 blocks
==62014== Rerun with --leak-check=full to see details of leaked memory
==62014==
==62014== For counts of detected and suppressed errors, rerun with: -v
==62014== ERROR SUMMARY: 8 errors from 1 contexts (suppressed: 0 from 0)
On a related note, this error seems to be the primary reason I don't have 100% test passage on OS X with the standard PT tests.