Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: Andreas Schäfer (gentryx_at_[hidden])
Date: 2006-11-12 21:00:32


Hi,

one of our projects recently exposed severe memory leakage when using
ROMIO to write a complex derived datatype (a struct made of other
structs) to a file. From our code we distilled the attached short
program to reproduce the leak.

After some Valgrind sessions, it appears as if the memcpy in
ompi_ddt_duplicate() is a bit overhasty, as it does copy the old
type's reference counter, too.

I don't know if this is the right way to fix it, but if I apply the
patch below to ompi the leak is fixed.

Cheers!
-Andreas

diff -ru openmpi-1.1.1/ompi/datatype/dt_create_dup.c
openmpi-1.1.1-fixed/ompi/datatype/dt_create_dup.c
--- openmpi-1.1.1/ompi/datatype/dt_create_dup.c 2006-06-14
21:56:41.000000000 +0200
+++ openmpi-1.1.1-fixed/ompi/datatype/dt_create_dup.c 2006-11-13
00:35:03.000000000 +0100
@@ -33,6 +33,7 @@
     int32_t old_index = pdt->d_f_to_c_index;

     memcpy( pdt, oldType, sizeof(ompi_datatype_t) );
+ ((opal_object_t *)pdt)->obj_reference_count = 1;
     pdt->desc.desc = temp;
     pdt->flags &= (~DT_FLAG_PREDEFINED);
     /* ompi_ddt_create() creates a new f_to_c index that was saved





  • application/pgp-signature attachment: stored