Reference counting


Up: MPI Objects Next: Why reference counts Previous: When should objects be freed?

MPI keeps track of the use of an MPI object, and only truely destroys it when no-one is using it. newx1 is being used by the user (the MPI_Type_vector that created it) and by the MPI_Datatype newx that uses it.

If newx1 is not needed after newx is defined, it should be freed:

MPI_Type_vector( ly, 1, nx, MPI_DOUBLE, &newx1 ); 
MPI_Type_hvector( lz, 1, nx*ny*sizeof(double), newx1,  
                  &newx ); 
MPI_Type_free( &newx1 ); 
MPI_Type_commit( &newx ); 



Up: MPI Objects Next: Why reference counts Previous: When should objects be freed?