Hello all.

I'm using openmpi-1.3 in this example, linux, gcc-4.3.2, configured
with nothing special.

If I run the following simple C code under valgrind, single process, I
get some errors about reading and writing already-freed memory:

---------------------------
#include <mpi.h>
#include <stdlib.h>

int delete_fn(MPI_Comm comm, int keyval, void *attr, void *extra) {
        MPI_Keyval_free(&keyval);
        return 0;
}

int main (int argc, char **argv)
{
        MPI_Comm duped;
        int keyval;
        MPI_Init(&argc, &argv);
        MPI_Comm_dup(MPI_COMM_SELF, &duped);

        MPI_Keyval_create(MPI_NULL_COPY_FN, delete_fn,  &keyval, NULL);

        MPI_Attr_put(MPI_COMM_SELF, keyval, NULL);
        MPI_Attr_put(duped, keyval, NULL);

        MPI_Comm_free(&duped);
        MPI_Finalize();
        return 0;
}
---------------------------

My main question here: Am I doing something wrong, or have I managed
to confuse openmpi's reference counts somehow?

==rob

-- 
Rob Latham
Mathematics and Computer Science Division    A215 0178 EA2D B059 8CDF
Argonne National Lab, IL USA                 B29D F333 664A 4280 315B

Reply via email to