________________________________________
I'm not sure what to make of these instances of "Invalid read error". If I try
a simple test program where I feed free() a pointer that is off from a pointer
that's been properly malloc'd, I get an "Invalid free() / delete / delete[] /
realloc()" instead of the "Invalid read error".
________________________________________
Finally managed to reproduce the "Invalid read error" from free() with a small
test case here:
#include <iostream>
#include <stdlib.h>
#include <mpi.h>
int main(int argc, char ** argv) {
MPI_Init(&argc, &argv);
int size, rank;
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
int * foo;
foo = (int*)malloc(sizeof(int)*size);
std::cout << "foo = [";
for (int i = 0; i < size; ++i) {
foo[i] = rank + i;
std::cout << " " << foo[i];
}
std::cout << " ]\n";
free(foo);
MPI_Finalize();
return 0;
}
The catch is that the "Invalid read error" only shows up if I run this simple
test case on more than two nodes of a cluster. If I run in parallel, but the
parallel cores are all on a single node, then there are no errors.
------------------------------------------------------------------------------
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users