On Mon, 22 May 2006, Neil Ludban wrote:
I'm getting a core dump when using openmpi-1.0.2 with the MPI extensions we're developing for the MATLAB interpreter. This same build of openmpi is working great with C programs and our extensions for gnu octave. The machine is AMD64 running Linux:Linux kodos 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:29:47 EST 2005 x86_64 x86_64 x86_64 GNU/Linux I believe there's a bug in that opal_memory_malloc_hooks_init() links itself into the __free_hook chain during initialization, but then it never unlinks itself at shutdown. In the interpreter environment, libopal.so is dlclose()d and unmapped from memory long before the interpreter is done with dynamic memory. A quick check of the nightly trunk snapshot reveals some function name changes, but no new shutdown code.
Can you try the attached patch and see if it solves your problem? I think it will, but I don't have a great way of testing your exact situation.
Thanks, Brian -- Brian Barrett Graduate Student, Open Systems Lab, Indiana University http://www.osl.iu.edu/~brbarret/
Index: opal/mca/memory/malloc_hooks/memory_malloc_hooks.c =================================================================== --- opal/mca/memory/malloc_hooks/memory_malloc_hooks.c (revision 10123) +++ opal/mca/memory/malloc_hooks/memory_malloc_hooks.c (working copy) @@ -27,6 +27,7 @@ /* Prototypes for our hooks. */ void opal_memory_malloc_hooks_init(void); +void opal_memory_malloc_hooks_finalize(void); static void opal_mem_free_free_hook (void*, const void *); static void* opal_mem_free_realloc_hook (void*, size_t, const void *); @@ -60,6 +61,18 @@ } +void +opal_memory_malloc_hooks_finalize(void) +{ + if (initialized == 0) { + return; + } + + __free_hook = old_free_hook; + __realloc_hook = old_realloc_hook; + initialized = 0; +} + static void opal_mem_free_free_hook (void *ptr, const void *caller) { Index: opal/mca/memory/malloc_hooks/memory_malloc_hooks_component.c =================================================================== --- opal/mca/memory/malloc_hooks/memory_malloc_hooks_component.c (revision 10123) +++ opal/mca/memory/malloc_hooks/memory_malloc_hooks_component.c (working copy) @@ -22,8 +22,10 @@ #include "opal/include/constants.h" extern void opal_memory_malloc_hooks_init(void); +extern void opal_memory_malloc_hooks_finalize(void); static int opal_memory_malloc_open(void); +static int opal_memory_malloc_close(void); const opal_memory_base_component_1_0_0_t mca_memory_malloc_hooks_component = { /* First, the mca_component_t struct containing meta information @@ -41,7 +43,7 @@ /* Component open and close functions */ opal_memory_malloc_open, - NULL + opal_memory_malloc_close }, /* Next the MCA v1.0.0 component meta data */ @@ -58,3 +60,10 @@ opal_memory_malloc_hooks_init(); return OPAL_SUCCESS; } + +static int +opal_memory_malloc_close(void) +{ + opal_memory_malloc_hooks_finalize(); + return OPAL_SUCCESS; +}